<?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/"
	>

<channel>
	<title>Dömötör Gyimesi&#039;s Blog</title>
	<atom:link href="http://domotorgyimesi.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://domotorgyimesi.net/blog</link>
	<description>Enjoying the renaissance of the web</description>
	<lastBuildDate>Thu, 26 Apr 2012 22:20:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>End bad language in your SVN repository</title>
		<link>http://domotorgyimesi.net/blog/2012/04/26/end-bad-language-in-your-repository/</link>
		<comments>http://domotorgyimesi.net/blog/2012/04/26/end-bad-language-in-your-repository/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 21:43:20 +0000</pubDate>
		<dc:creator>dgyimesi</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[bad language]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[logging anti-patterns]]></category>
		<category><![CDATA[pre-commit hook]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://domotorgyimesi.net/blog/?p=239</guid>
		<description><![CDATA[It&#8217;s funny to see your fellow developers&#8217; favourite debug messages commited into the main branch of service.
A short sample of typical unwanted words can be: &#8220;this block of code suck balls&#8221;, &#8220;dick&#8221;, &#8220;p-p-pussy&#8221;, &#8220;alert&#8221;, &#8220;system.out.println&#8221;, &#8230;
Oops. :]
Even that use of syso or alert is a typical anti-pattern to print messages, most coders use them quite [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s funny to see your fellow developers&#8217; favourite debug messages commited into the main branch of service.<br />
A short sample of typical unwanted words can be: &#8220;this block of code suck balls&#8221;, &#8220;dick&#8221;, &#8220;p-p-pussy&#8221;, &#8220;alert&#8221;, &#8220;system.out.println&#8221;, &#8230;</p>
<p>Oops. :]</p>
<p>Even that use of syso or alert is a typical anti-pattern to print messages, most coders use them quite frequently. For example, alerts are likely to be used to pause execution of JavaScript code, <i>for debugging</i>.</p>
<p>Let&#8217;s see the most common types of forgotten debug messages:</p>
<ul>
<li><i>System.out.println()s:</i> consider your server side code where every dev guy should maintain logs and any kind of messages in a similar fashion (levels, formatting, etc.), then somebody just do a &#8220;syso&#8221; (and you can&#8217;t answer the question why). Then he/she lefts it in and do a <i>svn ci</i>. Nothing bad happens, just some random laughter upon reading logs. Problem here is that the message runs out of context: there is no level, timestamp, nor classname. And hey! It&#8217;s just anything but consistent!
  </li>
<li><i>console.log()s:</i> getting closer to the fire right? These messages more likely get sneaked into field of vision if the user knows about Firebug, or Chrome&#8217;s dev console. Ehm, embarrassing. No log should be displayed in browsers because they slow down rendering DOM / processing data and they&#8217;re totally useless for users. Of course if you run your webapp in a develpoment environtment logs are king to trace where JS exceptions thrown!
  </li>
<li><i>alert()s:</i> no need to get into details here, right? They&#8217;re not even the most ugly and archaic solutions for popup messages and dialogs (which are also should be avoided wherever possible) but blocks the UI and networking totally!
</ul>
<p>So, we should preclude these situations even before they bubble up into the recent build of the system.<br />
If you use SVN, here is an elegant and quick way to prevent codes having a subset of words being commited into your repo.</p>
<pre class="brush: python;">
#!/usr/bin/python

import sys, os, string

SVNLOOK = '/usr/bin/svnlook'
MIN_LENGTH = 8

UNWANTED_WORDS = ['faszom', 'wasd', 'System.out.println', 'alert']

def main(repos, txn):
    log_cmd = '%s log -t &quot;%s&quot; &quot;%s&quot;' % (SVNLOOK, txn, repos)
    log_msg = os.popen(log_cmd, 'r').readline().rstrip('\n')

    diff_cmd = '%s diff -t &quot;%s&quot; &quot;%s&quot; | grep ^+' % (SVNLOOK, txn, repos)
    diff_msg = os.popen(diff_cmd, 'r').read()

    if len(log_msg) &lt; MIN_LENGTH:
        sys.stderr.write (&quot;Please enter a commit message which details what has changed during this commit with length more than &quot; + str(MIN_LENGTH) + &quot; characters.\n&quot;)
        sys.exit(1)

    match_of_unwanted_words = [diff_msg.lower().find(unwanted_word.lower()) == -1 for unwanted_word in UNWANTED_WORDS]
    if not all(x == True for x in match_of_unwanted_words):
        sys.stderr.write (&quot;Please avoid words '&quot; + ', '.join(UNWANTED_WORDS) + &quot;' in source code.&quot;)
        sys.exit(1)	

    sys.exit(0)

if __name__ == '__main__':
    if len(sys.argv) &lt; 3:
        sys.stderr.write(&quot;Usage: %s REPOS TXN\n&quot; % (sys.argv[0]))
    else:
        main(sys.argv[1], sys.argv[2])
</pre>
<p>Place it to your [repo]/hooks directory and make sure it can be executed by the server user.<br />
You can easily test it by changing the return value @ line 26 to a non-zero value to have an always failing pre-commit hook.</p>
]]></content:encoded>
			<wfw:commentRss>http://domotorgyimesi.net/blog/2012/04/26/end-bad-language-in-your-repository/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Szakdolgozat</title>
		<link>http://domotorgyimesi.net/blog/2012/04/08/szakdolgozat/</link>
		<comments>http://domotorgyimesi.net/blog/2012/04/08/szakdolgozat/#comments</comments>
		<pubDate>Sun, 08 Apr 2012 09:26:25 +0000</pubDate>
		<dc:creator>dgyimesi</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://domotorgyimesi.net/blog/?p=218</guid>
		<description><![CDATA[Eljutván e félévben az abszolutóriumig itt az ideje összedobni valamit szakdolgozat gyanánt. 
&#8220;Startup(-ok) indításának agilis szoftverfejlesztési lehetőségei&#8221; címmel egy kisebb kutatás végére teszek pontot, ahol az engem amúgy is folyamatosan izgató szakmai-&#8221;saját lábra állás&#8221;-sal kapcsolatban vonok le következtetést az eddig khárrierem :] közben tapasztaltakról, a kód művészeti szépségeiről és olyan technológiáról, melyek segítségével minimalizálható a [...]]]></description>
			<content:encoded><![CDATA[<p>Eljutván e félévben az abszolutóriumig itt az ideje összedobni valamit szakdolgozat gyanánt. </p>
<p><i>&#8220;Startup(-ok) indításának agilis szoftverfejlesztési lehetőségei&#8221;</i> címmel egy kisebb kutatás végére teszek pontot, ahol az engem amúgy is folyamatosan izgató szakmai-&#8221;saját lábra állás&#8221;-sal kapcsolatban vonok le következtetést az eddig khárrierem :] közben tapasztaltakról, a kód művészeti szépségeiről és olyan technológiáról, melyek segítségével minimalizálható a piaci és/vagy anyagi kockázat egy-egy megvalósítani (aztán világuralomra törni szándékozó) ambícióm mögött.</p>
<p>Ugyanis közel sem mindegy, hogy amennyiben rendelkezünk egy bizonyítottan piacérett ötlettel, annak megvalósítása, bevezetése, skálázódása ÉS a tervezés-implementálás viszonyítási rendszerében hol fogunk majd helyet foglalni és főleg, hogy mikor.<br />
Az sem mindegy továbbá, ha van egy gigantikus ötletünk, de elindítására minimális pénz (és főleg idő) áll rendelkezésre olyan mockup-ot tegyünk közzé, amire jó eséllyel ráharap a piac.<br />
Nem én vagyok az első, tudom.</p>
<p>Hurrá.</p>
<p>Hogy valami értelme is legyen a posztnak, álljon itt, hogy miről is lesz szó, címszavakban:</p>
<p><i>extreme programming, lean startups, trial by error, rapid prototyping, server-side javacript, nodejs, jquery, coffeescript, handlebarsjs, zeptojs, requirejs, backbonejs, typography, minimalism, saas, cloud computing, html5, css media queries, &#8230;</i></p>
]]></content:encoded>
			<wfw:commentRss>http://domotorgyimesi.net/blog/2012/04/08/szakdolgozat/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Script Google&#8217;s services? No problem.</title>
		<link>http://domotorgyimesi.net/blog/2012/04/08/script-googles-services-no-problem/</link>
		<comments>http://domotorgyimesi.net/blog/2012/04/08/script-googles-services-no-problem/#comments</comments>
		<pubDate>Sun, 08 Apr 2012 06:50:20 +0000</pubDate>
		<dc:creator>dgyimesi</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Webhack]]></category>
		<category><![CDATA[google apps]]></category>
		<category><![CDATA[google scripts]]></category>

		<guid isPermaLink="false">http://domotorgyimesi.net/blog/?p=189</guid>
		<description><![CDATA[Recently I came accross various situations where my clients needed to have special, custom behaviour to be added to their Google* services.
That was the time when I realized that the opportunity to script Google Apps is already there since a while, so what else would I need, right?
When you look through the exceptionally nice API [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I came accross various situations where my clients needed to have special, custom behaviour to be added to their Google* services.</p>
<p>That was the time when I realized that the opportunity to <a href="https://developers.google.com/apps-script/">script Google Apps</a> is already there since a while, so what else would I need, right?<br />
When you look through the <a href="https://developers.google.com/apps-script/defaultservices">exceptionally nice API docs</a>, you&#8217;ll realize that almost everything could be done through the API in Googleworld.</p>
<p><b>Basics</b></p>
<p>Apps scrpiting is available by Spreadsheets/Tools/Script manager. As far as I know this is the only way to reach this funcionality.<br />
After we have our script a couple of run/debug interations behind its back, there are two ways to trigger it: timely, and on spreadsheet (or of course Google Forms) submit: Macro Editor/Resources/Triggers.</p>
<p>Now, do something useful.</p>
<p><b>Use case</b></p>
<p><a href="http://szentely.org">szentely.org</a> is our little slice of the world. There is only one rule: don&#8217;t break the rules! :]<br />
It is enough to know, for now, that there are more than a dozen of bands who rehearsing regularly, relying on a schedule that should be maintained to track idle sessions when they can go out to practice. Google Calendar is just the easiest way to do this.</p>
<p>But! We have a rule that states that you cannot enter your rehearsal for more than eight days ahead. This is how we try to prevent unfair time-window monopoly.<br />
So, rules should be enforced, right?</p>
<p><b>Script</b></p>
<pre class="brush: jscript;">
function kickOutViolatingRehearsals() {
  // constants

  var CALENDAR_DAYS_LIMIT = 8;
  var NOTIFICATION_MESSAGE = &quot;A következő bejegyzések sértik a Szentély &quot; +
                             &quot;'próba csak 8 napon belül lehetséges' elvét, &quot; +
                             &quot;ezért törlésre kerültek: \n\n&quot;;

  // target calendar to check for violations
  var bigroom = CalendarApp.getCalendarById('domain.com_WASD@group.calendar.google.com');

  var today = new Date();
  var threshold = new Date(today.getTime() + CALENDAR_DAYS_LIMIT * 24 * 60 * 60 * 1000);
  var futureInfinity = new Date(today.getTime() + 365 * 100 * 24 * 60 * 60 * 1000);

  // future rehearsals where band members should be notifiend about the violation
  var futureRehearsals = bigroom.getEvents(threshold, futureInfinity);

  if (futureRehearsals.length &gt; 0) {
    var violations = NOTIFICATION_MESSAGE;

    for (var index = 0; index &lt; futureRehearsals.length; index++) {
      var rehearsal = futureRehearsals[index];
      violations += &quot; * &quot; + rehearsal.getTitle() + &quot; - &quot; + rehearsal.getStartTime() + &quot;\n&quot;;
      rehearsal.deleteEvent();
    }

    Browser.msgBox(violations);
    MailApp.sendEmail(&quot;group-to-notify@domain.com&quot;, &quot;violation of rules&quot;, violations);
  } else {
    Browser.msgBox(&quot;No future rehearsals violating the 8 days limit.&quot;);
  }
}
</pre>
<p>Lines to note:</p>
<ul>
<li>line 10: you can get your calendar ID by clicking on the little arrow beside your calendar in the calendars list and choose calendar settings. It&#8217;s on the bottom of the page.</li>
<li>line 29: for the sake of simplicity I&#8217;ve used a group mail address to get everybody notified about every issue. If you  prefer to notify directly you can use <i>CalendarEvent.getCreators();</i></li>
</ul>
<p>And it&#8217;s only the top of the iceberg.<br />
Happy hackin&#8217;!</p>
]]></content:encoded>
			<wfw:commentRss>http://domotorgyimesi.net/blog/2012/04/08/script-googles-services-no-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crappy video playback on Ubuntu with ATI</title>
		<link>http://domotorgyimesi.net/blog/2011/12/11/crappy-video-playback-on-ubuntu-with-ati/</link>
		<comments>http://domotorgyimesi.net/blog/2011/12/11/crappy-video-playback-on-ubuntu-with-ati/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 15:48:27 +0000</pubDate>
		<dc:creator>dgyimesi</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[ati]]></category>
		<category><![CDATA[fglrx]]></category>
		<category><![CDATA[pain]]></category>
		<category><![CDATA[sluggish]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[video playback]]></category>

		<guid isPermaLink="false">http://domotorgyimesi.net/blog/?p=169</guid>
		<description><![CDATA[It&#8217;s a shame how utterly crap quality ATI&#8217;s driver has! Uh wait, there are shitloads of other problems with the ancient X windowing system too!
For months I had to crossboot to windoze to watch a freakin&#8217; movie because of the ancient, pitchy-patchy graphical windowing shitstem called Xorg/Compiz.
Usually what does one expect when opening a video [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a shame how utterly crap quality ATI&#8217;s driver has! Uh wait, there are shitloads of other problems with the ancient X windowing system too!</p>
<p>For months I had to crossboot to windoze to watch a freakin&#8217; movie because of the ancient, pitchy-patchy graphical windowing shitstem called Xorg/Compiz.</p>
<p>Usually what does one expect when opening a video file in the favourite videoplayer? That it just plays silklike, without LAG, GLITCHES making anybody to PUKE!<br />
No, that would be just too easy, right?!<br />
Googling around &#8211; of course &#8211; just worthtess: not a single technical answer you can find, everybody just scratching the surface with stupid ideas failing miserably.</p>
<p><em>Symptoms:</em></p>
<p><em> </em>Playing video in SMPlayer, VLC, Totem has tiny rendering lags, just like when there isn&#8217;t enough processing power to decode the video thus you have some frames dropped. &#8220;Unfortunately&#8221; this is not the case on my system having 4 cores of Phenom II at 4.0GHz w/ Radeon HD 6850. What is it then?</p>
<p><em>Facts:</em></p>
<ul>
<li>ATI Radeon HD 6850: need to install proprietary driver to have the GPU not to cook itself (power management, you know). That means `fglrx&#8217; with hourly crashes of course. Okay, okay, since 8.9 it&#8217;s quite stable in my experience.</li>
<li>Playing video with the open source `radeon&#8217; driver hasn&#8217;t got the symptoms above. I tried with VLC on a Ubuntu 11.10 live disc. Smooth like silk.</li>
<li>Vsync: there is a known problem video vertical refresh sync in Compiz (dragging windows are sluggish, video playback lags a lot). Here are what you can do: Disable Sync to VBlank in compizconfig-settings-manager totally, in Composite plugin set the refresh rate higher and multiple of your screens refresh rate, and finally enable Tear Free Desktop and set Sync to VBlank to always.</li>
<li>Strange, but if you trying playback with mplayer<em> from the command line</em> you&#8217;ll immediately notice a huge difference, because standalone mplayer plays smoothly at last! For me it&#8217;s working only with <em>-vo gl</em> and -<em>vsync</em> options enabled. But no matter how hard you&#8217;ll try (even with the exactly same parameters) you won&#8217;t get the devotional result with SMPlayer, nor with VLC.</li>
</ul>
<p>Why? This question remains unanswered.<br />
Until then I forced to stick with the command line.</p>
<p><a href="http://domotorgyimesi.net/depo/mplayer.config">Mplayer .config</a></p>
]]></content:encoded>
			<wfw:commentRss>http://domotorgyimesi.net/blog/2011/12/11/crappy-video-playback-on-ubuntu-with-ati/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Feléledt a szentely.org</title>
		<link>http://domotorgyimesi.net/blog/2011/05/14/feleledt-a-szentely-org/</link>
		<comments>http://domotorgyimesi.net/blog/2011/05/14/feleledt-a-szentely-org/#comments</comments>
		<pubDate>Sat, 14 May 2011 17:43:58 +0000</pubDate>
		<dc:creator>dgyimesi</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://domotorgyimesi.net/blog/?p=166</guid>
		<description><![CDATA[Végre volt időm és összeraktam a próbateremi közösség weblapját. Wordpress 3.1.2 alap, saját téma. Még nagyon kezdetleges, de már látszik a vége: www.szentely.org.
]]></description>
			<content:encoded><![CDATA[<p>Végre volt időm és összeraktam a próbateremi közösség weblapját. Wordpress 3.1.2 alap, saját téma. Még nagyon kezdetleges, de már látszik a vége: <a href="http://szentely.org">www.szentely.org</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://domotorgyimesi.net/blog/2011/05/14/feleledt-a-szentely-org/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dreamgrave: új album a láthatáron!</title>
		<link>http://domotorgyimesi.net/blog/2010/12/18/dreamgrave-uj-album-a-lathataron/</link>
		<comments>http://domotorgyimesi.net/blog/2010/12/18/dreamgrave-uj-album-a-lathataron/#comments</comments>
		<pubDate>Sat, 18 Dec 2010 10:07:32 +0000</pubDate>
		<dc:creator>dgyimesi</dc:creator>
				<category><![CDATA[Dreamgrave]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[bejelentés]]></category>
		<category><![CDATA[lp]]></category>
		<category><![CDATA[új album]]></category>

		<guid isPermaLink="false">http://domotorgyimesi.net/blog/?p=163</guid>
		<description><![CDATA[Rég volt már, túl rég&#8230;
Nagyon sok mindenen mentünk keresztül és féltünk, hogy valaminek vége szakadt, örökre.
De nem adtuk fel, és mostanában arra készülünk, hogy megosszuk veletek mindazt, ami azóta történt velünk és az álmainkkal.
Helyettük a következő tracklist álljon egyelőre, ami már eléggé biztos, hogy így fog kinézni:
1. Intro
2. Black Spiral / Fekete spirál
3. Red Rain [...]]]></description>
			<content:encoded><![CDATA[<p>Rég volt már, túl rég&#8230;<br />
Nagyon sok mindenen mentünk keresztül és féltünk, hogy valaminek vége szakadt, örökre.<br />
De nem adtuk fel, és mostanában arra készülünk, hogy megosszuk veletek mindazt, ami azóta történt velünk és az álmainkkal.<br />
Helyettük a következő tracklist álljon egyelőre, ami már eléggé biztos, hogy így fog kinézni:</p>
<p style="text-align: center;">1. Intro<br />
2. Black Spiral / Fekete spirál<br />
3. Red Rain Nightfall / Vörös eső alkonyán (a vérem áztatta földek felett)<br />
4. Presentiment / Balsejtelem<br />
5. Frozen Will / Fagyos akarat<br />
6. Bloodrose / Vérrózsa<br />
7. Untitled / Névtelen<br />
8. Embracing a Soul / Lélekölelés &#8211; instrumental</p>
<p>Igen, most valóban úgy néz ki, hogy a dalok angol és magyar nyelven is fel lesznek énekelve.</p>
<p><strong>Mégvalami: ha ismered a számainkat és szeretnél egy hasonló ámbár progresszívebb (matekabb), tempósabb zenét játszani és bőgős vagy gitáros vagy, keress meg minket! </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://domotorgyimesi.net/blog/2010/12/18/dreamgrave-uj-album-a-lathataron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL 9.0.1 and PostGIS 1.5.2 bytea problems</title>
		<link>http://domotorgyimesi.net/blog/2010/12/13/postgresql-9-0-1-and-postgis-1-5-2-bytea-problems/</link>
		<comments>http://domotorgyimesi.net/blog/2010/12/13/postgresql-9-0-1-and-postgis-1-5-2-bytea-problems/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 11:30:23 +0000</pubDate>
		<dc:creator>dgyimesi</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[byte array]]></category>
		<category><![CDATA[bytea]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[postgis]]></category>
		<category><![CDATA[postgresql9]]></category>

		<guid isPermaLink="false">http://domotorgyimesi.net/blog/?p=152</guid>
		<description><![CDATA[Some days ago I had a little time to play around PostgreSQL 9.0.1 and PostGIS 1.5.2 and upgrade our development server to examine the benefits of the 9th version of PostgreSQL.
The migration is easy, even without touching your currently running server. Thanks to Simon Tokumine everybody can set up the server and PostGIS based on this [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago I had a little time to play around PostgreSQL 9.0.1 and PostGIS 1.5.2 and upgrade our development server to examine the <a href="http://wiki.postgresql.org/wiki/Illustrated_9_0#Hot_Standby">benefits</a> of the 9th version of PostgreSQL.</p>
<p>The migration is easy, even without touching your currently running server. Thanks to Simon Tokumine everybody can set up the server and PostGIS based on <a href="http://www.tokumine.com/2010/10/12/postgres-9-postgis-1-5-2-geos-3-2-2-and-gdal-1-7-on-ubuntu-10-04-lucid/">this article</a> in no time.</p>
<p>After I walked through Simon&#8217;s guidance, I easily mirrored all of my DBs by running:</p>
<pre class="brush: bash;">pg_dumpall -p 5432 | psql -d postgres -p 5433</pre>
<p>You have to be <em>postgres</em> to do this. The v9 server&#8217;s port defaults to 5433.</p>
<p>Of course nothing comes without an effort. In our application we use the Java classes of PostGIS to wrap geometries in our logic. Soon after the migration the first test pointed out a problem around the new <em>bytea</em><strong> </strong>encoding introduced in PostgreSQL 9.<br />
After looked through the PostGIS mailing lists I found that developers&#8217;ve already been taken care of this problem, but unfortunately it&#8217;s still persists in the latest stable version (1.5.2).</p>
<p>The workaround is simple: you can fallback in your v9 server to the obsolete (&#8216;hex&#8217;) encoding for byte arrays by setting <em>/etc/postgresql/9.0/main/postgresql.conf</em> bytea_output to &#8216;hex&#8217;. If anyone knows any drawbacks falling back to hex encoding, please tell me since I could not find anything serious except performance issues when copying big amount of data.</p>
]]></content:encoded>
			<wfw:commentRss>http://domotorgyimesi.net/blog/2010/12/13/postgresql-9-0-1-and-postgis-1-5-2-bytea-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to schedule stuck query termination in PostgreSQL</title>
		<link>http://domotorgyimesi.net/blog/2010/11/18/how-to-schedule-stuck-query-termination-in-postgresql/</link>
		<comments>http://domotorgyimesi.net/blog/2010/11/18/how-to-schedule-stuck-query-termination-in-postgresql/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 12:23:33 +0000</pubDate>
		<dc:creator>dgyimesi</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[pg_cancel_backend]]></category>
		<category><![CDATA[pg_kill_backend]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[stuck query]]></category>

		<guid isPermaLink="false">http://domotorgyimesi.net/blog/?p=112</guid>
		<description><![CDATA[Have you ever think about what&#8217;s happening in the life of your database while you have a quite large project that depends on frequently called stored procedures?
What if some of these procedures gets unleashed and step into an infinite loop?
What if you have different type of queries that scale from bad to worse as your [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever think about what&#8217;s happening in the life of your database while you have a quite large project that depends on frequently called stored procedures?<br />
What if some of these procedures gets unleashed and step into an infinite loop?<br />
What if you have different type of queries that scale from bad to worse as your application gets bigger and bigger load, and you haven&#8217;t got enough time to check them on a regular basis as you should?</p>
<p>Well, I faced those questions a couple of days ago.<br />
First I wanted to set a time limit for each query the database runs, but I found it impossible to do in PostgreSQL, so I chose another way. I&#8217;ve implemented a Cronjob that is scheduled for run in every minute checking for stuck queries around.</p>
<p>In PostgreSQL there is two different kind of internal command to terminate a query:</p>
<ul>
<li> <em>pg_cancel_backend </em>is equivalent to sending SIGINT to the process while</li>
<li><em>pg_kill_backend</em> is equivalent to sending SIGKILL to the process</li>
</ul>
<p>PostgreSQL uses a process per connection, so you can kill a process without much danger of affecting other connections, but <em>pg_cancel_backend</em> is a more graceful way to stop the naughty query.</p>
<p>The script below just does the job.<br />
If someone wants to take control over queries running too long on all existing databases he should run the script from cron not as superuser but as <em>postgres </em>to let <em>pg_cancel_backend</em> to see each user&#8217;s query<em>.</em></p>
<p>Here we go:</p>
<pre class="brush: bash;">
#!/bin/sh

# Settings
SECONDS=30
LOGFILE=/tmp/pg_activity.log

# The script must run as postgres, since only postgres user has control over every database.
if [ `whoami` != &quot;postgres&quot; ]; then
    exit 0;
fi

# Selecting relevant columns, getting non-idle queries only where the query runs since at least $SECONDS seconds.
psql -c &quot;SELECT procpid, datname, usename, current_query, xact_start FROM pg_stat_activity WHERE current_query NOT LIKE '%&lt;IDLE&gt;%' AND current_timestamp &gt;= xact_start + time '00:00:$SECONDS'&quot; &gt; $LOGFILE
NUMBER_OF_STUCK_QUERIES=`cat $LOGFILE | grep &quot;([0-9]* row[s]*)&quot; | sed 's/(//' | awk '{ print $1}'`

if [ $NUMBER_OF_STUCK_QUERIES != 0 ]; then
    # Getting the first column from the output discarding alfanumeric values (table elements in psql's output).
    STUCK_PIDS=`cat $LOGFILE | sed &quot;s/([0-9]* row[s]*)//&quot; | awk '{ print $1 }' | sed &quot;s/[^0-9]//g&quot;`
    for PID in $STUCK_PIDS; do
	echo -n &quot;Cancelling PID $PID ... &quot; &gt;&gt; $LOGFILE

	# &quot;t&quot; means the query is successfully cancelled.
	SUCCESS=`psql -c &quot;SELECT pg_cancel_backend($PID);&quot; | grep &quot; t&quot;`
	if [ $SUCCESS ]; then
	    SUCCESS=&quot;OK.&quot;;
	else
	    SUCCESS=&quot;Failed.&quot;;
	fi
	echo $SUCCESS &gt;&gt; $LOGFILE
    done

    cat $LOGFILE | mail -s &quot;Stuck PLpgSQL processes detected and killed (SECONDS=$SECONDS).&quot; &lt;to_mail_address&gt; -- -F &quot;&lt;from_name&gt;&quot; -f &quot;&lt;from_mail_address&gt;&quot;;
fi

rm $LOGFILE
</pre>
<p><a href="http://domotorgyimesi.net/depo/check-for-stuck-queries.cron.sh">Download.</a></p>
<p>As you can see it reports every process and success of termination in email, because it&#8217;s good to know about these cases, when your system struggles to finish a query you&#8217;ve executed.</p>
<p>That&#8217;s all folks!</p>
]]></content:encoded>
			<wfw:commentRss>http://domotorgyimesi.net/blog/2010/11/18/how-to-schedule-stuck-query-termination-in-postgresql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do not ever buy cheap Firewire cards!</title>
		<link>http://domotorgyimesi.net/blog/2010/10/02/do-not-ever-buy-cheap-firewire-cards/</link>
		<comments>http://domotorgyimesi.net/blog/2010/10/02/do-not-ever-buy-cheap-firewire-cards/#comments</comments>
		<pubDate>Sat, 02 Oct 2010 18:10:35 +0000</pubDate>
		<dc:creator>dgyimesi</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[cheap]]></category>
		<category><![CDATA[expresscard]]></category>
		<category><![CDATA[firewire]]></category>
		<category><![CDATA[ieee1384]]></category>
		<category><![CDATA[motu 828mk3]]></category>
		<category><![CDATA[texas instruments]]></category>

		<guid isPermaLink="false">http://domotorgyimesi.net/blog/?p=97</guid>
		<description><![CDATA[Recently I become owner of a kind of magic, a MOTU 828mk3 professional sound card. With this piece of hardware (and with any other advanced audio gadget) you can talk through IEEE1394.
The answer lies mainly in the professional sound/audio/video engineering world, where almost everything get done on MacOS based software, therefore no one can step [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I become owner of a kind of magic, a <a href="http://www.motu.com/products/motuaudio/828mk3/">MOTU 828mk3</a> professional sound card. With this piece of hardware (and with any other advanced audio gadget) you can talk through IEEE1394.</p>
<p>The answer lies mainly in the professional sound/audio/video engineering world, where almost everything get done on MacOS based software, therefore no one can step aside ignoring this platform and – of course – its own serial bus interface, the Firewire.</p>
<p>I’m sure enough to state that USB2.0 isn’t really capable to stand all the demands audio/video editing puts against it. Everybody noticed already how slow USB connected hard drives can be. That&#8217;s because theoretically USB2.0 has a maximal throughput of 480Mbps, but in the real world this number stalls at 190-200Mbps.<br />
Contrarily <a href="http://www.macworld.com/article/145224/2009/12/firewire_usb.html">benchmarks</a> show that FireWire can push out almost the theoretical speeds (400/800MBps) from itself. <a href="http://www.directron.com/firewirevsusb.html">Here</a> is a neat comparison between the two serial bus standards, if you would like to get more deep knowledge on the topic.</p>
<p>So, where was I? Oh yes, the MOTU 828mk3. I mainly use my laptop for editing and mixing. This machine has got an ExpressCard slot. So, let’s ebay for a 1394 ExpressCard to make some noise with the new stuff. A little time later I’ve found the cheapest one, a JMicron IEEE1394a controller. &#8220;Buy it&#8221; – I said.</p>
<p>Days passed and the stuff finally arrived. I was swimming in happiness as long as I didn&#8217;t get home and tried to listen what quality of the MOTU main outs are. “Hey! Where is the sound?!” – I was yammering. I could see all the outs and ins, Traction played the tracks and there&#8217;s nothing! Did I become completely deaf or what?</p>
<p>You know why is that all, except few card costs at least $40-$50? Because the cheaper ones are not based on Texas Instruments’ chipset. Some may think that FireWire is supported in similar manner as USB. It’s not true at all.</p>
<p>The bottom line: get a IEEE1394 card only with TI chipset, or you’ll lose hair and what is more important: time!</p>
<p><strong>Update: </strong>the exact Vendor/Device ID is: 197B / 2380. Windows Hardware ID: PCI\VEN_197B&amp;DEV_2380&amp;SUBSYS_2380197B&amp;REV_00</p>
]]></content:encoded>
			<wfw:commentRss>http://domotorgyimesi.net/blog/2010/10/02/do-not-ever-buy-cheap-firewire-cards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kerékpárral Szegeden (vagy úgy általában Magyarországon)</title>
		<link>http://domotorgyimesi.net/blog/2010/09/10/kerekparral-szegeden-vagy-ugy-altalaban-magyarorszagon/</link>
		<comments>http://domotorgyimesi.net/blog/2010/09/10/kerekparral-szegeden-vagy-ugy-altalaban-magyarorszagon/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 12:46:56 +0000</pubDate>
		<dc:creator>dgyimesi</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[bicikli]]></category>
		<category><![CDATA[bicikliút]]></category>
		<category><![CDATA[bringa]]></category>
		<category><![CDATA[kerékpár]]></category>
		<category><![CDATA[kresz]]></category>
		<category><![CDATA[szeged]]></category>

		<guid isPermaLink="false">http://domotorgyimesi.net/blog/?p=75</guid>
		<description><![CDATA[Már jó egy éve, hogy beszereztem életem első komolyabb bringáját, egy Kelly&#8217;s Saphix trekking darabot.
Révén, hogy nagyközségből való vagyok, itt Szegeden kissé meg voltam illetődve, amikor első hosszabb városi bringázásomra került sor. Egyrészt azért, mert nem ismertem maradéktalanul a szabályokat (nem rendelkezem jogosítvánnyal), másrészt mert akárhonnan is próbáltam tájékozódni (fórumokból, vagy a rendőrtől magától), egymásnak [...]]]></description>
			<content:encoded><![CDATA[<p>Már jó egy éve, hogy beszereztem életem első komolyabb bringáját, egy Kelly&#8217;s Saphix trekking darabot.</p>
<p>Révén, hogy nagyközségből való vagyok, itt Szegeden kissé meg voltam illetődve, amikor első hosszabb városi bringázásomra került sor. Egyrészt azért, mert nem ismertem maradéktalanul a szabályokat (nem rendelkezem jogosítvánnyal), másrészt mert akárhonnan is próbáltam tájékozódni (fórumokból, vagy a rendőrtől magától), egymásnak teljesen ellentmondó információkkal találkoztam.</p>
<p>Ennek most lett vége, fogtam magam és igyekeztem egy prioritásos listát készíteni a legfontosabb dolgokról, ami a témával kapcsolatos, íme:</p>
<ol>
<li><strong>A szabályok pontos ismerete és betartása:</strong> nagy hibának tartom, hogy a közlekedésben részt lehet venni alapvető KRESZ ismeret nélkül. Gyalogosként még érthető, tekintve, hogy a járda-jelzőlámpa-zebra kombó felismeréséhez és helyes használatához általános intelligencia elégséges.<br />
Nade kerékpárral? Nem is megyek tovább annál a ténynél, hogy a <a href="http://plasma.szfki.kfki.hu/~csillag/kerekpar_kresz/Kerekpar_KRESZ.pdf">KRESZ-ben a kerékpárra is vonatkozó szabályok</a> vannak, így elengedhetetlen ezeknek ismerete, mielőtt valaki részt kíván venni a balesetmentes közlekedésben. Például megfontolandó lenne bevezetni a KRESZ oktatását általános iskola ötödik osztályától. Később középiskolában a hagyományos B-s jogosítvány megszerzéséhez szükséges ismereteket is érinteném, fakultatívan.</li>
<li><strong>Korrekt infrastruktúra és jelzőtáblázás:</strong> mondják, hogy Szeged kerékpárbarát város. Nos, nem igazán tudom hová tenni ezt a kijelentést. Mondhatni, hogy az &#8211; például Budapestnél lehet, hogy barátibb, bár ott kb. 40-50x ekkora forgalom zajlik &#8211; viszont a tapasztalat nem mindig vág ezzel egybe. Tény, hogy igen sok helyre el lehet jutni kerékpárral anélkül, hogy meg kellene szakítani az utat, de legalább ennyi ellenpélda is van. Csak párat említve: a kerékpárút minden további nélkül megszakad, tábla sehol; úttesten nincsen átvezetés felfestve; a táblák szerint az úttestre kerékpárral behajtani tilos, de a járdán szintén tilos; forgalmasabb intézmények előtt közvetlen elvezetett kerékpárút; útfelbontás; bonyolultabb csomópontokban útmutatás teljes hiánya; stb.</li>
<li><strong>Kerékpársáv szabadon hagyása:</strong><em> </em>ez az egyik kedvenc pontom. Nem fér a fejembe, mi késztet gyalogosokat az elszeparált bringaúton (tehát külön járda és kerékpársáv fasorral vagy szegéllyel elválasztott úton) való közlekedésre. Még meg-megérteném, amikor csak a sárga csík választja el a közös úttestet, de a dedikált kerékpársávon mit keresnek?<br />
Az autósok egy másik dilemma tárgyát képezik: felparkolnak (akár naphosszakat) a sávra, mit sem törődve azzal, hogy esetleg teljes szélességében elzárják az utat ezzel.</li>
<li><strong>Tolerancia, türelem:</strong> mindenki követ el hibákat, így alapvetőnek tartom, hogy  ne az indulat vezérelje az embereket, ha társuk késve/hibásan reagál, természetesen ha ezzel nem veszélyeztet senkit sem. Ha sikerült toleránsaknak és türelmeseknek maradnunk, van esélyünk arra, hogy felismerjük saját szokásainkban és viselkedésünkben is az esetleges hibákat, és kijavítsuk azokat.</li>
</ol>
<p>Annak ellenére, hogy komoly kultúrális és mentalitásbeli gondokat tapasztalok, még mindig nem jelenthetem ki, hogy az autósok a bunkók. Nem lehet általánosítani. A hibásak nem az autósok, a kerékpárosok vagy a gyalogosok, hanem az egyén!</p>
<p>Ezzel összhangban szerencsére javulást tapasztalok, gyakran pont az autósoktól: elengednek, még ott is ahol én követek el hibát, türelmesek és jórészt betartják a szabályokat. Persze, kivételek mindig vannak és lesznek is, de a tendencia javuló.</p>
<p>Néhány cikk a Rendőrség honlapjáról:</p>
<ul>
<li><a href="http://www.police.hu/friss/haj090902_03.html?query=ker%C3%A9kp%C3%A1r">A kerékpárosok biztonságáért! (Debreceni Rk.)</a></li>
<li><a href="http://www.police.hu/hajdu/aktualis/haj_100705_01.html?query=ker%C3%A9kp%C3%A1r">Kerékpár-tartozékok és -védelem</a></li>
<li><a href="http://www.police.hu/megelozes/balesetmegelozes/ketkerek060102/kerek0601021.html?query=ker%C3%A9kp%C3%A1r">Január 1-étől hatályos módosítások #1</a> és <a href="http://kerekparosklub.org/navigacio/publikaciok">#2</a></li>
</ul>
<p>Érdemes még ellátogatni a <a href="http://kerekparosklub.hu/magyar-kerekparosklub-allaspont-a-jarda-a-gyalogosoke">Magyar Kerékpáros Klub</a> lapjára is.</p>
<p><strong>Update: </strong>egyátalán nem értem <a href="http://www.hunrun.com/villogni-nem-szabad-vilagitani-kotelezo">ennek</a> a szabálynak a létjogosultságát. A tapasztalat pont az ellenkezőjét diktálná. Csak számomra tűnik fel jobban egy villogó kerékpáros, mint az, aki folyamatosan világít?</p>
]]></content:encoded>
			<wfw:commentRss>http://domotorgyimesi.net/blog/2010/09/10/kerekparral-szegeden-vagy-ugy-altalaban-magyarorszagon/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

