{"id":307,"date":"2009-03-04T13:11:10","date_gmt":"2009-03-04T12:11:10","guid":{"rendered":"http:\/\/bar-solutions.com\/wordpress\/?p=307"},"modified":"2009-03-04T13:11:10","modified_gmt":"2009-03-04T12:11:10","slug":"template-plug-in","status":"publish","type":"post","link":"https:\/\/blog.bar-solutions.com\/?p=307","title":{"rendered":"Template plug-in&hellip;"},"content":{"rendered":"<p><a title=\"Allround Automations\" href=\"http:\/\/www.allroundautomations.com\/plsqldev.html\" target=\"_blank\" rel=\"nofollow\"><img loading=\"lazy\" decoding=\"async\" title=\"icon-pls-s\" style=\"border-right: 0px; border-top: 0px; display: inline; margin-left: 0px; border-left: 0px; margin-right: 0px; border-bottom: 0px\" height=\"65\" alt=\"icon-pls-s\" src=\"http:\/\/bar-solutions.com\/wordpress\/wp-content\/iconplss1.gif\" width=\"50\" align=\"right\" border=\"0\" \/><\/a> A while ago I created a plug-in for <a title=\"Allround Automations\" href=\"http:\/\/www.allroundautomations.com\/plsqldev.html\" target=\"_blank\">PL\/SQL developer<\/a> that allowed me to type in a short code, press a <em>magic<\/em> key and have the short code replaced by the contents of my template. For instance, I type <strong>put<\/strong>, press <strong>CTRL-J<\/strong> and the code I typed in gets replaced by <strong>dbms_output.put_line();<\/strong>. That\u2019s a lot less keystrokes. Then problem with this plug-in was that it was not case sensitive. Typing put or PUT resulted in the same template being applied.<\/p>\n<p> <!--more-->  <\/p>\n<p>I wanted to make the template searched more flexible and dependant on the case of what is being typed. For instance ei (end if;) should be different from EI (END IF;) or Ei (End If;). The problem is however that the ini files used to store the templates are not case sensitive. So, I decided to add a hash value to the template code to make it unique, even to the ini file.<\/p>\n<p>I found an existing function <a title=\"Delphi tip#136: Elf hash algorithm\" href=\"http:\/\/www.scalabium.com\/faq\/dct0136.htm\" target=\"_blank\" rel=\"nofollow\">here<\/a> to hash a string to an integer which I use. This is used to add a hash value of the template to the code-value pair in the ini file. Since I have been using this plug-in&#160; myself for quite some time, I have some templates that I have grown accustom to. It would be a drag to recreate these templates so I decided to create an ini file converter to add the hash value to the existing entries<\/p>\n<p>The <a title=\"Template plug-in for PL\/SQL Developer\" href=\"http:\/\/bar-solutions.com\/software\/download\/mytools\/template.zip\" target=\"_blank\" rel=\"nofollow\">template plug-in<\/a> can be downloaded <a title=\"bar-solutions.com - Plug-ins\" href=\"http:\/\/bar-solutions.com\/software\/plug-ins.html#template\" target=\"_blank\" rel=\"nofollow\">from this page<\/a>. Here you can also find the converter, if you had an older version of the plug-in installed, you can also download the converter here.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A while ago I created a plug-in for PL\/SQL developer that allowed me to type in a short code, press a magic key and have the short code replaced by the contents of my template. For instance, I type put, press CTRL-J and the code I typed in gets replaced by dbms_output.put_line();. That\u2019s a lot [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,5,4],"tags":[],"class_list":["post-307","post","type-post","status-publish","format-standard","hentry","category-oracle","category-plsql","category-tools"],"_links":{"self":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts\/307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=307"}],"version-history":[{"count":0,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts\/307\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}