<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Codemate</title>
	<atom:link href="http://codemate.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codemate.wordpress.com</link>
	<description>Being friends with the code</description>
	<lastBuildDate>Mon, 26 Sep 2011 01:48:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codemate.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Codemate</title>
		<link>http://codemate.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codemate.wordpress.com/osd.xml" title="Codemate" />
	<atom:link rel='hub' href='http://codemate.wordpress.com/?pushpress=hub'/>
		<item>
		<title>What&#8217;s the coolest development platform out there right now? (Why?)</title>
		<link>http://codemate.wordpress.com/2010/04/23/whats-the-coolest-development-platform-out-there-right-now-why/</link>
		<comments>http://codemate.wordpress.com/2010/04/23/whats-the-coolest-development-platform-out-there-right-now-why/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 16:15:13 +0000</pubDate>
		<dc:creator>Danil Glinenko</dc:creator>
				<category><![CDATA[iphonedev]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[objc]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://codemate.wordpress.com/?p=433</guid>
		<description><![CDATA[Today I had to answer this simple question &#8211; what&#8217;s the coolest development platform out there right now? This is how I did this. Well, I think mobile application development is going to be huge. This is where we&#8217;re heading to. If we look back at a few past decades there is a huge growth [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=433&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I had to answer this simple question &#8211; what&#8217;s the coolest development platform out there right now?<br />
This is how I did this.</p>
<blockquote><p>
Well, I think mobile application development is going to be huge. This is where we&#8217;re heading to. If we look back at a few past decades  there is a huge growth in computational power, the devices become more powerful at the same time shrinking in size.<br />
More and more people use smartphones these days and we&#8217;ll see new ways of using them in the future.<br />
If we look at the technology in mobile space today then there are more or less 2-3 platforms: iPhone, Android and Blackberry. iPhone has a big customer base, Android is catching up and supported by Google.<br />
My recent experience with the iPhone development has been positive in terms of technology. It&#8217;s a good platform, the API is clean and consistent, great documentation from Apple and powerful language (Objective-C). Objective-C of course has it&#8217;s own drawbacks but overall it&#8217;s a great language and it&#8217;s kind of sad it&#8217;s not so popular. So, for me it&#8217;s iPhone and mobile application development in general.
</p></blockquote>
<p>What&#8217;s your take on this? Как бы вы ответили на этот вопрос?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codemate.wordpress.com/433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codemate.wordpress.com/433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codemate.wordpress.com/433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codemate.wordpress.com/433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codemate.wordpress.com/433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codemate.wordpress.com/433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codemate.wordpress.com/433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codemate.wordpress.com/433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codemate.wordpress.com/433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codemate.wordpress.com/433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codemate.wordpress.com/433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codemate.wordpress.com/433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codemate.wordpress.com/433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codemate.wordpress.com/433/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=433&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codemate.wordpress.com/2010/04/23/whats-the-coolest-development-platform-out-there-right-now-why/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f927bbed86e344d3d97ed4d5f6a926c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dglinenko</media:title>
		</media:content>
	</item>
		<item>
		<title>Developing augmented reality app for iPhone. Preface.</title>
		<link>http://codemate.wordpress.com/2010/03/02/developing-augmented-reality-app-for-iphone-preface/</link>
		<comments>http://codemate.wordpress.com/2010/03/02/developing-augmented-reality-app-for-iphone-preface/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 01:43:20 +0000</pubDate>
		<dc:creator>Danil Glinenko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[app store]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[appstore]]></category>
		<category><![CDATA[facemosaic]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[iphonedev]]></category>
		<category><![CDATA[layar]]></category>
		<category><![CDATA[wikieye]]></category>
		<category><![CDATA[wikitude]]></category>

		<guid isPermaLink="false">http://codemate.wordpress.com/?p=425</guid>
		<description><![CDATA[Lately I&#8217;ve been doing some iPhone development and found it quite interesting and fascinating. I&#8217;ve learned a lot about Objective-C, Cocoa Touch and the platform itself. It&#8217;s a good experience and I&#8217;m glad I left Java aside for a little bit and took a closer look at how things are done on Mac. I&#8217;ve written [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=425&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been doing some iPhone development and found it quite interesting and fascinating. I&#8217;ve learned a lot about Objective-C, Cocoa Touch and the platform itself. It&#8217;s a good experience and I&#8217;m glad I left Java aside for a little bit and took a closer look at how things are done on Mac.
</p>
<p>I&#8217;ve written two iPhone applications and here I&#8217;m going to be marketing them. :) But it wouldn&#8217;t be fair if I only did that, so in next few posts I&#8217;m going to talk more about implementation, math and the rest. Stay tuned.
</p>
<p><img src="http://codemate.files.wordpress.com/2010/03/iphone_main_600.png?w=600&#038;h=462" alt="WikiEye screenshot" title="WikiEye screenshot" width="600" height="462" class="alignnone size-full wp-image-426" /></p>
<p>
Meanwhile have a look at the applications</p>
<ul>
<li>
<a href="http://wikieye.endelea.ru">WikiEye</a> &#8211; shows Wikipedia articles around you  using augmented reality. (Promo codes: 3PJR7K7LM3NX 6E696TJH4M43 HMFLL6EXJ9FT XAH7PJE464F7 E7FE6J3LFHJJ )
</li>
<li>
<a href="http://facemosaic.endelea.ru">Facemosaic</a> &#8211; uses OpenCV framework for face detection, captures faces of your friends and splits them into different parts randomly. The result is unexpected and rather funny to see. :)
</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codemate.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codemate.wordpress.com/425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codemate.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codemate.wordpress.com/425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codemate.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codemate.wordpress.com/425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codemate.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codemate.wordpress.com/425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codemate.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codemate.wordpress.com/425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codemate.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codemate.wordpress.com/425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codemate.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codemate.wordpress.com/425/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=425&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codemate.wordpress.com/2010/03/02/developing-augmented-reality-app-for-iphone-preface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f927bbed86e344d3d97ed4d5f6a926c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dglinenko</media:title>
		</media:content>

		<media:content url="http://codemate.files.wordpress.com/2010/03/iphone_main_600.png" medium="image">
			<media:title type="html">WikiEye screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>Curious case of Xml</title>
		<link>http://codemate.wordpress.com/2009/12/08/curious-case-of-xml/</link>
		<comments>http://codemate.wordpress.com/2009/12/08/curious-case-of-xml/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 21:00:04 +0000</pubDate>
		<dc:creator>Danil Glinenko</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[brain damage]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[xslt]]></category>

		<guid isPermaLink="false">http://codemate.wordpress.com/?p=386</guid>
		<description><![CDATA[Can you quickly grasp what&#8217;s happening here? Was it easy?<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=386&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Can you quickly grasp what&#8217;s happening here?</p>
<pre class="brush: xml;">
 &lt;mix:for-each select=&quot;$dataInTwoMonths&quot;&gt;
    &lt;mix:variable name=&quot;hour&quot; select=&quot;xfn:format-dateTime(xfn:sql-dateTime-to-xml-dateTime(./date_time), 'HH')&quot;/&gt;
    &lt;mix:variable name=&quot;dayOfWeek&quot; select=&quot;{getDayOfTheWeek(./date_time)}&quot;/&gt;
    &lt;mix:choose&gt;
        &lt;!--if it's Monday - Friday--&gt;
        &lt;mix:when test=&quot;$dayOfWeek &amp;gt;=2 and $dayOfWeek &amp;lt;=6 &quot;&gt;
            &lt;mix:choose&gt;
                &lt;!--if from noon to 7 pm--&gt;
                &lt;mix:when test=&quot;$hour &amp;gt;= 12 and $hour &amp;lt; 19 &quot;&gt;
                    &lt;mix:global-variable name=&quot;afternoon_spendings&quot;
                        select=&quot;$afternoon_spendings + ./spendings_per_hour&quot;/&gt;

                    &lt;mix:variable name=&quot;peak_date&quot;&gt;
                        &lt;mix:call-function name=&quot;isPeakEventDate&quot;&gt;
                            &lt;mix:with-param name=&quot;date&quot;&gt;{./date_time}&lt;/mix:with-param&gt;
                        &lt;/mix:call-function&gt;
                    &lt;/mix:variable&gt;
                    &lt;mix:if test=&quot;$peak_date&quot;&gt;
                        &lt;mix:choose&gt;
                            &lt;mix:when test=&quot;$hour &amp;gt;= 12 and $hour &amp;lt; 15&quot;&gt;
                                &lt;mix:global-variable name=&quot;moderate_peak_event_spendings&quot;
                                    select=&quot;$moderate_peak_event_spendings + ./spendings_per_hour&quot;/&gt;
                            &lt;/mix:when&gt;
                            &lt;mix:when test=&quot;$hour &amp;gt;= 15 and $hour &amp;lt; 18&quot;&gt;
                                &lt;mix:global-variable name=&quot;critical_peak_event_spendings&quot;
                                    select=&quot;$critical_peak_event_spendings + ./spendings_per_hour &quot;/&gt;
                            &lt;/mix:when&gt;
                        &lt;/mix:choose&gt;
                    &lt;/mix:if&gt;
                &lt;/mix:when&gt;
                &lt;!--if 10 am - noon or 7pm - 9pm--&gt;
                &lt;mix:when test=&quot;($hour &amp;gt;= 10 and $hour &amp;lt; 12) or ($hour &amp;gt;= 19 and $hour &amp;lt; 21)&quot;&gt;
                    &lt;mix:global-variable name=&quot;morning_evening_spendings&quot;
                        select=&quot;$morning_evening_spendings + ./spendings_per_hour&quot;/&gt;
                &lt;/mix:when&gt;
                &lt;!--if 9pm - 10 am--&gt;
                &lt;mix:when test=&quot;$hour &amp;gt;= 21 or $hour &amp;lt; 10 &quot;&gt;
                    &lt;mix:global-variable name=&quot;night_spendings&quot;
                        select=&quot;$night_spendings + ./spendings_per_hour&quot;/&gt;
                &lt;/mix:when&gt;
            &lt;/mix:choose&gt;
        &lt;/mix:when&gt;
        &lt;mix:otherwise&gt;
            &lt;!--weekend--&gt;
            &lt;mix:global-variable name=&quot;weekend_spendings&quot; select=&quot;$weekend_spendings + ./spendings_per_hour&quot;/&gt;
        &lt;/mix:otherwise&gt;
    &lt;/mix:choose&gt;
&lt;/mix:for-each&gt;
</pre>
<p>Was it easy?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codemate.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codemate.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codemate.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codemate.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codemate.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codemate.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codemate.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codemate.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codemate.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codemate.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codemate.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codemate.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codemate.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codemate.wordpress.com/386/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=386&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codemate.wordpress.com/2009/12/08/curious-case-of-xml/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f927bbed86e344d3d97ed4d5f6a926c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dglinenko</media:title>
		</media:content>
	</item>
		<item>
		<title>CPU Profiling Explained</title>
		<link>http://codemate.wordpress.com/2009/05/08/cpu-profiling-explained/</link>
		<comments>http://codemate.wordpress.com/2009/05/08/cpu-profiling-explained/#comments</comments>
		<pubDate>Fri, 08 May 2009 07:04:11 +0000</pubDate>
		<dc:creator>Mikhail Naganov</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[bottleneck]]></category>
		<category><![CDATA[call graph]]></category>
		<category><![CDATA[flat view]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[tree view]]></category>

		<guid isPermaLink="false">http://codemate.wordpress.com/?p=325</guid>
		<description><![CDATA[These days I play a lot with CPU profiling tools (i.e., the tools that help to optimize the execution time of a program) and spent some time explaining to myself terminology and approaches to interpretation of profiling results. From a naive point of view, in order to speed up a program it is enough to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=325&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>These days I play a lot with CPU profiling tools (i.e., the tools that help to optimize the execution time of a program) and spent some time explaining to myself terminology and approaches to interpretation of profiling results. From a naive point of view, in order to speed up a program it is enough to glance at a flat list of function execution times, pick the heaviest function and rewrite it. But as we&#8217;ll see this is the most trivial use case of optimization, not always available (e.g. what if a library function appears to be the heaviest?) and actually there are more possibilities for optimization.</p>
<h3>How programs are profiled</h3>
<p>If you ever tried to go beyond recording current time before and after some lengthy process and logging the delta, then you certainly turned your sight toward special tools called <em>profilers.</em> The task of a profiler is to measure resources usage by a program (in our case, to measure CPU time consumption). In an ideal world results are not affected by a method of measurement used, but in reality they do. This is why several measurement approaches exist.</p>
<p>A profiler needs to record what functions were invoked and how many times it took to execute a function. The simplest way of obtaining this data is <em>sampling.</em> When using this method, a profiler interrupts program execution at specified intervals and logs the state of program&#8217;s call stack. The problem with sampling is that even with hardware support it&#8217;s not 100% accurate. Some function calls can fall down through `holes&#8217; of a sampling grid, and will not be seen in a profile. But this usually means that these functions are not worth optimizing—CPU spent very little time executing them. The great benefit of the sampling approach is that it almost doesn&#8217;t affect program execution, so it can be successfully used in production environment.</p>
<p><em>Instrumentation</em> is often considered as a more `precise&#8217; approach to profiling. Doing an instrumentation means inserting a special code that performs calls counting or calculation of execution time into prologs and epilogs of functions. The problem with this approach is that it can seriously skew the results of profiling. Consider a function which takes just a dozen CPU cycles to execute and add another dozen of cycles due to instrumentation—now the instrumented function runs twice as long as the original version! And getting the current time is a system call which means that it will take a lot more CPU cycles to burn. That&#8217;s why some profilers (e.g. GNU gprof) usually instrument code only to record function&#8217;s call count—this is a relatively cheap operation, and measure function execution time using sampling. The other solution is to restrict instrumentation only to a selected subset of program&#8217;s functions.</p>
<h3>Presenting profiling results</h3>
<p><img align="left" src="http://codemate.files.wordpress.com/2009/05/profiling-stack-samples.gif?w=158&#038;h=126" alt="Stack Samples" width="158" height="126" />Raw data collected during a profiling session needs to be presented in some compact and useful way. Recall that during a session call stacks (stack traces) are logged. A call stack is a sequence of function calls: from the currently executed function up to the program&#8217;s entry point.</p>
<p>The most complete and at the same time compact representation for profiling data is a <em>call graph.</em> Each node of a call graph represents a function, and each directed edge between nodes represents a call of one function by another. Both nodes and edges of a call graph have associated weights, according to their CPU usage. <img align="right" title="Call graph" src="http://codemate.files.wordpress.com/2009/05/profiling-call-graph.gif?w=149&#038;h=124" alt="Call graph" width="149" height="124" />The weight of an edge is the number of stack traces where this call can be found. For a node, two weights are concerned: <em>self weight</em> is the number of stack traces where the corresponding function was currently executed, <em>total weight</em> (also known as <em>cumulative weight</em>) is the number of stack traces where the corresponding function can be found. Let&#8217;s assume for now that every program&#8217;s function appears in a stack trace no more than once, it means that we disallow recursive or mutually recursive functions. This is only for simplicity, we&#8217;ll deal with them later.</p>
<p><img align="left" title="Node weights" src="http://codemate.files.wordpress.com/2009/05/profiling-node.gif?w=187&#038;h=184" alt="Node weights" width="187" height="184" />The weights defined are related in the following way:</p>
<ul>
<li>total weight of a node is equal to the sum of weights of its incoming edges;</li>
<li>total weight is equal to the node&#8217;s self weight plus the sum of weights of outgoing edges;</li>
<li>thus, self weight of a node is always less or equal than its total weight, and they are equal for leaf nodes (having no outgoing edges).</li>
</ul>
<p>When producing an output, normalized values of weight values are also used. Node&#8217;s weight can be related either to the total number of samples collected, or to its parent&#8217;s total weight.</p>
<p>To construct a call graph, one needs to process all stack samples gathered. For each function from a sample, a node corresponding to the function need to be found or created, and its total weight increased by one. For the node corresponding to the currently executed function, self weight also needs to be increased. Edges corresponding to calls between functions need to be established as well, and their weights to be increased.</p>
<p>The problem with call graphs is that it is not so easy to visualize them using standard GUI controls, and almost impossible using a text output. That&#8217;s why other representations are often used: a <em>flat view</em> and a <em>tree view</em>. A flat view historically appeared the first and is produced from a call graph by simply discarding all the edges and listing only nodes. For each list item self and total weights (or ratios) are printed. An algorithm for building a flat view is the same as for a call graph, except that relations between functions are not taken into account.</p>
<p>In contrast to a flat view, a tree view retains relations between nodes. Tree&#8217;s top-level node can either correspond to the program&#8217;s entry point—a <em>top down tree,</em> or top-level nodes can correspond to all functions ever being currently executed—this is called a <em>bottom up tree.</em> Usefulness of the latter view is that it starts from functions that were direct CPU consumers, not from their callers. The problem with a bottom up view is that it is counterintuitive: node&#8217;s children are indeed callers of the function and this makes working with self and total weights somewhat tricky.</p>
<p><img align="left" title="Top-down tree" src="http://codemate.files.wordpress.com/2009/05/profiling-top-down-tree.gif?w=168&#038;h=137" alt="Top-down tree" width="168" height="137" />A top down tree can be constructed from a list of gathered call stacks using the following algorithm. A stack sample is viewed as a route from tree&#8217;s root to some leaf. The route starts from program&#8217;s entry point. Along the way, non-existent nodes are created and total weights of nodes passed through are increased by one. When a node corresponding to stack sample&#8217;s last function is reached, its self weight is also increased by one.</p>
<p>One significant difference between a tree and a graph is that in a tree every node has only a single parent node. Thus, when mapping a call graph onto the corresponding top down tree, every node that has multiple incoming edges is being split into several `instances&#8217; with weights split accordingly. That is, the sum of self weights of tree nodes corresponding to the same function must be equal to self weight of a call graph tree node, the same is true for total weight.</p>
<p><img align="left" title="Bottom-up tree" src="http://codemate.files.wordpress.com/2009/05/profiling-bottom-up-tree.gif?w=190&#038;h=128" alt="Bottom-up tree" width="190" height="128" />A bottom up tree is more interesting. It can be constructed from call stacks using the same algorithm as for building a top down tree, but when iterating through a call stack, one must start with the opposite end—the function currently executed. In the resulting bottom up tree call graph&#8217;s nodes are also split among different branches. E.g. the program&#8217;s root function is a leaf node of every bottom up tree branch. An interesting property of a bottom up tree is that a node can appear at the top level of a tree if and only if it has a non-zero self weight, so self weights of all nodes are concentrated in top-level nodes of a bottom up tree, and total weights are distributed among non-top-level nodes, which only can have zero self weight. Thus, it is enough only to have a single weight value for each node. For top-level nodes, this will be the self weight of the corresponding call graph node, and for the rest it will be a piece of the total weight. Similarly to a top down tree, summing up weights of all call graph node&#8217;s instances will give us its total weight.</p>
<h3>Recursive functions</h3>
<p><img align="left" title="Recursive function" src="http://codemate.files.wordpress.com/2009/05/profiling-recursion.gif?w=146&#038;h=48" alt="Recursive function" width="146" height="48" />Here comes the fun part. If you have a recursive function, or a set of mutually recursive functions, trying to calculate nodes&#8217; and edges&#8217; weights for them will result in a paradox, because node&#8217;s incoming edges can in the same time appear as its outgoing edges. This ruins our relations of weights.</p>
<p>To deal with this problem, let&#8217;s recall that recursion is equivalent to iteration. That means, a recursive function can be rewritten using a loop. In this case, calculating its weights isn&#8217;t a problem anymore. Thus, for a recursive function we can contribute the weight of its self-call edge to node&#8217;s self time, and don&#8217;t assign any weight to such edge.</p>
<p>While processing stack samples, it is important to distinguish between time spent in function calls (i.e. the number of stack samples) and the number of function calls themselves. A stack sample can contain multiple occurrences of a recursive function (and thus, multiple self-calls), but this only contributes as a single unit of a call graph node&#8217;s and edge&#8217;s weights. Thus, when constructing a flat view, every function from a stack sample needs to be counted only once. Self weight is always calculated right because in every stack sample there is only one currently executed function.</p>
<p><img align="right" title="Detecting recursion" src="http://codemate.files.wordpress.com/2009/05/profiling-detecting-recursion.gif?w=141&#038;h=150" alt="Detecting recursion" width="141" height="150" />During a tree view construction, the right decision is not to perform cycles detection at all. This preserves a relation between weights of parent and child nodes: the total weight of a parent node equals to a sum of its self weight with the sum of child nodes total weights. But when it is needed to gather up several nodes in order to calculate weights of a corresponding call graph node, total weights of recursive function calls must be ignored. In a tree view, recursive calls are easy to detect: a node with the same label exists in node&#8217;s chain of parents.</p>
<h3>Using profiles to detect bottlenecks</h3>
<p>Armed with the knowledge of how profiling data is collected and visualized, let&#8217;s figure out how to use it for speeding up a program. I can enumerate the following cases that are detectable by profiling paired with source code analyzis:</p>
<ul>
<li>an individual heavy function (e.g. a sorting function);</li>
<li>excessive usage of a library function (e.g. of a memory copying function);</li>
<li>repeatedly appearing sequence of function calls.</li>
</ul>
<p>For finding an individual heavy function, a flat view is enough. Sort it by self weight in decreasing order, and such functions will bubble up to the top. Especially if their total weight is close to self weight (this means they do all the work by themselves), they are good candidates for optimization. This method works well both for recursive and non-recursive functions.</p>
<p>If a hot function can&#8217;t be optimized by itself (e.g. this is a library function), a bottom up view is helpful to look at its callers. Get the caller with the most weight (that is, the one that calls the function most frequently), and look up in the source code why it makes an excessive usage of the function. It often appears, that a result of function&#8217;s call can be cached, or maybe there is a more effective way of doing the same thing that doesn&#8217;t require calling the function at all.</p>
<p>Sorting a flat view by total weight in decreasing order and secondary by self weight can also reveal functions that inadequately cause heavy processing. Consider an example: let&#8217;s say we see a function `top5&#8242; which has big total weight, but small self weight. Now we are looking at its callees in the top down view, and see that `top5&#8242;s time is mostly occupied by a call to `qsort&#8217;. Looking at `top5&#8242; source we see that this call is redundant, because finding top 5 array items can be done using a single linear scan, without a need to sort an array.</p>
<p>A call graph view can actually be used in all of these cases, especially if it can be adjusted to highlight nodes and edges based on their weights. The only problem of a call graph, as I said, is that it can be big, so good scalable approach to viewing it is required.</p>
<p>But a call graph really shines when one wants to find a repeatedly appearing sequence of function calls. As every program&#8217;s function has exactly one corresponding node (unlike a tree view), and edges have weights, it is relatively easy to detect expensive sequences. After finding them and looking through functions&#8217; code it is often seems that data calculated by a function is often used only partially or even thrown away by a caller (this happens when programs are built from big reusable `universal&#8217; functions). Crafting a specialized version of a function that doesn&#8217;t perform unneeded calculations can speed up a program dramatically.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codemate.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codemate.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codemate.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codemate.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codemate.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codemate.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codemate.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codemate.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codemate.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codemate.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codemate.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codemate.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codemate.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codemate.wordpress.com/325/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=325&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codemate.wordpress.com/2009/05/08/cpu-profiling-explained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c8f6a36ad787da54bb9e99195e1fab8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mikhail</media:title>
		</media:content>

		<media:content url="http://codemate.files.wordpress.com/2009/05/profiling-stack-samples.gif" medium="image">
			<media:title type="html">Stack Samples</media:title>
		</media:content>

		<media:content url="http://codemate.files.wordpress.com/2009/05/profiling-call-graph.gif" medium="image">
			<media:title type="html">Call graph</media:title>
		</media:content>

		<media:content url="http://codemate.files.wordpress.com/2009/05/profiling-node.gif" medium="image">
			<media:title type="html">Node weights</media:title>
		</media:content>

		<media:content url="http://codemate.files.wordpress.com/2009/05/profiling-top-down-tree.gif" medium="image">
			<media:title type="html">Top-down tree</media:title>
		</media:content>

		<media:content url="http://codemate.files.wordpress.com/2009/05/profiling-bottom-up-tree.gif" medium="image">
			<media:title type="html">Bottom-up tree</media:title>
		</media:content>

		<media:content url="http://codemate.files.wordpress.com/2009/05/profiling-recursion.gif" medium="image">
			<media:title type="html">Recursive function</media:title>
		</media:content>

		<media:content url="http://codemate.files.wordpress.com/2009/05/profiling-detecting-recursion.gif" medium="image">
			<media:title type="html">Detecting recursion</media:title>
		</media:content>
	</item>
		<item>
		<title>Image manipulation in Java</title>
		<link>http://codemate.wordpress.com/2009/05/07/image-manipulation-in-java/</link>
		<comments>http://codemate.wordpress.com/2009/05/07/image-manipulation-in-java/#comments</comments>
		<pubDate>Thu, 07 May 2009 19:26:18 +0000</pubDate>
		<dc:creator>Danil Glinenko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[2d]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[resize image]]></category>
		<category><![CDATA[rotate image]]></category>
		<category><![CDATA[watermark image]]></category>

		<guid isPermaLink="false">http://codemate.wordpress.com/?p=337</guid>
		<description><![CDATA[Created a small and simple utility class for myself to be able to perform common operations on images in Java.
Using this class you can load and save images, you're able to resize images maintaining aspect ratio, you're able to save jpeg images with specified compression, you can rotate images to any given angle, you can also watermark images.
Hope it'll save you some time.
<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=337&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Created a small and simple utility class for myself to be able to perform common operations on images in Java.<br />
Using this class you can load and save images, you&#8217;re able to resize images maintaining aspect ratio, you&#8217;re able to save jpeg images with specified compression, you can rotate images to any given angle, you can also watermark them.<br />
Hope it&#8217;ll save you some time.<br />
<span id="more-337"></span></p>
<pre class="brush: java;">
/**
 * @(#) ImageUtils.java;
 * &lt;p/&gt;
 * Created on Apr 29, 2009
 * AUTHOR    ** Danil Glinenko
 * &lt;p/&gt;
 */

package net.codemate.api.image;

import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.stream.FileImageOutputStream;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public final class ImageUtils {
    public static final float BEST_QUALITY = 1.0f;
    public static final float HIGH_QUALITY = 0.75f;
    public static final float MEDIUM_QUALITY = 0.5f;
    public static final float LOW_QUALITY = 0.25f;
    public static final float LEAST_QUALITY = 0.0f;

    private ImageUtils() {
    }

    /**
     * Loads image from file system to BufferedImage object.
     * @param imageFile Image file to be loaded.
     * @return BufferedImage object.
     * @throws IOException if file is not found or the image can't be loaded.
     */
    public static BufferedImage loadImage(final File imageFile) throws IOException {
        return ImageIO.read(imageFile);
    }

    /**
     * Loads image from file system to BufferedImage object.
     * @param imageFilePath file path to the image to be loaded.
     * @return BufferedImage object.
     * @throws IOException if file is not found or the image can't be loaded.
     */
    public static BufferedImage loadImage(final String imageFilePath) throws IOException {
        return loadImage(new File(imageFilePath));
    }

    /**
     * Saves given BufferedImage to a file. Supports &quot;png&quot; and &quot;jpg&quot; formats. The format is identified based on
     * the given file name for the picture. The default is &quot;jpg&quot;.
     * @param image Image to be saved to file.
     * @param imageFile file the images will be saved in to.
     * @throws IOException if the image can't be saved or file is not found.
     */
    public static void saveImage(final BufferedImage image, final File imageFile) throws IOException {
        if (image == null || imageFile== null){throw new IllegalArgumentException(&quot;\&quot;image\&quot; or \&quot;imageFile\&quot; params cannot be null.&quot;);}
        final String format = (imageFile.getName().endsWith(&quot;png&quot;))? &quot;png&quot;: &quot;jpg&quot;;
        ImageIO.write(image, format, imageFile);
    }

    /**
     * Saves given BufferedImage to a file. Supports &quot;png&quot; and &quot;jpg&quot; formats. The format is identified based on
     * the given file name for the picture. The default is &quot;jpg&quot;.
     * @param image Image to be saved to file.
     * @param imageFilePath file path the images will be saved in to.
     * @throws IOException if the image can't be saved or file is not found.
     */
    public static void saveImage(final BufferedImage image, final String imageFilePath) throws IOException {
        saveImage(image, new File(imageFilePath));
    }

    /**
     * Save JPEG image with the compression specified.
     * @param image Image to be saved to file.
     * @param imageFile file to save image.
     * @param quality must be in 0..1 range. 0.0 - highest compression is important, 1.0 - high image quality is important.
     * @throws IOException if the image can't be saved or file is not found.
     */
    public static void saveImageJPGCompressed(final BufferedImage image, final File imageFile, final float quality) throws IOException {
        if (image == null || imageFile == null){throw new IllegalArgumentException(&quot;\&quot;image\&quot; or \&quot;imageFile\&quot; params cannot be null.&quot;);}
        if (quality &lt; 0 || quality &gt;1){throw new IllegalArgumentException(&quot;Quality parameter must be in from 0 to 1 range.&quot;);}
        Iterator writers = ImageIO.getImageWritersBySuffix(&quot;jpeg&quot;);
        if (!writers.hasNext()) {
            throw new IllegalStateException(&quot;No writers found.&quot;);
        }
        // get the writer
        ImageWriter writer = (ImageWriter) writers.next();
        ImageWriteParam wParams = writer.getDefaultWriteParam();
        wParams.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
        wParams.setCompressionQuality(quality);

        //writing image
        FileImageOutputStream output = new FileImageOutputStream(imageFile);
        writer.setOutput(output);
        writer.write(null, new IIOImage(image, null, null), wParams);
        writer.dispose();
    }

    /**
     * Rotates given image to given angle.
     * @param image image to be rotated.
     * @param angle angle to rotate image to
     * @return rotated image.
     */
    public static BufferedImage rotate(final BufferedImage image, final int angle) {
        if (image == null){throw new IllegalArgumentException(&quot;\&quot;image\&quot; param cannot be null.&quot;);}
        final int imageWidth = image.getWidth();
        final int imageHeight = image.getHeight();
        final Map&lt;String, Integer&gt; boundingBoxDimensions = calculateRotatedDimensions(imageWidth, imageHeight, angle);

        final int newWidth = boundingBoxDimensions.get(&quot;width&quot;);
        final int newHeight = boundingBoxDimensions.get(&quot;height&quot;);

        final BufferedImage newImage = new BufferedImage(newWidth, newHeight, image.getType());
        final Graphics2D newImageGraphic = newImage.createGraphics();

        final AffineTransform transform = new AffineTransform();
        transform.setToTranslation((newWidth-imageWidth)/2, (newHeight-imageHeight)/2);
        transform.rotate(Math.toRadians(angle), imageWidth/2, imageHeight/2);
        newImageGraphic.drawImage(image, transform, null);
        newImageGraphic.dispose();

        return newImage;
    }

    private static Map&lt;String, Integer&gt; calculateRotatedDimensions(final int imageWidth, final int imageHeight, final int angle) {
        final Map&lt;String, Integer&gt; dimensions = new HashMap&lt;String, Integer&gt;();
        // coordinates of our given image
        final int[][] points = {
                {0, 0},
                {imageWidth, 0},
                {0, imageHeight},
                {imageWidth, imageHeight}
        };

        final Map&lt;String, Integer&gt; boundBox = new HashMap&lt;String, Integer&gt;(){{
            put(&quot;left&quot;, 0);
            put(&quot;right&quot;, 0);
            put(&quot;top&quot;, 0);
            put(&quot;bottom&quot;, 0);
        }};

        final double theta = Math.toRadians(angle);

        for (final int[] point : points) {
            final int x = point[0];
            final int y = point[1];
            final int newX = (int) (x * Math.cos(theta) + y * Math.sin(theta));
            final int newY = (int) (x * Math.sin(theta) + y * Math.cos(theta));

            //assign the bounds
            boundBox.put(&quot;left&quot;, Math.min(boundBox.get(&quot;left&quot;), newX));
            boundBox.put(&quot;right&quot;, Math.max(boundBox.get(&quot;right&quot;), newX));
            boundBox.put(&quot;top&quot;, Math.min(boundBox.get(&quot;top&quot;), newY));
            boundBox.put(&quot;bottom&quot;, Math.max(boundBox.get(&quot;bottom&quot;), newY));
        }

        // now get the dimensions of the new box.
        dimensions.put(&quot;width&quot;, Math.abs(boundBox.get(&quot;right&quot;) - boundBox.get(&quot;left&quot;)));
        dimensions.put(&quot;height&quot;, Math.abs(boundBox.get(&quot;bottom&quot;) - boundBox.get(&quot;top&quot;)));
        return dimensions;
    }

    /**
     * Resizes given image to the given dimensions.
     * @param image original image to resize.
     * @param newWidth new width of the image.
     * @param newHeight new height of the image.
     * @param maintainAspectRatio if true the aspect ratio will be maintained.
     * @return resized image.
     */
    public static BufferedImage resize(final BufferedImage image, int newWidth, int newHeight, final boolean maintainAspectRatio) {
        if (image == null){throw new IllegalArgumentException(&quot;\&quot;image\&quot; param cannot be null.&quot;);}
        final int imageWidth = image.getWidth();
        final int imageHeight = image.getHeight();
        // if we want to maintain aspect ratio.
        if (maintainAspectRatio) {
            final double newRatio = (double) newWidth / (double) newHeight;
            final double imageRatio = (double) imageWidth / (double) imageHeight;
            if (newRatio &lt; imageRatio) {
                newHeight = (int)(newWidth / imageRatio);
            } else {
                newWidth = (int)(newHeight * imageRatio);
            }
        }

        final BufferedImage dimg = new BufferedImage(newWidth, newHeight, image.getType());
        final Graphics2D g = dimg.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
        g.drawImage(image, 0, 0, newWidth, newHeight, 0, 0, imageWidth, imageHeight, null);
        g.dispose();
        return dimg;
    }

    /**
     * Watermarks the given image with given text.
     * @param image Image to be watermarked
     * @param text text to be used as a watermark.
     * @return new watermarked image.
     */
    public static BufferedImage waterMarkImage(final BufferedImage image, final String text) {
        if (image == null){throw new IllegalArgumentException(&quot;\&quot;image\&quot; param cannot be null.&quot;);}
        // create a new image
        final BufferedImage waterMarked = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
        final Graphics2D imageG = waterMarked.createGraphics();
        // draw original image.
        imageG.drawImage(image, null, 0, 0);
        imageG.dispose();

        final Graphics2D g  = waterMarked.createGraphics();
        g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); // 50% transparency
        g.setColor(Color.white);
        g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        g.setFont(new Font(&quot;Arial&quot;, Font.BOLD, 30));
        final FontMetrics fontMetrics = g.getFontMetrics();
        final Rectangle2D rect = fontMetrics.getStringBounds(text, g);
        final int centerX = (image.getWidth() - (int) rect.getWidth()) /2;
        final int centerY = (image.getHeight() - (int) rect.getHeight()) /2;
        g.drawString(text, centerX, centerY);
        g.dispose();
        return waterMarked;
    }
}
</pre>
<p>Some useful links used:<br />
<a href="http://www.javalobby.org/articles/ultimate-image/">Java lobby article</a><br />
<a href="http://stackoverflow.com/questions/622140/calculate-bounding-box-coordinates-from-a-rotated-rectangle-picture-inside">How to calculate bounding box coordinates</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codemate.wordpress.com/337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codemate.wordpress.com/337/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codemate.wordpress.com/337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codemate.wordpress.com/337/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codemate.wordpress.com/337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codemate.wordpress.com/337/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codemate.wordpress.com/337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codemate.wordpress.com/337/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codemate.wordpress.com/337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codemate.wordpress.com/337/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codemate.wordpress.com/337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codemate.wordpress.com/337/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codemate.wordpress.com/337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codemate.wordpress.com/337/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=337&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codemate.wordpress.com/2009/05/07/image-manipulation-in-java/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f927bbed86e344d3d97ed4d5f6a926c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dglinenko</media:title>
		</media:content>
	</item>
		<item>
		<title>On the Edge—Trying Chromium on Mac</title>
		<link>http://codemate.wordpress.com/2009/03/29/on-the-edge%e2%80%94trying-chromium-on-mac/</link>
		<comments>http://codemate.wordpress.com/2009/03/29/on-the-edge%e2%80%94trying-chromium-on-mac/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 12:32:17 +0000</pubDate>
		<dc:creator>Mikhail Naganov</dc:creator>
				<category><![CDATA[Build]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[chromium]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://codemate.wordpress.com/?p=298</guid>
		<description><![CDATA[Immediately after Google Chrome announce, it was known that it will be on Linux and Mac. Some day&#8230; And this day is coming. Right now it is possible to compile Chromium on Mac and it will be a working browser! Well, almost. I&#8217;m trying to use it and it works—this post is composed using Mac [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=298&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img title="About Chromium" src="http://codemate.files.wordpress.com/2009/03/about-chromium.png?w=83&#038;h=100" alt="about-chromium" hspace="10px" vspace="5px" width="83" height="100" align="left" />Immediately after Google Chrome announce, it was known that it will be on Linux and Mac. Some day&#8230; And this day is coming. Right now it is possible to compile Chromium on Mac and it will be a working browser!</p>
<p>Well, almost. I&#8217;m trying to use it and it works—this post is composed using Mac Chromium. But it&#8217;s definitely far from being a polished consumer product yet. Major problems that I found so far: the Omnibox (navigation edit box) only accepts URLs; downloads doesn&#8217;t work, and tabs crash from time to time. Though the last isn&#8217;t a big problem because Chromium is a multi-process browser, so a tab crash doesn&#8217;t affect other tabs. That&#8217;s pretty cool comparing to Safari 4 Beta.</p>
<p style="text-align:center;"><img class="size-full wp-image-303 aligncenter" title="Chromium" src="http://codemate.files.wordpress.com/2009/03/chromium.png?w=323&#038;h=229" alt="Chromium" width="323" height="229" /></p>
<p>What is really exciting is that Mac Chromium will become better and better every day. And any developer can help by contributing to a project.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codemate.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codemate.wordpress.com/298/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codemate.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codemate.wordpress.com/298/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codemate.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codemate.wordpress.com/298/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codemate.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codemate.wordpress.com/298/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codemate.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codemate.wordpress.com/298/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codemate.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codemate.wordpress.com/298/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codemate.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codemate.wordpress.com/298/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=298&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codemate.wordpress.com/2009/03/29/on-the-edge%e2%80%94trying-chromium-on-mac/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c8f6a36ad787da54bb9e99195e1fab8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mikhail</media:title>
		</media:content>

		<media:content url="http://codemate.files.wordpress.com/2009/03/about-chromium.png" medium="image">
			<media:title type="html">About Chromium</media:title>
		</media:content>

		<media:content url="http://codemate.files.wordpress.com/2009/03/chromium.png" medium="image">
			<media:title type="html">Chromium</media:title>
		</media:content>
	</item>
		<item>
		<title>Moving Editor Configuration into the Cloud</title>
		<link>http://codemate.wordpress.com/2009/03/20/moving-editor-configuration-into-the-cloud/</link>
		<comments>http://codemate.wordpress.com/2009/03/20/moving-editor-configuration-into-the-cloud/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 19:13:40 +0000</pubDate>
		<dc:creator>Mikhail Naganov</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>

		<guid isPermaLink="false">http://codemate.wordpress.com/?p=295</guid>
		<description><![CDATA[I know, I know—everybody does it in our days. But the results are so sweet that I can&#8217;t resist a temptation to make a post myself. So, if your editor configuration is already uploaded to some hosting, and is version-controlled, please go away, you won&#8217;t learn anything new here. If not, go on reading—it should [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=295&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I know, I know—everybody does it in our days. But the results are so sweet that I can&#8217;t resist a temptation to make a post myself. So, if your editor configuration is already uploaded to some hosting, and is version-controlled, please go away, you won&#8217;t learn anything new here. If not, go on reading—it should be this way.</p>
<p>My migration was driven by circumstances. Currently I simultaneously develop for 3 platforms—this means 3 developer hosts, and of course I want to have the same editor configuration under all of them. Previously I copied my .emacs file all around, and soon it became annoying. Especially if you&#8217;re subscribed to tips&amp;tricks feeds and always experiment with new packages.</p>
<p>So the decision was made to move all the configuration under publicly hosted version control in order to be able to retrieve it wherever I may roam. Now the details: which version control and what hosting. As I can&#8217;t live without git, I chosen it. This made github a quite natural choice for hosting.</p>
<p>Moving all the setup to a repository and integrating current setups from different machines was the next task at hand. I decided to be as conservative as possible and move on in baby steps. Step one was to move current config file into a repository and load it from the &#8220;main&#8221; .emacs file—done, works. Great, move to the next step—introduce variables in order to obtain some flexibility—done, works. And so on. Pretty soon I gathered all the packages in the repository and uploaded it into github. The next step—clone it on the second machine, integrate changes and push them back. Then sync the repository on the first machine and test that it still works. After some iterations, all the stuff was in place.</p>
<p>After several days of using the new setup, I discovered another advantage of having editor configuration under a version control. Now I can experiment freely with new stuff and have no more commented out blobs of configuration code. If a package or macro doesn&#8217;t work, but looks promising and I don&#8217;t have time to deal with it now—just move it into a separate branch! Also if some setting feels like not so useful as it seemed initially—just revert it with a single command. Boy, now I&#8217;m <em>agile!</em> ;)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codemate.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codemate.wordpress.com/295/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codemate.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codemate.wordpress.com/295/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codemate.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codemate.wordpress.com/295/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codemate.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codemate.wordpress.com/295/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codemate.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codemate.wordpress.com/295/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codemate.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codemate.wordpress.com/295/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codemate.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codemate.wordpress.com/295/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=295&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codemate.wordpress.com/2009/03/20/moving-editor-configuration-into-the-cloud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c8f6a36ad787da54bb9e99195e1fab8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mikhail</media:title>
		</media:content>
	</item>
		<item>
		<title>Writing a SQL parser</title>
		<link>http://codemate.wordpress.com/2009/02/06/writing-a-sql-parser/</link>
		<comments>http://codemate.wordpress.com/2009/02/06/writing-a-sql-parser/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 20:49:34 +0000</pubDate>
		<dc:creator>Danil Glinenko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[antlr]]></category>
		<category><![CDATA[grammar]]></category>
		<category><![CDATA[javacc]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://codemate.wordpress.com/?p=277</guid>
		<description><![CDATA[Well&#8230; not exactly writing a parser but generating one. For the task I&#8217;ve been working on recently I needed to have (inside my java code) a data model representing database tables, so I could perform data normalization according to it. &#8220;CREATE TABLE&#8221; sql statement is a natural fit for representing the data model. The only [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=277&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well&#8230; not exactly writing a parser but generating one.<br />
For the task I&#8217;ve been working on recently I needed to have (inside my java code) a data model representing database tables, so I could perform data normalization according to it.</p>
<p><em>&#8220;CREATE TABLE&#8221;</em> sql statement is a natural fit for representing the data model. The only thing I had to decide on is parser. How do I parse SQL? Can I use something off-the-shelf? I asked myself and it turns out yes I can!<br />
I took a look at <a href="https://javacc.dev.java.net/">Javacc</a> and then at <a href="http://www.antlr.org/">Antlr</a>. Antlr seemed more, I would say, mature, more documentation, tutorials, sample grammars, etc. </p>
<p>Antlr (ANother Tool for Language Recognition) </p>
<blockquote><p>
is a language tool that provides a framework for constructing recognizers, compilers, and translators from grammatical descriptions containing actions in a variety of target languages.
</p></blockquote>
<p>BTW, the data I was going to parse looked like this:</p>
<pre class="brush: sql;">
CREATE TABLE table_one (
    customer_number integer NOT NULL,
    address character varying(30)
);

CREATE TABLE table_two (
    id integer NOT NULL,
    city character varying(50)
);
</pre>
<p>I wrote following grammar for it:</p>
<pre class="brush: java;">
grammar CreateTable;

/*------------------------------------------------------------------
 * PARSER RULES
 *------------------------------------------------------------------*/

table_list :
    (table_def)*;

table_def :
    'create' 'table' table_name table_element_list SEMICOLON;

table_name :
    (schema DOT)? table;

table_element_list :
    LEFT_PAREN table_element (COMMA table_element)* RIGHT_PAREN;

table_element :
    column_name data_type_def (column_constraint)?;

data_type_def :
    data_type lenght_constraint?;

schema : ID;

table : ID;

column_name :ID;

data_type : ID:

length_constraint :
    LEFT_PAREN NUMBER RIGHT_PAREN;

/*------------------------------------------------------------------
 * LEXER RULES
 *------------------------------------------------------------------*/

LEFT_PAREN : '(';
RIGHT_PAREN : ')';
COMMA : ',';
SEMICOLON : ';';
DOT	:	 '.';
NUMBER 	:	(DIGIT)+;
ID  : (('a'..'z'|'A'..'Z' | '_') ((DIGIT)*))+ ;
NEWLINE:'\r'? '\n' ;
WS : ( '\t' | ' ' | '\r' | '\n' | '\u000C' )+ 	{ $channel = HIDDEN; } ;
fragment DIGIT :   '0'..'9' ;
</pre>
<p>This is all fine but I want my parser to return data right away like:</p>
<pre class="brush: java;">
List&lt;Table&gt; tables = parser.table_list();
List&lt;Column&gt; cols = table.getColumns();
Column col = table.getColumn(&quot;id&quot;);
col.getName();
col.getType();
col.getConstriant();
col.getLength();
</pre>
<p>So we have to made a few changes to our parser rules in the grammar.</p>
<pre class="brush: java;">
grammar CreateTable;

@header {
import java.util.ArrayList;
import java.util.List;

}

table_list returns [List tables]
	: {$tables = new ArrayList();}	(table_def { $tables.add($table_def.tbl); } )*  ;

table_def returns [Table tbl]
	: 'create' 'table' table_name
		table_element_list {
			$tbl = new Table(String.valueOf($table_name.text), $table_element_list.cols);
		}
		SEMICOLON ;

table_name
	:	(schema DOT)? table  ;

table_element_list returns [List cols]
	: {$cols = new ArrayList();} LEFT_PAREN te=table_element {$cols.add($te.col);} (COMMA te=table_element {$cols.add($te.col);})*   RIGHT_PAREN ;

table_element returns [Column col]
	:  column_name data_type_def (column_constraint)? {$col = new Column($column_name.cn, $data_type_def.tpe, $column_constraint.text, $data_type_def.len);};

column_name returns [String cn]
	:	ID {$cn = String.valueOf($ID.text); };

column_constraint
	:	'not' 'null';

data_type_def returns [String tpe, Integer len]
	: data_type {$tpe = $data_type.tp;} length_constraint? {$len = $length_constraint.len;}
	;

data_type returns [String tp]
	:
	((('character' 'varying')  | 'varchar') {$tp = &quot;varchar&quot;;}
		| ('bit' 'varying' | 'varbit') {$tp = &quot;varbit&quot;;}
		| ('double' 'precision' | 'float8') {$tp = &quot;float8&quot;; }
		| ('character' | 'char') {$tp = &quot;char&quot;;}
		| ('integer' | 'int' | 'int4') {$tp = &quot;integer&quot;;}
		| ID {$tp = $ID.text;}
		);

length_constraint returns [Integer len]
	: LEFT_PAREN NUMBER RIGHT_PAREN {$len = Integer.valueOf($NUMBER.text);} 	;

schema : ID;
table :	ID;

/*------------------------------------------------------------------
 * LEXER RULES
 *------------------------------------------------------------------*/

LEFT_PAREN : '(';
RIGHT_PAREN : ')';
COMMA : ',';
SEMICOLON : ';';
DOT	:	 '.';
NUMBER 	:	(DIGIT)+;
ID  : (('a'..'z'|'A'..'Z' | '_') ((DIGIT)*))+ ;
NEWLINE:'\r'? '\n' ;
WS : ( '\t' | ' ' | '\r' | '\n' | '\u000C' )+ 	{ $channel = HIDDEN; } ;
fragment DIGIT :   '0'..'9' ;
</pre>
<p>That&#8217;s basically it. I have a parser that I wanted and I think it took me less than I would have spent writing my own.<br />
There are many <a href="http://www.antlr.org/grammar/list">sample grammars</a>. Have a look maybe there is existing one for the language you&#8217;re about to parse. :) </p>
<p>P.S. The exact &#8220;CREATE TABLE&#8221; SQL statement is slightly more complex that I assume in the grammar.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codemate.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codemate.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codemate.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codemate.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codemate.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codemate.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codemate.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codemate.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codemate.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codemate.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codemate.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codemate.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codemate.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codemate.wordpress.com/277/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=277&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codemate.wordpress.com/2009/02/06/writing-a-sql-parser/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f927bbed86e344d3d97ed4d5f6a926c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dglinenko</media:title>
		</media:content>
	</item>
		<item>
		<title>Emacs tip: bulk operations on buffers</title>
		<link>http://codemate.wordpress.com/2009/01/16/emacs-tip-bulk-operations-on-buffers/</link>
		<comments>http://codemate.wordpress.com/2009/01/16/emacs-tip-bulk-operations-on-buffers/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 09:59:00 +0000</pubDate>
		<dc:creator>Mikhail Naganov</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[buffers]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://codemate.wordpress.com/?p=268</guid>
		<description><![CDATA[When I use Emacs for my work, I usually have dozens of buffers open: every file I edited, plus different consoles, process outputs etc. Emacs allows to handle this volume easily because it doesn&#8217;t have stupid tabs which I need to scroll and click, but instead every buffer is accessible by entering a couple of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=268&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img title="Emacs" src="http://www.gnu.org/software/emacs/tour/images/splash-small.png" alt="" hspace="10" vspace="5" width="86" height="70" align="left" />When I use Emacs for my work, I usually have dozens of buffers open: every file I edited, plus different consoles, process outputs etc. Emacs allows to handle this volume easily because it doesn&#8217;t have stupid tabs which I need to scroll and click, but instead every buffer is accessible by entering a couple of chars from its name.</p>
<p>The main problem I encountered is that when I&#8217;m working simultaneously on several versions of the same project, I&#8217;m starting to have many similarly named buffers. I already <a title="How to tune uniquify" href="http://trey-jackson.blogspot.com/2008/01/emacs-tip-11-uniquify.html" target="_blank">set up uniquify plugin</a> to have file names prepended with directory names, but the risk of changing a file from other version of project is still high.</p>
<p>The obvious solution to get rid of unneeded buffers is to close Emacs and open again, but for Emacs this is analogous to OS reboot—ideally, you don&#8217;t need this. The better solution is to close all files that were opened from a specific directory. What is the easiest way to do this? As I&#8217;ve learned from <a title="Killing buffers" href="http://www.emacswiki.org/emacs/KillingBuffers" target="_blank">Emacs wiki</a>, the <a title="Ibuffer" href="http://www.emacswiki.org/emacs/IbufferMode" target="_blank">Ibuffer</a> plugin offers a great interface for such operations.</p>
<p>So, how I delete all buffers that has files opened from a particular location? First, I&#8217;m opening Ibuffer:</p>
<pre>M-x ibuffer-list-buffers</pre>
<p>A fancy colored table of buffers is shown. Now I&#8217;m marking buffers having a filename to satisfy a specified regular expression criteria: <strong>% f</strong> and then pressing <strong>D</strong> to delete them. That&#8217;s all!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codemate.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codemate.wordpress.com/268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codemate.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codemate.wordpress.com/268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codemate.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codemate.wordpress.com/268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codemate.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codemate.wordpress.com/268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codemate.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codemate.wordpress.com/268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codemate.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codemate.wordpress.com/268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codemate.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codemate.wordpress.com/268/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=268&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codemate.wordpress.com/2009/01/16/emacs-tip-bulk-operations-on-buffers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c8f6a36ad787da54bb9e99195e1fab8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mikhail</media:title>
		</media:content>

		<media:content url="http://www.gnu.org/software/emacs/tour/images/splash-small.png" medium="image">
			<media:title type="html">Emacs</media:title>
		</media:content>
	</item>
		<item>
		<title>dbext.vim cheat sheet</title>
		<link>http://codemate.wordpress.com/2008/12/11/dbextvim-cheat-sheet/</link>
		<comments>http://codemate.wordpress.com/2008/12/11/dbextvim-cheat-sheet/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 04:26:53 +0000</pubDate>
		<dc:creator>Danil Glinenko</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[cheat]]></category>
		<category><![CDATA[cheat sheet]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[dbext]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[sheet]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://codemate.wordpress.com/?p=249</guid>
		<description><![CDATA[I&#8217;ve created a cheat sheet for dbext Vim plugin. Hope somebody may find it useful. About dbext: While editing your SQL (and without leaving Vim) you can execute database commands, run queries, display results, and view database objects. dbext understands various programming languages, and can parse and prompt the user for [host] variables and execute [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=249&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created a cheat sheet for <a href="http://www.vim.org/scripts/script.php?script_id=356">dbext</a> Vim plugin. Hope somebody may find it useful.<br />
About dbext:</p>
<blockquote><p>While editing your SQL (and without leaving Vim) you can execute database commands, run queries, display results, and view database objects.  dbext understands various programming languages, and can parse and prompt the user for [host] variables and execute the resulting statement.  See below for more details.</p></blockquote>
<p><a href="http://codemate.files.wordpress.com/2008/12/dbextvim-cheat-sheet.pdf"><img src="http://codemate.files.wordpress.com/2008/12/dbext-screenshot3.png?w=500&#038;h=379" alt="dbext-screenshot3" title="dbext-screenshot3" width="500" height="379" class="aligncenter size-full wp-image-260" /></a><br />
<a href="http://codemate.files.wordpress.com/2008/12/dbextvim-cheat-sheet.pdf">Download.</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codemate.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codemate.wordpress.com/249/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codemate.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codemate.wordpress.com/249/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codemate.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codemate.wordpress.com/249/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codemate.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codemate.wordpress.com/249/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codemate.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codemate.wordpress.com/249/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codemate.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codemate.wordpress.com/249/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codemate.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codemate.wordpress.com/249/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codemate.wordpress.com&amp;blog=477305&amp;post=249&amp;subd=codemate&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codemate.wordpress.com/2008/12/11/dbextvim-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f927bbed86e344d3d97ed4d5f6a926c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dglinenko</media:title>
		</media:content>

		<media:content url="http://codemate.files.wordpress.com/2008/12/dbext-screenshot3.png" medium="image">
			<media:title type="html">dbext-screenshot3</media:title>
		</media:content>
	</item>
	</channel>
</rss>
