<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Programming &amp; Databases</title>
    <link>https://www.simononsoftware.com/</link>
    <description>Recent content on Programming &amp; Databases</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>...</copyright>
    <lastBuildDate>Tue, 14 Apr 2020 00:00:00 +0000</lastBuildDate><atom:link href="https://www.simononsoftware.com/index.xml" rel="self" type="application/rss+xml" />

    <item>
      <title>Benchmarking Compression Programs</title>
      <link>https://www.simononsoftware.com/benchmarking-compression-programs/</link>
      <pubDate>Tue, 14 Apr 2020 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/benchmarking-compression-programs/</guid>
      <description>&lt;p&gt;My main question is: &lt;strong&gt;which program should I use for compression?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The answer is not very simple.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s rather obvious that it will take longer to compress a bigger file than a smaller one. But will that be twice longer for a twice bigger file?&lt;/p&gt;
&lt;p&gt;Are you able to sacrifice compressing a file for another hour just to make it a little bit smaller?&lt;/p&gt;
&lt;p&gt;What about decompressing time?&lt;/p&gt;
&lt;p&gt;Is it true that decompressing time depends on the compression level?&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Generating Random Data in PostgreSQL</title>
      <link>https://www.simononsoftware.com/generating-random-data-in-postgresql/</link>
      <pubDate>Mon, 17 Feb 2020 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/generating-random-data-in-postgresql/</guid>
      <description>&lt;p&gt;Dealing with randomness in PostgreSQL can be tricky. Sometimes we get a little bit unpredictable results. Sometimes the distribution of the random numbers is not what we wanted. Sometimes things are slow.&lt;/p&gt;
&lt;p&gt;Here I&amp;rsquo;m trying to describe common problems I met when using PostgreSQL and how they can be solved.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Bitboards Are Not Magical</title>
      <link>https://www.simononsoftware.com/bitboards-are-not-magical/</link>
      <pubDate>Tue, 14 Jan 2020 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/bitboards-are-not-magical/</guid>
      <description>&lt;p&gt;I started writing a chess engine. The longer I keep on writing it, the longer I see that it’s a never-ending story. There is always something, which should be improved. There is always something to make in a different way, but I’m not sure if it would be better or worse. And most of the good design decisions made at the beginning, don’t look so good later.&lt;/p&gt;
&lt;p&gt;During the journey, I learned a lot and I hope to learn much more. This time I&amp;rsquo;m going to describe what I learned about bitboards.&lt;/p&gt;
&lt;p&gt;I have also written a &lt;a href=&#34;https://github.com/szymonlipinski/NQueens&#34;&gt;java implementation of the NQueens problem&lt;/a&gt;. I used bitboards there and they made the program quite fast.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Hacker News Links Analysis</title>
      <link>https://www.simononsoftware.com/hackernews-links-analysis/</link>
      <pubDate>Sun, 15 Sep 2019 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/hackernews-links-analysis/</guid>
      <description>&lt;p&gt;I made an analysis of the Hacker News data. My main interest was about the URLs, which appeared on the website.&lt;/p&gt;
&lt;p&gt;Here is a short explanation of the process. Links for the analysis are at the end.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>How Not to Send PDF Files</title>
      <link>https://www.simononsoftware.com/how-not-to-send-pdf-files/</link>
      <pubDate>Mon, 15 Apr 2019 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/how-not-to-send-pdf-files/</guid>
      <description>&lt;h2 id=&#34;ive-got-a-pdf&#34;&gt;I&amp;rsquo;ve Got a PDF&lt;/h2&gt;
&lt;p&gt;An insurance company used to send me a paper letter (you know, the ancient way of communication) every year, right before the anniversary. Usually they offer some kind of change, like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Hey, we offer that you will pay x% more money from the next month,&lt;/p&gt;
&lt;p&gt;in return we offer you x% more for the insurance amount.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And that&amp;rsquo;s perfectly fine. Really.&lt;/p&gt;
&lt;p&gt;This year they sent me an email, with an attached PDF file. In the email they wrote:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;We attached you the anniversary documents.&lt;/p&gt;
&lt;p&gt;The files is protected with a password, which is the birth date of the insured personed, in the format of DDMMYYY.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Yea&amp;hellip; my first thought was&amp;hellip;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;why do they even bother to add the password.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;My next thought was:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;what if&amp;hellip;&lt;/p&gt;
&lt;/blockquote&gt;</description>
    </item>

    

    <item>
      <title>How To Calculate Length of Overlapping Ranges in PostgreSQL</title>
      <link>https://www.simononsoftware.com/how-to-calculate-length-of-overlapping-ranges-in-postgres/</link>
      <pubDate>Fri, 01 Mar 2019 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/how-to-calculate-length-of-overlapping-ranges-in-postgres/</guid>
      <description>&lt;h2 id=&#34;the-problem&#34;&gt;The Problem&lt;/h2&gt;
&lt;p&gt;PostgreSQL has many interesting features for building custom logic inside the database to ensure the data is correct. It is also possible to build logic for simpler processing data.&lt;/p&gt;
&lt;p&gt;In this post I will show how to use PostgreSQL to create an easy to use custom aggregate to calculate the length of a collection of overlapping ranges.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Why Proper Types Matter and Duck Typing Not</title>
      <link>https://www.simononsoftware.com/why-proper-types-matter-and-duck-typing-not/</link>
      <pubDate>Tue, 16 Oct 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/why-proper-types-matter-and-duck-typing-not/</guid>
      <description>&lt;p&gt;Many Python programmers repeat that looking like a duck is much more important than if it&amp;rsquo;s really a duck. So, if you have an object passed to a function, then the class of the object is not important. The only important thing is if the passed object has a specific function, which you want to call.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If it walks like a duck and it quacks like a duck, then it must be a duck&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Duck_typing&#34;&gt;https://en.wikipedia.org/wiki/Duck_typing&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What if it&amp;rsquo;s not? In the Wikipedia there is a more historical term, a Duck Test:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If it looks like a duck, swims like a duck, and quacks like a duck, then it probably &lt;em&gt;is&lt;/em&gt; a duck.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Duck_test&#34;&gt;https://en.wikipedia.org/wiki/Duck_test&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The word &lt;code&gt;must&lt;/code&gt; is a very bad assumption. What if it&amp;rsquo;s not? Will the program blow up on production. The word &lt;code&gt;probably&lt;/code&gt; is a better assumption, but it&amp;rsquo;s also a very significant source of problems in many programs I observed. Sometimes something &lt;code&gt;looking like a duck&lt;/code&gt; is not a duck at all. It&amp;rsquo;s not even similar to a duck.&lt;/p&gt;
&lt;p&gt;A string is not a number and a number is not a rectangle. So how come that in programming people claim these are the same things? Simple things will be simple. Unfortunately,  every simple program tends to go in the direction of a much more twisted beast, right after you think about adding a new feature or two. Too often after such a change the result was having twisted ducks with four legs but without a head. The program was fine in most cases. Debugging was hard. It was much easier to start writing that from scratch. And then you will need to add a feature or two&amp;hellip;&lt;/p&gt;
&lt;p&gt;Should you care? Well, you always should. Unless you don&amp;rsquo;t care about the programs you are writing.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Why I Like Kotlin</title>
      <link>https://www.simononsoftware.com/why-i-like-kotlin/</link>
      <pubDate>Sun, 26 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/why-i-like-kotlin/</guid>
      <description>&lt;p&gt;For the last couple of months I&amp;rsquo;ve been slowly going from Python to Kotlin. Kotlin is a statically typed language running on JVM. During the last years I was rather avoiding all the JVM stuff. Now I&amp;rsquo;m slowly starting to appreciate this.&lt;/p&gt;
&lt;p&gt;I always disliked Java for the huge memory consumption, garbage collector, the terrible inconsistency and quite stupid design decisions. Then I slowly switched to Python. It was great at the beginning. However, when going deeper and deeper, and the projects were getting bigger and bigger, it turned out that it&amp;rsquo;s just slowing down the whole development.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Three Value Logic in Sql</title>
      <link>https://www.simononsoftware.com/three-value-logic-in-sql/</link>
      <pubDate>Fri, 17 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/three-value-logic-in-sql/</guid>
      <description>&lt;p&gt;SQL has a little bit different logic system than normally is taught at schools. The simple two value logic has only the values: &lt;code&gt;true&lt;/code&gt; and &lt;code&gt;false&lt;/code&gt;. Additionally there are logical operators like &lt;code&gt;or&lt;/code&gt;, &lt;code&gt;and&lt;/code&gt;, &lt;code&gt;not&lt;/code&gt;. There are also operators returning these values like &lt;code&gt;=&lt;/code&gt;, &lt;code&gt;&amp;lt;&amp;gt;&lt;/code&gt;, &lt;code&gt;in&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;All that combined allows for some complicated searches like:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; 
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;tab&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;a&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;AND&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;(x&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;&amp;lt;&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#39;c&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;OR&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;y&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;in&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;(&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#39;a&amp;#39;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;));&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;An example from the last bug I fixed:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;x&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;id&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;:id1&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;AND&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;id&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;&amp;lt;&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;:id2;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The values of &lt;code&gt;:id1&lt;/code&gt; and &lt;code&gt;:id2&lt;/code&gt; are passed by a function using a complicated logic. Generally I wanted to have results like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;WITH&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;DATA&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;AS&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;(&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;AS&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;id)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;id&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;data&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;WHERE&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;id&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;AND&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;id&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;&amp;lt;&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;2&lt;/span&gt;;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;id&lt;span style=&#34;color:#bbb&#34;&gt; 
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;----
&lt;/span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;(&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;row&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For some values of the &lt;code&gt;:id2&lt;/code&gt; argument the query returned no rows at all, even that there was a row with &lt;code&gt;id=1&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The two-valued logic in databases is generally useless. In SQL there is something more: there is &lt;code&gt;NULL&lt;/code&gt;. This is also called a three-valued logic. The rules are a little bit different and sometimes it&amp;rsquo;s too easy to make mess.&lt;/p&gt;
&lt;h2 id=&#34;the-boolean-values&#34;&gt;The Boolean Values&lt;/h2&gt;
&lt;p&gt;In the two-valued logic we have only &lt;code&gt;true&lt;/code&gt; and &lt;code&gt;false&lt;/code&gt;. Then the results of some operations are:&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>An Error in A Query Removed All Data</title>
      <link>https://www.simononsoftware.com/error-in-query-removed-all-data/</link>
      <pubDate>Tue, 28 Nov 2017 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/error-in-query-removed-all-data/</guid>
      <description>&lt;h2 id=&#34;there-was-an-error-in-a-good-query&#34;&gt;There Was an Error in a Good Query&lt;/h2&gt;
&lt;p&gt;After applying a data migration we had some duplicated rows in a table. I wrote a simple query for finding the duplicates and removing them from the table. All went fine. Or at least I thought so.&lt;/p&gt;
&lt;p&gt;This kind of operations should always be done in a transaction, so the changes can be rolled back on error. The general workflow I use looks like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;BEGIN&lt;/span&gt;;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;DELETE&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;x...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;x...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This leaves an open transaction, so I can check all the data without modifying them permanently in the database.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Virtualenv Tutorial Part 3</title>
      <link>https://www.simononsoftware.com/virtualenv-tutorial-part-3/</link>
      <pubDate>Mon, 24 Apr 2017 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/virtualenv-tutorial-part-3/</guid>
      <description>&lt;p&gt;After writing the &lt;a href=&#34;https://www.simononsoftware.com/virtualenv-tutorial&#34;&gt;Part 1&lt;/a&gt; and the new &lt;a href=&#34;https://www.simononsoftware.com/virtualenv-tutorial-part-2&#34;&gt;Part 2&lt;/a&gt; of the Virtualenv Tutorial, I have created a simple video showing how to install the Virtualenv Wrapper on a fresh Ubuntu installation and how to create the first virtual environments.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Why I Created DBRows</title>
      <link>https://www.simononsoftware.com/why-i-created-dbrows/</link>
      <pubDate>Wed, 15 Feb 2017 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/why-i-created-dbrows/</guid>
      <description>&lt;p&gt;Some time ago I was using the &lt;a href=&#34;https://github.com/kennethreitz/records&#34;&gt;Records&lt;/a&gt; library. When I searched for some comments, I noticed only good reviews. The main goal of this library to simplify things. It&amp;rsquo;s a proxy to the SqlAlchemy library.&lt;/p&gt;
&lt;p&gt;The only thing I was no impressed with was the library interface.&lt;/p&gt;
&lt;p&gt;After some time of using it, I got the feeling that the interface is not good enough. It looked rather like some random ad hoc bunch of functions put into classes.&lt;/p&gt;
&lt;p&gt;So I have decided to implement my own version. Mainly to find out if it is possible to create &lt;a href=&#34;https://www.simononsoftware.com/good-python-interface/&#34;&gt;the kind of interface I described here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s why the &lt;a href=&#34;https://github.com/szymonlipinski/dbrows&#34;&gt;DBRows Project&lt;/a&gt; has been born.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Good Python Interface</title>
      <link>https://www.simononsoftware.com/good-python-interface/</link>
      <pubDate>Tue, 24 Jan 2017 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/good-python-interface/</guid>
      <description>&lt;p&gt;In &lt;a href=&#34;https://www.simononsoftware.com/the-importance-of-good-interfaces/&#34;&gt;the previous blog post&lt;/a&gt; I wrote about changing interfaces using a Java class as an example.&lt;/p&gt;
&lt;p&gt;The public interface of the final implementation was:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;color:#00f&#34;&gt;constructor&lt;/span&gt;&lt;span style=&#34;color:#b00040&#34;&gt;:&lt;/span&gt;

    (int, int)

&lt;span style=&#34;color:#00f&#34;&gt;methods&lt;/span&gt;&lt;span style=&#34;color:#b00040&#34;&gt;:&lt;/span&gt;
 
    getWidth&lt;span style=&#34;color:#008000&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt; int
    getHeight&lt;span style=&#34;color:#008000&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt; int
    getArea&lt;span style=&#34;color:#008000&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt; int
    setWidth(int)
    setHeight(int) 

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There were no public fields, all were accessible with the setters and getters.&lt;/p&gt;
&lt;p&gt;There was also a C# example with the properties. This way I had the public interface like:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;color:#00f&#34;&gt;constructor&lt;/span&gt;&lt;span style=&#34;color:#b00040&#34;&gt;:&lt;/span&gt;

    (int, int)

&lt;span style=&#34;color:#00f&#34;&gt;fields&lt;/span&gt;&lt;span style=&#34;color:#b00040&#34;&gt;:&lt;/span&gt;

    int width
    int height
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Because of the properties those fields were also writable.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Good Naming Things Is Hard</title>
      <link>https://www.simononsoftware.com/good-naming-things-is-hard/</link>
      <pubDate>Mon, 23 Jan 2017 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/good-naming-things-is-hard/</guid>
      <description>&lt;h2 id=&#34;naming-things-is-hard&#34;&gt;Naming things is hard.&lt;/h2&gt;
&lt;p&gt;Usually when we are going to have a brand new kid, naming her/him takes a couple of months. The endless discussions, the sleepless nights, all the lists of possible combinations of letters (just assume only letters for now). And all the effort just to achieve something that would sound nice to us. And only to us, as usually the grandparents of that brand new family member will not be happy with our choice.&lt;/p&gt;
&lt;p&gt;The normal baby delivery date is quite far in the future, so usually we have lots of time to think about the name and the possible problems the kid will have when naming like &lt;a href=&#34;http://www.breitbart.com/national-security/2016/11/11/kenyans-name-baby-donald-trump/&#34;&gt;Donald Trump Otieno&lt;/a&gt; or like this:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://imgs.xkcd.com/comics/exploits_of_a_mom.png&#34; alt=&#34;delete from users&#34;&gt;&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>The Importance of Good Interfaces</title>
      <link>https://www.simononsoftware.com/the-importance-of-good-interfaces/</link>
      <pubDate>Wed, 18 Jan 2017 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/the-importance-of-good-interfaces/</guid>
      <description>&lt;h2 id=&#34;a-short-introduction-to-a-good-interface&#34;&gt;A Short Introduction To A Good Interface&lt;/h2&gt;
&lt;p&gt;When you are using a class, a function, or a library, you have use its interface. Interface is the set of public knobs and switches which you can use. Usually the interface for most of the libraries, functions, and classes has one common feature: &lt;strong&gt;it irritates programmers&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>A Simpler Requests Interface</title>
      <link>https://www.simononsoftware.com/simpler-requests-interface/</link>
      <pubDate>Tue, 25 Oct 2016 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/simpler-requests-interface/</guid>
      <description>&lt;p&gt;The &lt;a href=&#34;HTTP://docs.python-requests.org/en/master/&#34;&gt;Requests&lt;/a&gt; is quite a good Python library. It simplifies using the ugly and terrible standard Python HTTP libraries. The more I think about the interfaces, the more I think that there is lots of places to improve including the Requests library.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>The Power of Math</title>
      <link>https://www.simononsoftware.com/the-power-of-math/</link>
      <pubDate>Thu, 13 Oct 2016 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/the-power-of-math/</guid>
      <description>&lt;p&gt;In a &lt;a href=&#34;http://localhost:1313/which-one-use-list-comprehension-or-map/&#34;&gt;couple&lt;/a&gt; of &lt;a href=&#34;http://localhost:1313/which-one-use-list-comprehension-or-map-part-two/&#34;&gt;previous&lt;/a&gt; &lt;a href=&#34;http://localhost:1313/python-comprehension-is-not-fast/&#34;&gt;posts&lt;/a&gt; I was considering which is better in Python: map or list comprehension. The final idea was that none of them is as fast as a C++ program, even using exactly the same algorithm.&lt;/p&gt;
&lt;p&gt;What about changing an algorithm a little bit?&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Python Comprehension Is Not Fast</title>
      <link>https://www.simononsoftware.com/python-comprehension-is-not-fast/</link>
      <pubDate>Wed, 12 Oct 2016 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/python-comprehension-is-not-fast/</guid>
      <description>&lt;p&gt;In &lt;a href=&#34;https://www.simononsoftware.com/which-one-use-list-comprehension-or-map-part-two/&#34;&gt;the previous blog post&lt;/a&gt; I have presented results of benchmarking list comprehensions and maps in Python.&lt;/p&gt;
&lt;p&gt;The results looked fine, however there was one thing I couldn&amp;rsquo;t stop thinking about. The huge memory overhead and the huge execution time.&lt;/p&gt;
&lt;p&gt;The process used 50MB of memory from the beginning. Then it had just to iterate through a list of integers (which are small). The number of integers is also small (only 1M). Then it had to make 1M divisions to find the even numbers, and square it (making 0.5M multiplications, and 0.5M additions).&lt;/p&gt;
&lt;p&gt;Why did it take 1.5 minute?&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Which One Use: List Comprehension Or Map?</title>
      <link>https://www.simononsoftware.com/which-one-use-list-comprehension-or-map/</link>
      <pubDate>Fri, 07 Oct 2016 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/which-one-use-list-comprehension-or-map/</guid>
      <description>&lt;p&gt;Some time ago there was a discussion on IRC, which looked like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;- You should not use the map() function 
  in Python but the only list comprehension.
- Why?
- Because it is more Pythonic.
- Why?
- Because all people use the list comprehension.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Other arguments were not convincing as well. I have written about the &lt;code&gt;map&lt;/code&gt; and the &lt;code&gt;list comprehension&lt;/code&gt; in &lt;a href=&#34;https://www.simononsoftware.com/advanced-python-constructs/&#34;&gt;Advanced Python Constructs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Arguments like &lt;em&gt;&amp;ldquo;because I say it&amp;rdquo;&lt;/em&gt; or &lt;em&gt;&amp;ldquo;all people do it like this&amp;rdquo;&lt;/em&gt; (evidence please) are just stupid, not convincing, and simply false (I use &lt;code&gt;map&lt;/code&gt; so that&amp;rsquo;s not true that &lt;code&gt;all people don&#39;t use it&lt;/code&gt;). So I have decided to make some benchmarks for the memory/time characteristics for list comprehensions and maps.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Which One Use: List Comprehension Or Map Part 2?</title>
      <link>https://www.simononsoftware.com/which-one-use-list-comprehension-or-map-part-two/</link>
      <pubDate>Fri, 07 Oct 2016 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/which-one-use-list-comprehension-or-map-part-two/</guid>
      <description>&lt;p&gt;In &lt;a href=&#34;https://www.simononsoftware.com/which-one-use-list-comprehension-or-map/&#34;&gt;the previous blog post&lt;/a&gt; I have presented results of benchmarking list comprehensions and maps. In this one I will run similar tests, but I will filter the list to use only the even numbers.&lt;/p&gt;
&lt;p&gt;I will not repeat the test description from the previous article, you can find it there.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>How To Make A Django Base Model</title>
      <link>https://www.simononsoftware.com/how-to-make-django-base-model/</link>
      <pubDate>Thu, 29 Sep 2016 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/how-to-make-django-base-model/</guid>
      <description>&lt;p&gt;In a Django project I&amp;rsquo;m working on, I have a couple of similar models. I will show how to refactor the models to have less code, clearer project, and remove lots of repeated code.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s assume that I&amp;rsquo;m working on indexing youtube videos.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Advanced Python Constructs</title>
      <link>https://www.simononsoftware.com/advanced-python-constructs/</link>
      <pubDate>Tue, 06 Sep 2016 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/advanced-python-constructs/</guid>
      <description>&lt;p&gt;A simple description of a couple of more advanced, not wildly used, Python constructs like list  comprehension, dictionary comprehension, map, and filter.&lt;/p&gt;
&lt;p&gt;All examples are using Python 3.5.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Readings in Database Systems</title>
      <link>https://www.simononsoftware.com/readings-in-database-systems/</link>
      <pubDate>Wed, 09 Dec 2015 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/readings-in-database-systems/</guid>
      <description>&lt;p&gt;This is a great book about programming. This is the &lt;a href=&#34;http://www.redbook.io/&#34;&gt;&amp;ldquo;Readings in Database Systems, 5th Edition&amp;rdquo;&lt;/a&gt;. One of the authors is &lt;a href=&#34;https://en.wikipedia.org/wiki/Michael_Stonebraker&#34;&gt;Michael Stonebraker&lt;/a&gt;, one of the authors of the PostgreSQL database.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>C&#43;&#43; Core Guidelines</title>
      <link>https://www.simononsoftware.com/cpp-core-guidelines/</link>
      <pubDate>Fri, 18 Sep 2015 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/cpp-core-guidelines/</guid>
      <description>&lt;p&gt;This is really great. A &lt;a href=&#34;https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md&#34;&gt;huge list of good practices&lt;/a&gt; for writing better modern C++
code.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>How To Show Hidden Awesome Fonts</title>
      <link>https://www.simononsoftware.com/how-to-show-hidden-awesome-fonts/</link>
      <pubDate>Thu, 03 Sep 2015 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/how-to-show-hidden-awesome-fonts/</guid>
      <description>&lt;p&gt;I rewrote my blog engine. Previously I used Wordpress, which was a bunch of spaghetti code, random plugins, terribly old database changes. Now it is much simpler, much better, much faster. Maybe I will describe the implementation later.&lt;/p&gt;
&lt;p&gt;While rewriting the blog, I wanted to use the great Awesome Fonts library. I wanted to use the four icons you can see in the lower left corner of this page. It was as easy as:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-html&#34; data-lang=&#34;html&#34;&gt;&amp;lt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;a&lt;/span&gt;&amp;gt;&amp;lt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#7d9029&#34;&gt;class&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;fa fa-twitter-square&amp;#34;&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;i&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;a&lt;/span&gt;&amp;gt;
&amp;lt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;a&lt;/span&gt;&amp;gt;&amp;lt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#7d9029&#34;&gt;class&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;fa fa-linkedin-square&amp;#34;&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;i&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;a&lt;/span&gt;&amp;gt;
&amp;lt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;a&lt;/span&gt;&amp;gt;&amp;lt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#7d9029&#34;&gt;class&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;fa fa-github-square&amp;#34;&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;i&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;a&lt;/span&gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>

    

    <item>
      <title>A Short Introduction to Monads</title>
      <link>https://www.simononsoftware.com/a-short-introduction-to-monads/</link>
      <pubDate>Tue, 02 Jun 2015 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/a-short-introduction-to-monads/</guid>
      <description>&lt;p&gt;Quite a nice introduction to monads, one of the main concepts used in
functional programming.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>New Django migrations</title>
      <link>https://www.simononsoftware.com/new-django-migrations/</link>
      <pubDate>Tue, 17 Jun 2014 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/new-django-migrations/</guid>
      <description>&lt;p&gt;A really worth seeing presentation about the database migration stuff developed in the new Django. This is not released yet, but can be used with the newest Django. I&amp;rsquo;ve checked it, and the migrations are much easier than with South.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Virtualenv Tutorial Part 2</title>
      <link>https://www.simononsoftware.com/virtualenv-tutorial-part-2/</link>
      <pubDate>Wed, 04 Jun 2014 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/virtualenv-tutorial-part-2/</guid>
      <description>&lt;h2 id=&#34;the-first-version-of-this-tutorial&#34;&gt;The First Version of This Tutorial&lt;/h2&gt;
&lt;p&gt;A couple of years ago I wrote a simple article about the virtualenv. A kind of a very &lt;a href=&#34;https://www.simononsoftware.com/virtualenv-tutorial/&#34; title=&#34;Virtualenv Tutorial&#34;&gt;basic tutorial&lt;/a&gt; showing how to use the Python Virtual Environment with different versions of Python like Python 2, and Python 3.&lt;/p&gt;
&lt;p&gt;Since then I’ve changed how I work with the virtualenvs, so here is a more updated version of the tutorial. A better way of managing the environments.&lt;/p&gt;
&lt;p&gt;In this tutorial I will show you how to create a Virtual Environment, manage it, install different libraries, and use different Python versions in each of them.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Quite interesting point of view on Haskell</title>
      <link>https://www.simononsoftware.com/quite-interesting-point-of-view-on-haskell/</link>
      <pubDate>Sun, 01 Jun 2014 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/quite-interesting-point-of-view-on-haskell/</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Another noteworthy Haskell benefit is performance. &lt;a href=&#34;https://www.fpcomplete.com/wp-content/uploads/Silk-case-study.pdf&#34;&gt;Silk credits
Haskell for getting them to market in less than half the
time&lt;/a&gt;
it would have taken otherwise. Haskell allowed them to concentrate
more on innovation and actual programming, and much less on repetitive
testing and debugging. If an early-stage startup has a $100,000 per
month burn rate, this acceleration could be the difference between
life and death.&lt;/p&gt;
&lt;p&gt;&lt;!-- raw HTML omitted --&gt; &amp;ndash; &lt;a href=&#34;http://venturebeat.com/2013/10/11/stop-wasting-billions-of-dollars-using-the-wrong-software-languages/&#34;&gt;link&lt;/a&gt; &lt;!-- raw HTML omitted --&gt;&lt;/p&gt;
&lt;/blockquote&gt;</description>
    </item>

    

    <item>
      <title>Scott Meyers&#39; Advice to Prospective Book Authors</title>
      <link>https://www.simononsoftware.com/scott-meyers-advice-to-prospective-book-authors/</link>
      <pubDate>Thu, 01 May 2014 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/scott-meyers-advice-to-prospective-book-authors/</guid>
      <description>A worth reading article, especially if you consider writing a book, especially a technical one.</description>
    </item>

    

    <item>
      <title>The Most Weird Thing Ever</title>
      <link>https://www.simononsoftware.com/the-most-weird-thing-ever/</link>
      <pubDate>Wed, 23 Apr 2014 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/the-most-weird-thing-ever/</guid>
      <description>&lt;p&gt;This is the most weird thing I&amp;rsquo;ve ever found. I&amp;rsquo;m not sure I will find a more weird one.&lt;/p&gt;
&lt;p&gt;A music album. Full of music. To listen you just need to compile it as a
kernel module. Then you will have a new device you can read the music
from.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Copy and Paste in Console</title>
      <link>https://www.simononsoftware.com/copy-and-paste-in-console/</link>
      <pubDate>Sun, 20 Apr 2014 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/copy-and-paste-in-console/</guid>
      <description>&lt;p&gt;This is a &lt;a href=&#34;http://thejh.net/misc/website-terminal-copy-paste&#34;&gt;great
example&lt;/a&gt; of why you
should not copy any text from a website, and paste it to a console.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>PostgreSQL Backend Flowchart</title>
      <link>https://www.simononsoftware.com/postgresql-backend-flowchart/</link>
      <pubDate>Sat, 19 Apr 2014 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/postgresql-backend-flowchart/</guid>
      <description>&lt;p&gt;Databases seem to be treated like huge complicated black boxes where you throw data and have no idea how to get it back.&lt;/p&gt;
&lt;p&gt;The real world database are pretty simple. These are just programs which parse queries, read some data from files, change the data and save it back.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Speeding Up Generating Data in Postgres</title>
      <link>https://www.simononsoftware.com/speeding-up-generating-data-in-postgres/</link>
      <pubDate>Thu, 17 Apr 2014 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/speeding-up-generating-data-in-postgres/</guid>
      <description>&lt;p&gt;I had this stupid idea for quite a long time. PostgreSQL has the COPY command. It is really fast and it is the best way to load CSV like file to the database. So I had an idea: what about not creating an SQL query from an ORM object, but instead generate a CSV file and load it using the COPY?&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>How Computer Memory Prices Changed</title>
      <link>https://www.simononsoftware.com/how-computer-memory-prices-changed/</link>
      <pubDate>Thu, 17 Apr 2014 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/how-computer-memory-prices-changed/</guid>
      <description>I found quite a nice data about memory prices. Just imagine 1MB of RAM changed from $411M in 1957, to $0.0073 in 2014.
The data is here.</description>
    </item>

    

    <item>
      <title>A Very Nice Summary of the Best Haskell Features</title>
      <link>https://www.simononsoftware.com/very-nice-summary-of-the-best-haskell-features/</link>
      <pubDate>Wed, 16 Apr 2014 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/very-nice-summary-of-the-best-haskell-features/</guid>
      <description>&lt;p&gt;Learning Haskell is hard, but I think it is really profitable. Haskell is not just another boring functional thing. Yea, I know, you can write functional code in Python too. Haskell is just different.&lt;/p&gt;
&lt;p&gt;The main great thing about Haskell is that it is so different from the rest of the languages I use, that it really affects the code I write and the way I think about writing and structuring programs.&lt;/p&gt;
&lt;p&gt;Below is a very nice summary of why Haskell is worth using.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Postgres as NoSQL Database With Validation</title>
      <link>https://www.simononsoftware.com/postgres-as-nosql-database-with-validation/</link>
      <pubDate>Tue, 02 Jul 2013 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/postgres-as-nosql-database-with-validation/</guid>
      <description>I&amp;rsquo;ve written a blog post about PostgreSQL used as NoSQL database with serious data consistency checks. To my big surprise, this simple blog post has drawn huge attention and has been cited in many places.</description>
    </item>

    

    <item>
      <title>Great Presentation - PostgreSQL and Rails</title>
      <link>https://www.simononsoftware.com/great-presentation-postgresql-and-rails/</link>
      <pubDate>Mon, 01 Jul 2013 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/great-presentation-postgresql-and-rails/</guid>
      <description>&lt;p&gt;I really like this presentation, like other things saying that Postgres
is great :)&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Logging in Python Presentation</title>
      <link>https://www.simononsoftware.com/logging-in-python-presentation/</link>
      <pubDate>Wed, 19 Jun 2013 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/logging-in-python-presentation/</guid>
      <description>&lt;p&gt;I think this is a very good introduction to logging in Python. It is just an introduction. More information can be found in documentation, but it is usually easier when someone shows the main ideas up.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Writing Better Tests in Python</title>
      <link>https://www.simononsoftware.com/writing-better-tests-in-python/</link>
      <pubDate>Fri, 14 Jun 2013 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/writing-better-tests-in-python/</guid>
      <description>&lt;p&gt;Quite a nice presentation about writing better tests in Python.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>The Importance of Database Testing</title>
      <link>https://www.simononsoftware.com/the-importance-of-database-testing/</link>
      <pubDate>Wed, 23 Nov 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/the-importance-of-database-testing/</guid>
      <description>&lt;h2 id=&#34;basic-mistakes-in-database-testing&#34;&gt;Basic Mistakes in Database Testing&lt;/h2&gt;
&lt;p&gt;There is a huge number of books about TDD. Those books usually concentrate on using tests for units of work. Units of work are understood in many different ways, usually it means a class.&lt;/p&gt;
&lt;p&gt;Those books usually say:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Write a lot of tests, make code in such a way thats the tests pass.&lt;/p&gt;
&lt;p&gt;All external resources should be mocked so you can test only the one unit.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That&amp;rsquo;s cool and there is nothing wrong in this TDD approach. Unfortunately in many cases all of the testing stops at this moment. There are some queries (written by hand or generated by some ORMs) but they are not tested, usually.&lt;/p&gt;
&lt;p&gt;Some programmers test those using integration tests - tests which connect to a real database and perform real queries. This usually means testing only the happy path.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I&amp;rsquo;ve got my ORM &amp;ndash; it takes care of everything.&lt;/p&gt;
&lt;p&gt;I don&amp;rsquo;t need to test it.&lt;/p&gt;
&lt;p&gt;I don&amp;rsquo;t need to think.&lt;/p&gt;
&lt;/blockquote&gt;</description>
    </item>

    

    <item>
      <title>PostgreSQL Versioning Policy</title>
      <link>https://www.simononsoftware.com/postgresql-versioning-policy/</link>
      <pubDate>Fri, 18 Nov 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/postgresql-versioning-policy/</guid>
      <description>&lt;p&gt;I was explaining the PostgreSQL version naming convention to my colleague a couple of days ago. The differences between e.g. 8.3 and 8.4 and what is different between 8.4 and 9.0 and what should be used during database migration to another version. I knew all that just because somebody told me that many years ago (I think it was &lt;a href=&#34;http://www.depesz.com/&#34;&gt;depesz&lt;/a&gt; - thanks).&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Unit Test Your Database.</title>
      <link>https://www.simononsoftware.com/unit-test-your-database/</link>
      <pubDate>Mon, 14 Nov 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/unit-test-your-database/</guid>
      <description>&lt;p&gt;I observe the endless war about TDD. On one side there are those who claim that TDD is the best thing ever. On the other side there are those who claim that TDD is just a waste of time and is too slow.&lt;/p&gt;
&lt;p&gt;But what about databases? Nobody writes about them too seriously.&lt;/p&gt;
&lt;p&gt;In some books there are some wise words like:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;we should use TDD for DAO&lt;/li&gt;
&lt;li&gt;we should use TDD for ORM objects&lt;/li&gt;
&lt;li&gt;we should use TDD for queries&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is very good for testing the unique, foreign and primary keys. Very good for all checks. What is missing here?&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>How to Ensure There is One Row... part 2</title>
      <link>https://www.simononsoftware.com/how-to-ensure-there-is-one-row-part-2/</link>
      <pubDate>Wed, 09 Nov 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/how-to-ensure-there-is-one-row-part-2/</guid>
      <description>&lt;p&gt;Some time ago I wrote about &lt;a href=&#34;https://www.simononsoftware.com/how-to-ensure-there-is-one-row-with-a-value&#34;&gt;ensuring that there is only one row with a specific value in a column.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Today a very similar problem: there is a table like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;CREATE&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;TABLE&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;test&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;(&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;id&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000&#34;&gt;SERIAL&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;PRIMARY&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;KEY&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;name&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000&#34;&gt;TEXT&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;NOT&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;NULL&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;value&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000&#34;&gt;TEXT&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;NOT&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;NULL&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;);&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We need to be sure that there is only one row withing specific name with &lt;code&gt;value=&#39;a&#39;&lt;/code&gt;. There can be more rows with this name, but only one can have &lt;code&gt;value=&#39;a&#39;&lt;/code&gt;.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>What Is The Real PostgreSQL Triggers Ordering?</title>
      <link>https://www.simononsoftware.com/what-is-the-real-postgresql-triggers-ordering/</link>
      <pubDate>Tue, 01 Nov 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/what-is-the-real-postgresql-triggers-ordering/</guid>
      <description>&lt;p&gt;During the last database training that I led, I was talking about selecting rows from database and sorting them. Including some problems with collations. Later I was talking about triggers. For this post I will assume that there are only row level triggers.&lt;/p&gt;
&lt;p&gt;When you perform e.g. &lt;code&gt;INSERT&lt;/code&gt; in the PostgreSQL database, there are fired triggers (if they exists, of course). At the very beginning there are fired all &lt;code&gt;BEFORE INSERT&lt;/code&gt; triggers. Then &lt;code&gt;INSERT&lt;/code&gt; is made, and later all triggers &lt;code&gt;AFTER INSERT&lt;/code&gt; are fired.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If more than one trigger is defined for the same event on the same
relation, the triggers will be fired in alphabetical order by trigger
name.&lt;/p&gt;
&lt;p&gt;&lt;!-- raw HTML omitted --&gt; &amp;ndash; &lt;a href=&#34;http://www.postgresql.org/docs/9.0/static/trigger-definition.html&#34;&gt;trigger-definition&lt;/a&gt; &lt;!-- raw HTML omitted --&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And then suddenly I was asked:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;- OK, that&amp;rsquo;s clear, but which collation is used for ordering the
triggers?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Good point, I really had no idea. So let&amp;rsquo;s check that.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>How To Store UUIDs in PostgreSQL</title>
      <link>https://www.simononsoftware.com/how-to-store-uuids-in-postgresql/</link>
      <pubDate>Tue, 11 Oct 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/how-to-store-uuids-in-postgresql/</guid>
      <description>&lt;p&gt;This story is a just another example of what I call&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Using varchar(255) for everything won&amp;rsquo;t make you a sorcerer.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Every database has many different types. They are there on purpose, not by accident. I&amp;rsquo;ve seen that too many times: a programmer (most companies don&amp;rsquo;t have DBAs for that) creates a database strsucture using only ONE type. Sometimes they use more&amp;hellip; but hardly ever they use all those nice features they database engine provides.&lt;/p&gt;
&lt;p&gt;This is a common pattern:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Pay thousands of dollars for the database licence &amp;ndash; use it like a CSV file.&lt;/p&gt;
&lt;/blockquote&gt;</description>
    </item>

    

    <item>
      <title>PostGIS and Small Number of Huge Geometries</title>
      <link>https://www.simononsoftware.com/postgis-and-small-number-of-huge-geometries/</link>
      <pubDate>Thu, 22 Sep 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/postgis-and-small-number-of-huge-geometries/</guid>
      <description>&lt;p&gt;A couple of weeks ago I had quite a strange situation: a PostgreSQL table with small number of huge geometries. A program had to query the table really often, so the speed was a crucial thing.&lt;/p&gt;
&lt;p&gt;The table was really small, but the spatial query, using PostGIS, was very slow.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Why Is A Query Slow?</title>
      <link>https://www.simononsoftware.com/why-is-query-slow/</link>
      <pubDate>Sun, 21 Aug 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/why-is-query-slow/</guid>
      <description>&lt;p&gt;A couple of days ago a colleague of mine had quite a normal problem. A query was slow. The whole application was written in Java, using Hibernate, all the tables were really small.&lt;/p&gt;
&lt;p&gt;There were about 30 rows in one table. 10 rows in another. One small join. One call of a PostGIS function.&lt;/p&gt;
&lt;p&gt;The query took several seconds to return just about 20 rows. Quite bad.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Problem with random() in PostgreSQL Subselect</title>
      <link>https://www.simononsoftware.com/problem-with-random-in-postgresql-subselect/</link>
      <pubDate>Thu, 04 Aug 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/problem-with-random-in-postgresql-subselect/</guid>
      <description>&lt;p&gt;In a simple project I work sometimes on, I needed to generate a lot of random data in a PostgreSQL database. I&amp;rsquo;ve got a couple of functions for that, but all of them are based on the simple &lt;code&gt;random()&lt;/code&gt; function.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;random()&lt;/code&gt; function returns value from the range &lt;code&gt;[0, 1)&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;select&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;random();&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;random&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;-------------------
&lt;/span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;     &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;583591205533594&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;(&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;row&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So let&amp;rsquo;s generate the random number ten times.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Operator Overloading in Java</title>
      <link>https://www.simononsoftware.com/operator-overloading-in-java/</link>
      <pubDate>Mon, 27 Jun 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/operator-overloading-in-java/</guid>
      <description>&lt;p&gt;C++ has operator overloading. Java does not. Java folks just say the operation overloading is really bad, that it provides bad abstraction and leads to very unreliable and difficult to manage code. That&amp;rsquo;s why Java doesn&amp;rsquo;t have operators overloading.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>How to Ensure There is One Row With a Value</title>
      <link>https://www.simononsoftware.com/how-to-ensure-there-is-one-row-with-a-value/</link>
      <pubDate>Mon, 27 Jun 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/how-to-ensure-there-is-one-row-with-a-value/</guid>
      <description>&lt;p&gt;Let&amp;rsquo;s imagine a business requirement that there should be only one active row in a table. Active means that the column &lt;code&gt;is_active&lt;/code&gt; is set to &lt;code&gt;true&lt;/code&gt;. There can be many rows with the &lt;code&gt;false&lt;/code&gt; or &lt;code&gt;null&lt;/code&gt; values. The row with the only one value can be only one.&lt;/p&gt;
&lt;p&gt;The simple table could look like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;CREATE&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;TABLE&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;test(&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;id&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000&#34;&gt;SERIAL&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;PRIMARY&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;KEY&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;is_active&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000&#34;&gt;BOOLEAN&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;NOT&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;NULL&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;);&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>

    

    <item>
      <title>Random String in PostgreSQL</title>
      <link>https://www.simononsoftware.com/random-string-in-postgresql/</link>
      <pubDate>Mon, 30 May 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/random-string-in-postgresql/</guid>
      <description>&lt;p&gt;Last time I wrote about common problem with the random function. PostgreSQL has only the &lt;code&gt;random()&lt;/code&gt;. There is no function like &lt;code&gt;random(from, to)&lt;/code&gt; or &lt;code&gt;random(length)&lt;/code&gt;, which returns a random text of the given length.&lt;/p&gt;
&lt;p&gt;This time I just needed a function which returns a random text of the given length. Then it can be used like this: &lt;code&gt;SELECT random_text(42)&lt;/code&gt;. The random text will be used as a slug in a web application, so I need only numbers and letters and let&amp;rsquo;s also have only uppercase.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s create a &lt;code&gt;PL/pgSQL&lt;/code&gt; procedure for returning a random text with the given length.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Common Problem with random(min, max)</title>
      <link>https://www.simononsoftware.com/common-problem-with-random-min-max/</link>
      <pubDate>Thu, 28 Apr 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/common-problem-with-random-min-max/</guid>
      <description>&lt;p&gt;There is a common problem with many homemade random functions. All
languages which I know have some kind of  &lt;code&gt;random() &lt;/code&gt; function. This function returns a floating point number within the range &lt;code&gt;[0.0, 1.0)&lt;/code&gt; with uniform distribution of values.&lt;/p&gt;
&lt;p&gt;The random generators can have different distribution of the values, but in this entry I will just write about the uniformly distributed generator.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Are Long Running Transactions Bad?</title>
      <link>https://www.simononsoftware.com/are-long-running-transactions-bad/</link>
      <pubDate>Mon, 28 Feb 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/are-long-running-transactions-bad/</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This transaction has been open since July 2, 2001.&lt;/p&gt;
&lt;p&gt;We call it &amp;ldquo;Edward.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;!-- raw HTML omitted --&gt;&amp;ndash; &lt;a href=&#34;http://thebuild.com/presentations/10-ways-to-kill-performance.pdf&#34;&gt;http://thebuild.com/presentations/10-ways-to-kill-performance.pdf&lt;/a&gt; page 33&lt;!-- raw HTML omitted --&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Some time ago I was asked about long running transactions. Is that
really so bad and how long should a transaction run? I will try to reply
that question now, as it returns all the time. The answer is not so
trivial, as usually when you ask about databases.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Benchmarking String Concatenation in Java</title>
      <link>https://www.simononsoftware.com/benchmarking-string-concatenation-in-java/</link>
      <pubDate>Tue, 25 Jan 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/benchmarking-string-concatenation-in-java/</guid>
      <description>&lt;p&gt;Last time I was &lt;a href=&#34;https://www.simononsoftware.com/primitives-and-objects-benchmark-in-java/&#34;&gt;checking speed of Java
primitives&lt;/a&gt;. It
turned out that &lt;code&gt;Integer&lt;/code&gt; is much slower than &lt;code&gt;int&lt;/code&gt;. This time I want to
check how much slower is the &lt;code&gt;String&lt;/code&gt; concatenation compared
to the &lt;code&gt;StringBuffer&lt;/code&gt; and the &lt;code&gt;StringBuilder&lt;/code&gt;.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>UUID and Java :)</title>
      <link>https://www.simononsoftware.com/uuid-and-java/</link>
      <pubDate>Wed, 19 Jan 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/uuid-and-java/</guid>
      <description>&lt;p&gt;Well, &lt;code&gt;UUID&lt;/code&gt; stands for something &lt;code&gt;UNIQUE&lt;/code&gt;. How that happened that it simply
doesn&amp;rsquo;t work? Or even worse: it doesn&amp;rsquo;t work sometimes.&lt;/p&gt;
&lt;p&gt;I had to use a program which generates some random data in the database. The primary key is &lt;code&gt;UUID&lt;/code&gt;, so the program generates a lot of UUIDs. It uses the standard Java&amp;rsquo;s way of generating UUIDs, the function: &lt;code&gt;UUID.randomUUID()&lt;/code&gt;.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Primitives and Objects Benchmark in Java</title>
      <link>https://www.simononsoftware.com/primitives-and-objects-benchmark-in-java/</link>
      <pubDate>Tue, 11 Jan 2011 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/primitives-and-objects-benchmark-in-java/</guid>
      <description>&lt;p&gt;I was told many times that Java primitives are better and faster than objects, but I haven&amp;rsquo;t found any benchmarks for that. So I made my own. I was trying to check how much slower it is to use the objects like &lt;code&gt;Integer&lt;/code&gt;, &lt;code&gt;Long&lt;/code&gt;, &lt;code&gt;Double&lt;/code&gt; instead of &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;long&lt;/code&gt;, or &lt;code&gt;double&lt;/code&gt;.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>The False Sense of Database Security</title>
      <link>https://www.simononsoftware.com/the-false-sense-of-database-security/</link>
      <pubDate>Sun, 15 Aug 2010 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/the-false-sense-of-database-security/</guid>
      <description>&lt;p&gt;In many web sites, passwords are usually stored in a database. I think this is well known to anybody who ever created any web page with user accounts.&lt;/p&gt;
&lt;p&gt;Storing passwords in plain text is considered harmful. The only reason that I find is when someone gets the access to the database, or has the database backup, the passwords are just in plain text, so everyone can read them.&lt;/p&gt;
&lt;p&gt;Quite a nice solution to this problem is hashing the passwords. The database stores no plain text passwords, but the result of some hash function.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;hashed_value&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;HASH_FUNCTION(password);&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The hash function is a one way function. This means that it&amp;rsquo;s very easy to calculate the hash value and it&amp;rsquo;s very hard to make the opposite calculation.&lt;/p&gt;
&lt;p&gt;In all kinds of tutorials and blog posts the mostly used hash function is, unfortunately still, &lt;code&gt;md5()&lt;/code&gt;. It returns 128 bit hash value. It means that there are only 2^128 possible values&amp;hellip; what is quite a huge number: &lt;code&gt;340,282,366,920,938,463,463,374,607,431,768,211,456&lt;/code&gt;. The md5 algorithm contains some flaws and currently is not so secure. In fact it never was meant to be secure.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>The Power of Community</title>
      <link>https://www.simononsoftware.com/the-power-of-community/</link>
      <pubDate>Sun, 08 Aug 2010 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/the-power-of-community/</guid>
      <description>&lt;p&gt;A very interesting keynote from RailsConf 2010 given by Robert Martin. The conference was named &lt;code&gt;RAILS Conf&lt;/code&gt; but the keynote is not only about Rails or Ruby. It is about the community.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>MySQL SQL Mode Fun</title>
      <link>https://www.simononsoftware.com/mysql-sql-mode-fun/</link>
      <pubDate>Thu, 24 Jun 2010 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/mysql-sql-mode-fun/</guid>
      <description>&lt;p&gt;While looking for some information on the web, I found quite a &lt;a href=&#34;http://code.openark.org/blog/mysql/sql-forcing-single-row-tables-integrity&#34;&gt;nice piece of SQL&lt;/a&gt;, something like:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;-- Session scope for the purpose of this article
&lt;/span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;SET&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;sql_mode&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#39;STRICT_ALL_TABLES&amp;#39;&lt;/span&gt;;&lt;span style=&#34;color:#bbb&#34;&gt; 
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This sql_mode looked quite interesting. I&amp;rsquo;ve checked that in the &lt;a href=&#34;http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html&#34;&gt;MySQL documentation&lt;/a&gt; and well&amp;hellip; it is a little bit terrifying.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Naming Convention aka PHP vs Python</title>
      <link>https://www.simononsoftware.com/naming-convention-aka-php-vs-python/</link>
      <pubDate>Fri, 04 Jun 2010 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/naming-convention-aka-php-vs-python/</guid>
      <description>&lt;p&gt;The naming convention. It&amp;rsquo;s obviously better to have any than none. As I was writing, I noticed that the title doesn&amp;rsquo;t reflect what I wrote. All turned out to be not about convention, but about comparing PHP to Python. Personally none of the languages is my favorite.&lt;/p&gt;
&lt;p&gt;After reading the whole post, I realized that Python is not better than PHP, it is messed the same way, so why bother changing from PHP to Python?&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Indentation Checking in Ruby</title>
      <link>https://www.simononsoftware.com/indentation-checking-in-ruby/</link>
      <pubDate>Sun, 23 May 2010 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/indentation-checking-in-ruby/</guid>
      <description>&lt;p&gt;In Python blocks have to be indented just because the indentation level defines the logic. In C/C++/Java there are &lt;code&gt;{&lt;/code&gt; and &lt;code&gt;}&lt;/code&gt; while in Ruby there is &lt;code&gt;begin&lt;/code&gt; and &lt;code&gt;end&lt;/code&gt;. Of course indenting is helpful. Just like syntax coloring in editor.&lt;/p&gt;
&lt;p&gt;In Ruby you can do whatever you want with the indentation. That&amp;rsquo;s not a problem. Every good editor can fix the code layout due to some rules. Normally I use VIM for all those scripting languages, for programming in Ruby and Python too. In VIM after opening any file I can do the magic command:&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Oh, Those Terrible Units</title>
      <link>https://www.simononsoftware.com/oh-those-terrible-units/</link>
      <pubDate>Thu, 06 May 2010 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/oh-those-terrible-units/</guid>
      <description>&lt;p&gt;﻿There are some numbers and units. Numbers are numbers. Units are units. Numbers informs how many. Units inform about two things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;how many&lt;/li&gt;
&lt;li&gt;of what&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Unfortunately it seems like most programmers just don&amp;rsquo;t care about all that stuff.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Virtualenv Tutorial</title>
      <link>https://www.simononsoftware.com/virtualenv-tutorial/</link>
      <pubDate>Fri, 30 Apr 2010 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/virtualenv-tutorial/</guid>
      <description>&lt;p&gt;Here is a &lt;a href=&#34;https://www.simononsoftware.com/virtualenv-tutorial-part-2/&#34;&gt;newer version of this virtualenv tutorial.&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;what-virtualenv-is&#34;&gt;What Virtualenv Is&lt;/h2&gt;
&lt;p&gt;Virtualenv is a great piece of software. It allows to create virtual environments. Each of them can have a different version of Python and different sets of libraries.&lt;/p&gt;
&lt;p&gt;While creating this tutorial I used following tools and versions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;virtualenv - 1.4.8&lt;/li&gt;
&lt;li&gt;Python - 2.6.5&lt;/li&gt;
&lt;li&gt;Ubuntu 10.04 64 bit&lt;/li&gt;
&lt;li&gt;All console programs run with UTF-8&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;do-i-need-a-virtual-environment&#34;&gt;Do I Need a Virtual Environment?&lt;/h2&gt;
&lt;p&gt;As usually: it depends. Normally you can create and use Python
programs without that, but using virtual environments can help a lot.&lt;/p&gt;
&lt;p&gt;Such a virtual environment provides many possibilities such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;On production servers it allows to run applications created for
different Python versions.&lt;/li&gt;
&lt;li&gt;On testing servers it allows to perform many tests including:
&lt;ul&gt;
&lt;li&gt;Testing the installer script if that really installs all
necessary libraries with checking their versions.&lt;/li&gt;
&lt;li&gt;Testing applications using different set of libraries.&lt;/li&gt;
&lt;li&gt;Checking if upgrade of a library won&amp;rsquo;t cause errors.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;</description>
    </item>

    

    <item>
      <title>Testing Database - Small Reply</title>
      <link>https://www.simononsoftware.com/testing-database-small-reply/</link>
      <pubDate>Fri, 02 Apr 2010 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/testing-database-small-reply/</guid>
      <description>&lt;p&gt;I found this on the &lt;a href=&#34;http://blogs.perl.org/users/ovid/2010/01/testing-postgresql.html&#34;&gt;Ovid&amp;rsquo;s blog&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;First of all: this is quite a nice writing of something called &lt;code&gt;the modern perl&lt;/code&gt;. Everybody who shouts that perl is a piece of shit should read it. YES, you can write a nice looking code in perl. Code that is maintainable, and is easy to read. And is objective (a kind of somewhat different langauge syntax but who cares. Each language is different and has different class definitions - consider Ada, Perl, C++ and Python).&lt;/p&gt;
&lt;p&gt;Some ideas about the testing solution. Of course this is PostgreSQL :).&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>How to Allow For Max 4 Rows in Update (PostgreSQL)</title>
      <link>https://www.simononsoftware.com/how-to-allow-for-max-4-rows-in-update-postgresql/</link>
      <pubDate>Thu, 01 Apr 2010 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/how-to-allow-for-max-4-rows-in-update-postgresql/</guid>
      <description>&lt;p&gt;A question found on the net:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;how to restrict users to update only max 4 rows of a table in a transaction.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This looks like a solution to some artificial problem that doesn&amp;rsquo;t exist, but nevermind, any task should be solved.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>PostgreSQL Strange Timings</title>
      <link>https://www.simononsoftware.com/postgresql-strange-timings/</link>
      <pubDate>Sun, 21 Mar 2010 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/postgresql-strange-timings/</guid>
      <description>&lt;p&gt;A very simple query. PostgreSQL 8.4. I have no idea why the simple query
is 7 times faster than the &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; version. Any ideas? Anyone?&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;COUNT&lt;/span&gt;(&lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;),&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;xtype&lt;span style=&#34;color:#bbb&#34;&gt; 
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;test&lt;span style=&#34;color:#bbb&#34;&gt; 
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;GROUP&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;BY&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;xtype&lt;span style=&#34;color:#bbb&#34;&gt; 
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;ORDER&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;BY&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;xtype;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;count&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;|&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;xtype&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;---------+-------
&lt;/span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;669000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;|&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;A&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;       &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;84000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;|&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;B&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;       &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;63000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;|&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;D&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;       &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;15000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;|&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;E&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;159000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;|&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;G&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;     &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;7866000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;|&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;H&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;     &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1000000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;|&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;N&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;144000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;|&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;NI&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;(&lt;span style=&#34;color:#666&#34;&gt;8&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rows&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;Time:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;3366&lt;/span&gt;,&lt;span style=&#34;color:#666&#34;&gt;822&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;ms&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;explain&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;analyze&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; 
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;SELECT&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;COUNT&lt;/span&gt;(&lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;),&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;xtype&lt;span style=&#34;color:#bbb&#34;&gt; 
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;FROM&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;test&lt;span style=&#34;color:#bbb&#34;&gt; 
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;GROUP&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;BY&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;xtype&lt;span style=&#34;color:#bbb&#34;&gt; 
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;ORDER&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;BY&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;xtype;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;                                                               &lt;/span&gt;QUERY&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;PLAN&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;---------------------------------------------------------------------------------------------------------------------------------
&lt;/span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;     &lt;/span&gt;Sort&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;(cost&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;243136&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;22&lt;/span&gt;..&lt;span style=&#34;color:#666&#34;&gt;243136&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;24&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rows&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;8&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;width&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;2&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;(actual&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;time&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;24544&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;883&lt;/span&gt;..&lt;span style=&#34;color:#666&#34;&gt;24544&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;889&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rows&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;8&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;loops&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;       &lt;/span&gt;Sort&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;Key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;xtype&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;       &lt;/span&gt;Sort&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;Method&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;quicksort&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;Memory:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;25&lt;/span&gt;kB&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;       &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;HashAggregate&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;(cost&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;243136&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;00&lt;/span&gt;..&lt;span style=&#34;color:#666&#34;&gt;243136&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;10&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rows&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;8&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;width&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;2&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;(actual&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;time&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;24544&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;838&lt;/span&gt;..&lt;span style=&#34;color:#666&#34;&gt;24544&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;848&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rows&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;8&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;loops&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;             &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;Seq&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Scan&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;on&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;test&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;(cost&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;00&lt;/span&gt;..&lt;span style=&#34;color:#666&#34;&gt;193136&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;00&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rows&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;10000000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;width&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;2&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;(actual&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;time&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;012&lt;/span&gt;..&lt;span style=&#34;color:#666&#34;&gt;11501&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;738&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rows&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;10000000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;loops&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;     &lt;/span&gt;Total&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;runtime:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;24544&lt;/span&gt;.&lt;span style=&#34;color:#666&#34;&gt;980&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;ms&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;(&lt;span style=&#34;color:#666&#34;&gt;6&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rows&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>

    

    <item>
      <title>Why Use ORMs?</title>
      <link>https://www.simononsoftware.com/why-use-orms/</link>
      <pubDate>Thu, 25 Feb 2010 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/why-use-orms/</guid>
      <description>&lt;p&gt;ORM aka Object Relational Mapping is quite a crappy way of converting a relational database model into an object model. Usually this means that there is a class for each database table.&lt;/p&gt;
&lt;p&gt;Many people say that ORMs are the best human idea since the sliced bread. I mention some of their arguments below.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>How to Load SQL File to Database</title>
      <link>https://www.simononsoftware.com/how-to-load-sql-file-to-database/</link>
      <pubDate>Sat, 20 Feb 2010 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/how-to-load-sql-file-to-database/</guid>
      <description>It would be nice to have the possibility of loading an sql file to database using a normal database api. OK, let&amp;rsquo;s define what the &amp;lsquo;normal api&amp;rsquo; is. This should be a full featured api for connecting to database and performing queries, with many drivers available. My favorite ones are: JDBC and DBI (yes, the one from Perl). Unfortunately Python doesn&amp;rsquo;t have any. Python&amp;rsquo;s DBAPI 2.0 is a kind of joke, not API.</description>
    </item>

    

    <item>
      <title>Are SQL Database Joins So Bad?</title>
      <link>https://www.simononsoftware.com/are-sql-database-joins-so-bad/</link>
      <pubDate>Thu, 12 Nov 2009 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/are-sql-database-joins-so-bad/</guid>
      <description>&lt;p&gt;Last time on many forums there were endless discussions about database joins. All about how they are bad, very inefficient,  and terrible and the best is to avoid them. Generally that&amp;rsquo;s not true and I&amp;rsquo;ll try to show this here (taking some small 10 million records tables as on one forum was suggested).&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Why Ruby on Rails Migrations Don&#39;t Work</title>
      <link>https://www.simononsoftware.com/why-ruby-on-rails-migrations-dont-work/</link>
      <pubDate>Mon, 05 Oct 2009 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/why-ruby-on-rails-migrations-dont-work/</guid>
      <description>&lt;p&gt;Migrations in Ruby on Rails provide some nice faetures for manipulating database structure. It is used mainly for two reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;this is a nice way of keeping database structure changes&lt;/li&gt;
&lt;li&gt;you don&amp;rsquo;t need to know SQL&lt;/li&gt;
&lt;li&gt;the generated SQL code can be used for many database engines&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The first point is OK (this is a must, you really should keep such a track of database changes). The second would be nice&amp;hellip; but that simply doesn&amp;rsquo;t work. I don&amp;rsquo;t think that not knowing SQL is such a huge advantage.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Why many programmers think that it&amp;rsquo;s a virtue that they don&amp;rsquo;t know something?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Knowing SQL is really a need when you write some database software using relational databases.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>The Worst Database Design</title>
      <link>https://www.simononsoftware.com/the-worst-database-design/</link>
      <pubDate>Tue, 25 Aug 2009 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/the-worst-database-design/</guid>
      <description>&lt;p&gt;In this blog post I will describe the worst database design I have ever seen in a production database.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s create tables like these:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;CREATE&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;TABLE&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;A&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;(&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;ID&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;PRIMARY&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;KEY&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;);&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;CREATE&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;TABLE&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;B&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;(&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;ID&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;PRIMARY&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;KEY&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;);&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The whole idea is that (due to some reasons that I don&amp;rsquo;t remember) there is a one-to-one relation between those two tables. It means that &lt;code&gt;A.id = B.id&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The one-to-one relation is not quite normal and generally should be avoided. Avoided means only: &amp;ldquo;don&amp;rsquo;t do that unless you know what you&amp;rsquo;re doing&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;The first table looked like this:&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>PostgreSQL Collation - 8.4</title>
      <link>https://www.simononsoftware.com/postgresql-collation-8-4/</link>
      <pubDate>Wed, 15 Jul 2009 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/postgresql-collation-8-4/</guid>
      <description>&lt;p&gt;In the last PostgreSQL version (8.4) there is a small change for the problem with collation. The collation can be set per database, not per cluster. This means that using only one PostgreSQL instance it is possible to have many databases with different language settings.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>How To Check PostgreSQL Privileges</title>
      <link>https://www.simononsoftware.com/how-to-check-postgresql-privileges/</link>
      <pubDate>Mon, 13 Jul 2009 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/how-to-check-postgresql-privileges/</guid>
      <description>&lt;p&gt;Someone asked me recently how to list all tables that a given user can select from. The problem they had was that they had a special user used by a client, so the client can make its own sql queries. However due to the security policy, that user can only perform &lt;code&gt;SELECT&lt;/code&gt; queries and only from some tables.&lt;/p&gt;
&lt;p&gt;They wanted to give the client a list of tables which can be selected.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>PostgreSQL FOUND Problem</title>
      <link>https://www.simononsoftware.com/postgresql-found-problem/</link>
      <pubDate>Mon, 06 Jul 2009 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/postgresql-found-problem/</guid>
      <description>&lt;p&gt;&lt;code&gt;FOUND&lt;/code&gt; is a global variable which exists in the plpgsql procedural language used in the PostgreSQL database. Last time I was writing some complicated procedures for moving many records to archive schema, just for having only the fresh data the main schema so it would be faster. During that I noticed a very strange error which suddenly turned out just to be a stupid mistake.&lt;/p&gt;
&lt;p&gt;The manual says that:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A SELECT INTO statement sets FOUND true if a row is assigned, false if
no row is returned.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So I used it&amp;hellip; that way, but not with a simple query, I used &lt;code&gt;EXECUTE&lt;/code&gt; for some custom string created by some arguments concatenation.&lt;/p&gt;
&lt;p&gt;Here is a very simple test sql showing the problem:&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Why There is No Big Database</title>
      <link>https://www.simononsoftware.com/why-there-is-no-big-database/</link>
      <pubDate>Sun, 05 Jul 2009 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/why-there-is-no-big-database/</guid>
      <description>&lt;p&gt;Usually I hear something like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;Help me, my database is so slow because it is so big&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&amp;ldquo;What size?&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&amp;ldquo;Well&amp;hellip; about 1,000 rows&amp;rdquo;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That usually makes me laugh. Adding some indices and convincing programmers not to get all rows with every select usually helps. Suddenly it turns out the database is not so big.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>What MySQL Execution Plan Depends On - part 2</title>
      <link>https://www.simononsoftware.com/mysql-execution-plan-depends-part-2/</link>
      <pubDate>Wed, 14 Jan 2009 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/mysql-execution-plan-depends-part-2/</guid>
      <description>Another funny article about the way that MySQL prepares the execution plan and why it depends on used storage engine.</description>
    </item>

    

    <item>
      <title>What MySQL Execution Plan Depends On</title>
      <link>https://www.simononsoftware.com/what-mysql-execution-plan-depends-on/</link>
      <pubDate>Fri, 09 Jan 2009 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/what-mysql-execution-plan-depends-on/</guid>
      <description>The execution plan is the way that a database executes query. It usually depends on many things like the presence of indices, data stored in table, amount of the returned data and so on.
I&amp;rsquo;ve already found that on MySQL it depends on something more. On the kind of storage engine being used.
More you can find here.</description>
    </item>

    

    <item>
      <title>Problem with resume and TeX</title>
      <link>https://www.simononsoftware.com/problem-with-resume-and-tex/</link>
      <pubDate>Tue, 21 Oct 2008 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/problem-with-resume-and-tex/</guid>
      <description>&lt;p&gt;Well, I like TeX. I really like TeX. Especially LaTeX, however &lt;a href=&#34;http://wiki.contextgarden.net/Main_Page&#34;&gt;ConTeXt&lt;/a&gt; looks much nicer. I use this to write some documents, last week I rewrote my resume to look a little bit nicer. I used Kile and LaTeX and converted it to a pdf. So now I&amp;rsquo;ve got a nice resume and some letters to some companies written in LaTeX. I&amp;rsquo;ve got them in some strange(?) formats like dvi or pdf.&lt;/p&gt;
&lt;p&gt;I thought that there wouldn&amp;rsquo;t be any problems with this.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>Quite A Nice RFC</title>
      <link>https://www.simononsoftware.com/quite-nice-rfc/</link>
      <pubDate>Sun, 19 Oct 2008 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/quite-nice-rfc/</guid>
      <description>&lt;blockquote&gt;
&lt;pre&gt;&lt;code&gt;                        ARPAWOCKY

               Twas brillig, and the Protocols
                    Did USER-SERVER in the wabe.
               All mimsey was the FTP,
                    And the RJE outgrabe,

               Beware the ARPANET, my son;
                    The bits that byte, the heads that scratch;
               Beware the NCP, and shun
                    the frumious system patch,

               He took his coding pad in hand;
                    Long time the Echo-plex he sought.
               When his HOST-to-IMP began to limp
                    he stood a while in thought,

               And while he stood, in uffish thought,
                    The ARPANET, with IMPish bent,
               Sent packets through conditioned lines,
                    And checked them as they went,

               One-two, one-two, and through and through
                    The IMP-to-IMP went ACK and NACK,
               When the RFNM came, he said &amp;quot;I&#39;m game&amp;quot;,
                    And sent the answer back,

               Then hast thou joined the ARPANET?
                    Oh come to me, my bankrupt boy!
               Quick, call the NIC! Send RFCs!
                    He chortled in his joy.

               Twas brillig, and the Protocols
                    Did USER-SERVER in the wabe.
               All mimsey was the FTP,
                    And the RJE outgrabe.
                                                       D.L. COVILL
                                                          May 1973
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;!-- raw HTML omitted --&gt; &amp;ndash; &lt;!-- raw HTML omitted --&gt;rfc527&lt;!-- raw HTML omitted --&gt;&lt;!-- raw HTML omitted --&gt;&lt;/p&gt;
&lt;/blockquote&gt;</description>
    </item>

    

    <item>
      <title>Great Article on Architecture</title>
      <link>https://www.simononsoftware.com/great-article-on-architecture/</link>
      <pubDate>Mon, 13 Oct 2008 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/great-article-on-architecture/</guid>
      <description>&lt;p&gt;This should be read by almost all architects that I know. They cannot live without their tools. Sometimes during job interviews they keep on asking me not about knowledge, but about knowing one particular program for diagram writing.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>PostgreSQL Collation - part 2</title>
      <link>https://www.simononsoftware.com/postgresql-collation-2/</link>
      <pubDate>Sat, 11 Oct 2008 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/postgresql-collation-2/</guid>
      <description>&lt;p&gt;Due to many questions about the PostgreSQL collation that were asked after my last short article about that, I decided to write some more about the current collation situation in PostgreSQL.&lt;/p&gt;
&lt;h2 id=&#34;what-the-collation-is&#34;&gt;What The Collation Is&lt;/h2&gt;
&lt;p&gt;The collation setting is responsible for correct working functions such as&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>PostgreSQL Collation - part 1</title>
      <link>https://www.simononsoftware.com/postgresql-collation/</link>
      <pubDate>Thu, 02 Oct 2008 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/postgresql-collation/</guid>
      <description>&lt;p&gt;PostgreSQL is (IMHO) much better than MySQL but unfortunately it still lacks one of the greatest MySQL features: encoding.&lt;/p&gt;
&lt;h2 id=&#34;mysql-collation&#34;&gt;MySQL Collation&lt;/h2&gt;
&lt;p&gt;Locale settings in MySQL are great. You can have different collation set for each database, table and even column (the same as it is in Interbase/Firebird). This gives the opportunity to simplify the database structure.&lt;/p&gt;
&lt;p&gt;For example (I know, a very simplified example) when you have even a simple blog database and want to create a multilingual blog. Then it is enough to create one table for posts with two columns for body, each with different collation.&lt;/p&gt;</description>
    </item>

    

    <item>
      <title>What I Don&#39;t Like About Python</title>
      <link>https://www.simononsoftware.com/what-i-dont-like-about-python/</link>
      <pubDate>Fri, 26 Sep 2008 00:00:00 +0000</pubDate>
      
      <guid>https://www.simononsoftware.com/what-i-dont-like-about-python/</guid>
      <description>&lt;p&gt;Python is a dynamically typed language. It basically means that you don&amp;rsquo;t have to declare exact types while declaring a variable. A very good and a very bad thing. As usually, there isn&amp;rsquo;t anything just good or just bad.&lt;/p&gt;</description>
    </item>

    

  </channel>
</rss>