<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://blog.invenzzia.org/en/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
  <title>Invenzzia... in English</title>
  <link>http://blog.invenzzia.org/en/</link>
  <description></description>
  <language>en</language>
  <pubDate>Wed, 23 Jul 2008 08:35:04 +0100</pubDate>
  <copyright>Copyright &amp;copy; Invenzzia</copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>TypeFriendly 0.1.0 released</title>
    <link>http://blog.invenzzia.org/en/post/TypeFriendly-010-released</link>
    <guid isPermaLink="false">urn:md5:b75234195a2997b4de10c3707d8670eb</guid>
    <pubDate>Wed, 23 Jul 2008 10:34:00 +0200</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>TypeFriendly</category>
        <category>development</category><category>releases</category><category>typefriendly</category>    
    <description>    &lt;p&gt;At last, the translation of the manual into English is complete and the source code has been already released as the first version of TypeFriendly, the documentation generator. In is available in &lt;a href=&quot;http://www.invenzzia.org/en/files&quot; hreflang=&quot;en&quot;&gt;Files&lt;/a&gt; on the main site. The user manual is provided in the source form and it works also as an example, so please do not worry that something is missing. All the necessary information to build the HTML version can be found in &lt;code&gt;/info/README.txt&lt;/code&gt; file. All you need is to type one command in the system console. The on-line documentation will be available soon, as we are preparing new website. To get more information about TypeFriendly, take a look at the previous note.&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/TypeFriendly-010-released#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/TypeFriendly-010-released#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/32</wfw:commentRss>
      </item>
    
  <item>
    <title>TypeFriendly</title>
    <link>http://blog.invenzzia.org/en/post/TypeFriendly</link>
    <guid isPermaLink="false">urn:md5:a04db63a57fe76ccfd6f3a2a2c527918</guid>
    <pubDate>Wed, 02 Jul 2008 21:38:00 +0200</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>TypeFriendly</category>
        <category>development</category><category>documentation</category><category>typefriendly</category>    
    <description>&lt;p&gt;Together with eXtreme, we work hard to make the first release available as soon as possible and we are quite close now. This is a perfect opportunity to tell something more about this project, which should be appreciated by those programmers who write their own scripts and libraries and look for a smart tool to make a documentation. The idea to write TypeFriendly was born in my head after I failed to add some necessary things to the XSLT sheets for DocBook. The PHP manual shows, what could be done with it (syntax coloring, lots of different formats, enormous amount of tags), but don't become too happy too fast. To achieve similar effects, we need weeks of coding and we must also fight against the portability. In fact, I'd rather use those weeks to write something more useful and friendly.&lt;/p&gt;    &lt;p&gt;So, TypeFriendly is a documentation writing tool, but it works differently than for example phpDocumentor which scans the source code of your project and makes a reference list of all classes and functions. Here, we write all the chapters and put them in the required order on our own, like in DocBook. However, in this place the similarities end, because TF already contains everything we need. Moreover, it was designed to be intuitive and easy to learn.&lt;/p&gt;


&lt;p&gt;Features:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In TF, we write our manual in standard text files using the Markdown syntax. We can put some extra information with tags placed at the beginning of the file. They allow us to define a title, version information or &quot;See also&quot; section.&lt;/li&gt;
&lt;li&gt;TF automatically sorts our files and connects them into bigger chapters, basing on their file names. By default, all the content is sorted alphabetically, but we can easily change it for all the files we need. We just create an additional file with &quot;sorting hints&quot;, where we write the required order.&lt;/li&gt;
&lt;li&gt;There is a built-in syntax highlighting option.&lt;/li&gt;
&lt;li&gt;TF generates all the navigation and table of contents.&lt;/li&gt;
&lt;li&gt;TF is designed to create a multilingual documentation. Apart from storing many versions of the same file and interface texts, it contains a simple tool to detect whether the &quot;derived language versions&quot; are up-to-date.&lt;/li&gt;
&lt;li&gt;TF allows to generate the XHTML version very quickly, on a single page, as well as on many. We are also creating a special format for importing the manual to the database (to publish it online and for example, to add user comments).&lt;/li&gt;
&lt;li&gt;TF packs your manual by default in the nice, green layout.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Although there haven't been any release so far, you can always connect to our new SVN and download the code from there. The link to the &lt;em&gt;checkout&lt;/em&gt; commands is: &lt;em&gt;http://svn.invenzzia.org/svn/typefriendly/trunk/&lt;/em&gt; - we encourage you to test the script now. In the repository, there is a README file and a nearly finished Polish version of the TF manual. But don't worry. The first release will be available with the English version, too. It's much shorter than OPL manual, and nice to translate :).&lt;/p&gt;


&lt;p&gt;Now, I think it's a good idea to show an example. The first one would be one of the files from OPT template engine manual that we develop, too:&lt;/p&gt;

&lt;pre&gt;
Title: optNode class
ShortTitle: optNode
Status: abstract
Extends: library.optcodebuffer
ExtendedBy:
 - library.optscannable
 - library.optcharacterdata
 - library.optexpression

----
An abstract XML node class. It provides the basic support for the most important features, such as type and parent.

Class fields
------------
All the fields are protected.

 Name          | Type      | Description
---------------|-----------|---------------------------------------
 $type         | Integer   | Numerical type identifier
 $parent       | optNode   | Node parent

Available type identifiers:

1. `OPT_CDATA_NODE` - `optCharacterData`
2. `OPT_TEXT_NODE` - `optText`
3. `OPT_EXPRESSION_NODE` - `optExpression`
4. `OPT_ELEMENT_NODE` - `optElement`
5. `OPT_ROOT_NODE` - `optRoot`
&lt;/pre&gt;


&lt;p&gt;At the beginning, we have a header with tags. There we define the exact title, and in this case also the dependencies between the PHP classes. Notice that we refer to the other classes by writing the identifier of the chapter, where they are described. Of course, there are additional tag versions, where we can write the class names directly, for example if we inherit from some PHP built-in class. There are more available tags. Let's say we want to make a &quot;See also&quot; section:&lt;/p&gt;

&lt;pre&gt;
SeeAlso:
 - chapter.text1
 - chapter.text2
 - chapter.text3
&lt;/pre&gt;


&lt;p&gt;Once the tag list finishes, we begin the exact content in the &lt;a href=&quot;http://daringfireball.net/projects/markdown/&quot; hreflang=&quot;pl&quot;&gt;Markdown&lt;/a&gt; format. The author designed it basing on the formatting used in text files and e-mails (it can be said that he wrote a parser for a syntax that self-evolved :)). This means that the source text is really clean and easy to read. In fact, it is just a bit lesser comfortable than a parsed one. The problem is, if someone is accustomed to some wiki syntax, because MD not always works in this way (take a look at the table). But it is quite easy to switch. We use Markdown even on our website and I must say that it is a very convienient tool. I'm sure you'll find it in more Invenzzia products. There is only one big shortcoming - the only available output is XHTML. For now, you have to forget about LaTeX and the rest, but I can assure you that we plan to add it, too.&lt;/p&gt;


&lt;p&gt;The most frustrating problem while writing a manual is navigation. The links &quot;Previous&quot;, &quot;Next&quot;, &quot;Up&quot; are added by TypeFriendly, we create the &quot;See also&quot; section by adding a tag, but what about clickable function and class names? I thought about it a bit and I invended a brilliant and simple idea. We have an additional text file, where we define, what text points to what. For example, we write there that &lt;code&gt;`optClass::parse()`&lt;/code&gt; must always be a link to &lt;em&gt;library.optclass.parse&lt;/em&gt; and that's all. Unfortunately, we haven't hacked Markdown in this way so far and the first release will not contain it yet.&lt;/p&gt;


&lt;p&gt;TypeFriendly works in the operating system command line. We've tested it both on Linux and Windows and it works there without any problems. All we need is a PHP parser. Togethet with a simple syntax and built-in multilingual support, TF should encourage much more people to help in translations of your manuals, improving the base version and maybe even writing new outputs. Generating the XHTML version is really easy:&lt;/p&gt;

&lt;pre&gt;
php ./typefriendly.php -l en -o xhtml ./path/to/manual/
&lt;/pre&gt;


&lt;p&gt;Let's compare it to DocBook. The format itself is a bit longer, but relatively easy to learn. However, the conversion needs more tools. We must download the DTD, DocBook XSL Stylesheets and an XSTL parser. The choice is important, because fast and easy &lt;em&gt;xsltproc&lt;/em&gt; will not highlight your syntax in the examples. On the other hand, the Windows users are f@#$ off if the author decides to write half of the processing tools in Bash. We don't have to look such examples too far. Just take a look at the PHP manual. Guess, what is it written in? :)&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/TypeFriendly#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/TypeFriendly#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/30</wfw:commentRss>
      </item>
    
  <item>
    <title>SVN is active!</title>
    <link>http://blog.invenzzia.org/en/post/SVN-is-active</link>
    <guid isPermaLink="false">urn:md5:defb3746d6af59ed99c1ca8075b2d891</guid>
    <pubDate>Mon, 30 Jun 2008 08:10:00 +0200</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>Invenzzia</category>
        <category>development</category><category>svn</category>    
    <description>    &lt;p&gt;Unfortunately, the configuration of a version control system on our current server is not as simple as on Sourceforge.net. But now I found some time and ideas, how to make it work and finally... there it is, we have an SVN repository. It's available under the address http://svn.invenzzia.org/ - we still have to install a good browser. Today I'm going to upload the source code of the new OPL and TypeFriendly, a documentation generator almost ready to its first release. All the instructions, how to connect, will be published on the main site.&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/SVN-is-active#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/SVN-is-active#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/28</wfw:commentRss>
      </item>
    
  <item>
    <title>OPT requirements</title>
    <link>http://blog.invenzzia.org/en/post/OPT-requirements</link>
    <guid isPermaLink="false">urn:md5:8a825db4d71c176b511d8fd4cad97d53</guid>
    <pubDate>Sun, 06 Apr 2008 10:28:00 +0200</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>Open Power Template</category>
        <category>development</category><category>opt2</category><category>optimization</category>    
    <description>&lt;p&gt;I've found a new entry on the bugtracker recently. The author informed that he gets &quot;Nesting level too deep - recursive dependency&quot; error while running the development examples provided by the newest OPTv2 dev version. I looked at it deeper and found out that he lowered the default nesting level limit 4 times from 64 to just 16. Obviously, this is a quite drastic change and would affect not only OPT, but many other scripts as well. However, I think it is time to take a look at the OPT issues concerning the requirements, because several of them needs a deeper explaination.&lt;/p&gt;    &lt;p&gt;The optimizations implemented in OPT, mostly concern the main parser class and the compiler. The first one is the part that is loaded every time the script wants to use templates, so it must provide huge quality standards. There are no sophisticated algorithms, so the speed improvements are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;To minimize the size of the code.&lt;/li&gt;
&lt;li&gt;To minimize the amount of points that try to access the hard drive.&lt;/li&gt;
&lt;li&gt;To use the fastest elements of the language.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The point is this class must be as light as possible; I would even say: almost transparent for the script.&lt;/p&gt;


&lt;p&gt;The situation is quite different, when it comes to the compiler. It is loaded from time to time, so it can be big and splitted for more files (of course without exaggeration). The key role is played by the limits set in the PHP configuration, because in the pesimistic situations, the compiler runs out of resources to complete the task. Unfortunately, some of the new features cost a lot, and if the users wanted XML tag parsing, they must face the consequences: every such tag requires its own node object in the document tree and they need some preparation tasks to be done. My role is to minimize the time and memory necessary to do this.&lt;/p&gt;


&lt;p&gt;The elements that can be exhausted during the compilation are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The stack&lt;/li&gt;
&lt;li&gt;The memory&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The algorithms used in the compiler operate on a data structure called tree, and the use lots of recursion. It consumes the stack, because the number of currently executed methods and functions grows quite fast. In PHP, the default limit for the stack depth is 64 and if you are going to use OPT, the worst you can do is to lower it to ridiculous values like &quot;16&quot; that would affect not only OPT, but also many other scripts :). However, every recursion has an imperative version, constructed for example by queues. Maybe it does not consume less memory, but at least it does not depend on the limits. Such changes have been applied to many compiler methods so far, but some of them still require my attention, because they are not so trivial:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Processing the tree by the instruction processors&lt;/li&gt;
&lt;li&gt;Expression compilation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the first one the situation is clear: we get a node of some instruction and want to process it. We find its processor and redirect the node to it. It generates some PHP code and decides, what to do with its children. By default, it wants to process them, too. Here comes the recursion and the process starts from the beginning. There are some difficulties. The algorithm is split over many classes, and the programmers may create their own. What is more, some instructions need to start the subnode processing immediately, because their next decision depends on the code generated by the children. Obviously, this eliminates queues. An elegant replacement could be made, if we had an access to the low level programming.&lt;/p&gt;


&lt;p&gt;Let's take a look, how it affects the compilation process. We have a huge template, with the tags nested up to the level 30. OPT with the compiler can take another 10 calls, and in the deepest place we have a complicated expression with brackets. To sum up, the library uses approx. 45 calls from 64 available, which is more than 70% of the limit! I know this case is quite pesimistic and in normal life such HTML documents are very rare, but it shows, how demanding the compilation can be.&lt;/p&gt;


&lt;p&gt;If we can't remove the recursion without ugly tricks which would be never accepted by the instruction authors, how we can get around it? The idea is not to remove recursion completely, but we keep it in some places. I use here the fact that the immediate access to the subnode compilation results is necessary only for some instructions, and for example the HTML tags do not need it at all. If we get a random node from the tree, we have a big chance that it would not need a recursion here. So, why don't we provide a dual version of this algorithm? By default, it is executed with a queue, but for more sophisticated needs, some nodes can switch it to recursion. Now it can happen that a tree with a depth 30 is processed in one single loop, with no recursion! I predict that in normal situations, the algorithm will consume only 3, 4 spare &quot;items&quot; in the stack, which is fully acceptable.&lt;/p&gt;


&lt;p&gt;The second issue concerns the memory usage. It's not so tragic here, but we can notice a significant rise when compared to the OPT 1.x compiler, even with using some patents from that version. The most memory is consumed by the tree. I've measured some single nodes recently and the results were from 2 kilobytes for a single node to 3 kilobytes for a node with one attribute. When the instructions start to add the PHP code to the buffers, the things are getting worse, but it happens only in some nodes in the whole template. We can safe some memory here. The objects use various arrays, which are initialized just in the beginning, for example:&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;abstract class optScannable extends optNode implements Iterator
{
	protected $subnodes = array();
&lt;/pre&gt;


&lt;p&gt;In most of the nodes, the arrays are empty, so it it no sense for them to exist all the time. I fixed the code so that it creates an array only when it is necessary. From the declarations, the &lt;code&gt;= array()&lt;/code&gt; parts were removed. The effect is quite interesting. On a single array, we safe 400 bytes. The new results are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Single node with no attributes: 1400 b.&lt;/li&gt;
&lt;li&gt;Single node with one attribute: 2350 b.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The additional memory may be safed by releasing the huge data that will not be used anymore, for example the template content.&lt;/p&gt;


&lt;p&gt;What do we have to remember, while using the new OPT, when it comes to the requirement issues:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;With the terribly low limits, the compiler will always crash. I thing 16 megabytes for the script (the default limit) is big enough both for the compiler and the script.&lt;/li&gt;
&lt;li&gt;The best place to run the template parsing is the end of the script. We can delete some unncessary data earlier to free some memory.&lt;/li&gt;
&lt;li&gt;The templates using the inheritance are more demanding, especially when overwriting snippets, because the compiler must keep also the old versions in the memory.&lt;/li&gt;
&lt;li&gt;The quirks mode will consume less memory (simpler tree - no XML tags), but it is not implemented yet.&lt;/li&gt;
&lt;li&gt;The compilation is run once for a long time. During the normal execution, we can forget about the limit issues etc.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I think this note shows, how difficult the library creation can be. The key is to know, what we can use in current place and that there is also the rest of the script which uses the same memory and has its own requirements.&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/OPT-requirements#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/OPT-requirements#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/24</wfw:commentRss>
      </item>
    
  <item>
    <title>OPT 2.0.0-dev5</title>
    <link>http://blog.invenzzia.org/en/post/OPT-200-dev5</link>
    <guid isPermaLink="false">urn:md5:33bdfac78deef21d193dfecd8a90f928</guid>
    <pubDate>Fri, 21 Mar 2008 14:38:00 +0100</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>Open Power Template</category>
        <category>components</category><category>development</category><category>opt2</category>    
    <description>&lt;p&gt;The new development version became available a bit later that I planned, but on the other hand, I managed to add much more new things. The DTD issue is solved, as well as XML prologs, CDATA support and code escaping. The expression compiler is done and the programmers may use now brand new component implementation. This is a significant step towards the first beta release and the end is closer than further. There are only a few instructions to code, the rest is almost completed and works. The compiler, programmers' API and most of the stuff also works. I think of making the first real tests on my home website and creating the Open Power Forms library compatible with the new OPT.&lt;/p&gt;    &lt;p&gt;In the new OPT, I've redesigned the component design from scratch. It is much more flexible now and allows to make easily many interesting effects. The base rules are still the same, but the rest has changed. This is a sample code showing, how the component-based work with the forms is going to look like:&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;xml&quot;&gt;&amp;lt;opt:snippet name=&amp;quot;componentView&amp;quot;&amp;gt;
  &amp;lt;com:div class=&amp;quot;field&amp;quot; invalid=&amp;quot;field error&amp;quot;&amp;gt;
    &amp;lt;p&amp;gt;{$opt.component.title}: &amp;lt;opt:display /&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p class=&amp;quot;desc&amp;quot; opt:if=&amp;quot;$opt.component.description&amp;quot;&amp;gt;{$opt.component.description}&amp;lt;/p&amp;gt;
    &amp;lt;opt:onEvent name=&amp;quot;error&amp;quot; message=&amp;quot;info&amp;quot;&amp;gt;
      &amp;lt;p class=&amp;quot;error&amp;quot;&amp;gt;{@info}&amp;lt;/p&amp;gt;
    &amp;lt;/opt:onEvent&amp;gt;
  &amp;lt;/com:div&amp;gt;
&amp;lt;/opt:snippet&amp;gt;

&amp;lt;div class=&amp;quot;form&amp;quot;&amp;gt;
&amp;lt;form method=&amp;quot;post&amp;quot; action=&amp;quot;skrypt.php&amp;quot;&amp;gt;

&amp;lt;opt:input name=&amp;quot;name&amp;quot; template=&amp;quot;componentView&amp;quot;&amp;gt;
   &amp;lt;opt:set name=&amp;quot;title&amp;quot; str:value=&amp;quot;Enter your name&amp;quot; /&amp;gt;
   &amp;lt;opt:set name=&amp;quot;description&amp;quot; str:value=&amp;quot;At least 3 letters&amp;quot; /&amp;gt;
&amp;lt;/opt:input&amp;gt;

&amp;lt;opt:input name=&amp;quot;surname&amp;quot; template=&amp;quot;componentView&amp;quot;&amp;gt;
   &amp;lt;opt:set name=&amp;quot;title&amp;quot; str:value=&amp;quot;Enter your surname&amp;quot; /&amp;gt;
   &amp;lt;opt:set name=&amp;quot;description&amp;quot; str:value=&amp;quot;At least 3 letters&amp;quot; /&amp;gt;
&amp;lt;/opt:input&amp;gt;

&amp;lt;opt:input name=&amp;quot;age&amp;quot; template=&amp;quot;componentView&amp;quot;&amp;gt;
   &amp;lt;opt:set name=&amp;quot;title&amp;quot; str:value=&amp;quot;Enter your age&amp;quot; /&amp;gt;
   &amp;lt;opt:set name=&amp;quot;description&amp;quot; str:value=&amp;quot;Scope: 10-99 years&amp;quot; /&amp;gt;
&amp;lt;/opt:input&amp;gt;

&amp;lt;div class=&amp;quot;foot&amp;quot;&amp;gt;&amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;Send&amp;quot; /&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;


&lt;p&gt;The new implementation makes use of the &lt;code&gt;opt:snippet&lt;/code&gt; instruction and template inheritance. If you had enough time, you might code the component objects, so that the field titles and descriptions will be unnecessary in the template. A component can handle events, displaying itself and its neighbourhood, managing parameters and tag attributes (we use the &lt;code&gt;com&lt;/code&gt; namespace for it). OPT contains only the component mechanism, and the components itself must be written by the end user. The reason is very simple. In order to make a useful component, we should integrate it with the input validation classes, language system, error management etc. The demands are much bigger than OPT is able and is supposed to provide. However, there will be a ready-to-use component implementation: Open Power Forms library.&lt;/p&gt;


&lt;p&gt;Unfortunately for the English manual is not started yet. Even the Polish users must use a partially-complete text, without formatting, because the new rendering system is not ready. However, we'll do everything to translate all the text together with some other materials (advices, FAQ, maybe even a tutorial?) into English, before the first final release is done. There is a team, I'll try also to ask some friends and we'll make a serious English support. Just be patient.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.invenzzia.org/download/opt-2.0.0-dev5.tar.gz&quot; hreflang=&quot;en&quot;&gt;Download OPT-2.0.0-dev5&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/OPT-200-dev5#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/OPT-200-dev5#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/21</wfw:commentRss>
      </item>
    
  <item>
    <title>OPT 2.0.0-dev4</title>
    <link>http://blog.invenzzia.org/en/post/OPT-200-dev4</link>
    <guid isPermaLink="false">urn:md5:53f051a3804ea8fd52e637f321aaa683</guid>
    <pubDate>Sun, 02 Mar 2008 11:28:00 +0100</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>Open Power Template</category>
        <category>OPT2</category>    
    <description>&lt;p&gt;There is a new Open Power Template development version available to download. The project begins to gel, as the main parser class is almost completed. Inspite of the output cache system mentioned earlier, I've implemented new instructions and completed the snippets. It means that all the template inheritance should work now. I hope the library will be usable by the end of this month. The real projects are really necessary to detect possible bugs and various shortcomings.&lt;/p&gt;    &lt;p&gt;In snippets, we have a new possibility to insert the parent content using the &lt;code&gt;opt:parent&lt;/code&gt; tag:&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;xml&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;yes&amp;quot; ?&amp;gt;
&amp;lt;opt:extend file=&amp;quot;test_inherited_a.tpl&amp;quot;&amp;gt;
	&amp;lt;opt:snippet name=&amp;quot;header&amp;quot;&amp;gt;
		&amp;lt;h1&amp;gt;Webmaster Of Puppets&amp;lt;/h1&amp;gt;
		&amp;lt;p&amp;gt;Here is the parent content:&amp;lt;/p&amp;gt;
		&amp;lt;opt:parent/&amp;gt;
		&amp;lt;p&amp;gt;End of the parent content&amp;lt;/p&amp;gt;
	&amp;lt;/opt:snippet&amp;gt;
&amp;lt;/opt:extend&amp;gt;
&lt;/pre&gt;


&lt;p&gt;In this case, if the &lt;em&gt;test_inherited_a.tpl&lt;/em&gt; contains another snippet with the same name, its content will be put in the place of &lt;code&gt;opt:parent&lt;/code&gt;. Such nesting works much deeper. For example, let's say that snippet also uses this tag. OPT will try to locate another parent and so on. It is even possible to put the default content of the &lt;code&gt;opt:insert&lt;/code&gt; tag, which is used to place the snippets. The code contains also a simple code to detect the infinite recursion. If the parser finds it, it returns an exception and the programmer sees a nice, red error message :).&lt;/p&gt;


&lt;p&gt;During the using of the new OPT, the new debug console should be also useful. It has been extended, compared to the similar option in OPT 1.1.x. The most significant change is splitting the list of templates to the smaller ones which show different information:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Executed templates&lt;/li&gt;
&lt;li&gt;Currently compiled templates&lt;/li&gt;
&lt;li&gt;Templates read from cache.&lt;/li&gt;
&lt;li&gt;Inherited templates - it shows all the inheritance chains, as well, as the information whether they have been recompiled or not.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Moreover, the console displays all the warnings. They are no longer put onto the screen, but available only with the debug console or error messages, if we set the proper debug level.&lt;/p&gt;


&lt;p&gt;The performance issue also looks very good. The total size of &lt;em&gt;opt.class.php&lt;/em&gt; file is about 25 KB, compared to 32 KB in the OPT 1.1.x. Currently, its size influences the performance much, as PHP must load the parser and compile it to the internal bytecode. Of course, if we parse a lot of templates, it won't be so visible, however I'm quite pleased of the effect.&lt;/p&gt;


&lt;p&gt;The package can be downloaded from &lt;a href=&quot;http://www.invenzzia.org/download/opt-2.0.0-dev4.tar.gz&quot; hreflang=&quot;en&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/OPT-200-dev4#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/OPT-200-dev4#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/18</wfw:commentRss>
      </item>
    
  <item>
    <title>New Invenzzia.org</title>
    <link>http://blog.invenzzia.org/en/post/New-Invenzziaorg</link>
    <guid isPermaLink="false">urn:md5:1ff324d2a01a9840744c0a34b361ddbd</guid>
    <pubDate>Tue, 26 Feb 2008 17:20:00 +0100</pubDate>
    <dc:creator>eXtreme</dc:creator>
        <category>Invenzzia</category>
        <category>invenzzia</category><category>website</category>    
    <description>&lt;p&gt;One month ago we had no time to prepare a good website for our group so Zyx made something temporary. Today I present a better and more complex solution. The website has been updated with texts and articles about our team. We've got still a lot to do with organization but our website and devblog are almost finished.&lt;/p&gt;    &lt;p&gt;I installed and configured dotClear2 from scratch. Now, there is no problem with mixed Polish and English entries because I set up two independent miniblogs on one installation.  User language detection is now integrated to the website's system and it is based on cookies and browser settings. I made also nicer and more friendly theme.&lt;/p&gt;


&lt;p&gt;And why not Wordpress? I don't like it. There are no real and friendly templates (yes, I love sweet chaos with mixed PHP and HTML). So far, I had an unpleasant opportunity to create from scratch a template for Wordpress and it was a terrible experience. I have been working with dotClear2 earlier and it is very easy to configure everything and convert default theme to website's design. Moreover, it is a nice piece of OOP code in PHP5. ;-)&lt;/p&gt;


&lt;p&gt;Team Invenzzia hasn't got the official logo yet. This one on website is only a temporary solution.&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/New-Invenzziaorg#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/New-Invenzziaorg#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/16</wfw:commentRss>
      </item>
    
  <item>
    <title>The main class almost finished</title>
    <link>http://blog.invenzzia.org/en/post/The-main-class-almost-finished</link>
    <guid isPermaLink="false">urn:md5:a4135d6c62812ecd599e53cd4933d0d1</guid>
    <pubDate>Fri, 22 Feb 2008 08:59:00 +0100</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>Open Power Template</category>
        <category>OPT2</category>    
    <description>&lt;p&gt;The result of the latest works on the OPT source code is complete &lt;em&gt;opt.class.php&lt;/em&gt; file which contains (as some of the readers may know) the main parser class. I must admit that this file was more demanding that the compiler. In the second case we can afford with quite a lot. Just an idea for the algorithm and prediction if and how it will influence the rest of the code. In the case of the main class, we must pay attention to the performance. It must contain everything that is run permanently and it must be fast and small. But the number of features is getting bigger and bigger.&lt;/p&gt;    &lt;p&gt;The new development version will not be compatible with the previous ones when it comes to the programming interface. To implement the output cache system, I had to rebuild almost all of the output system. In the 1.x.x series, the concept of the output system did not exist. Either the result will be seen on the screen or put into a variable, it depended on the right method choice. There were some tricky connections which redirected everything to the right place, however it was not well designed and a bit messy. Well, such things simply must happen, if we start with keeping the similarities to Smarty, and I have to remind that in the very early times, it was one of the OPT goals. In OPTv2, there is a well-declared &lt;em&gt;ioptOutput&lt;/em&gt; interface allowing the programmer to code the output processing on his own. It is also used in the implementation of output cache system. How - it is explained below.&lt;/p&gt;


&lt;p&gt;So far, there have been two output systems: &lt;em&gt;optNetOutput&lt;/em&gt; sending everything on the screen and checking, how many templates we are going to send in the XML mode. The second one was &lt;em&gt;optReturnOutput&lt;/em&gt;, which returned the result. I added a possibility to decorate them with something else and I created &lt;em&gt;optCachedOutput&lt;/em&gt;. Its only goal is to process the cache. The features are the same as in the previous versions, but the usage is a bit different and unfortunately, the initialization is more complicated:&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;$cache = new optCachedOutput('./cache/'); // this is the cache, here we configure it
$tpl -&amp;gt; register(OPT_OUTPUT, 'my_cache', $cache);
$tpl -&amp;gt; decorate(OPT_OUT_SCREEN, 'my_cache');
$tpl -&amp;gt; decorate(OPT_OUT_RETURN, 'my_cache');

if(!$cache -&amp;gt; isCached('template.tpl', 'some_id'))
{
  // data generation
}

$cache -&amp;gt; setCache(5, 'some_id'); // turn the cache on for 5 seconds
$tpl -&amp;gt; parse('template.tpl', 'my_cache');
&lt;/pre&gt;


&lt;p&gt;I'll try to shorten it and make simpler the first lines of the code, because I don't like them, too. Moreover, I must check if I've made the decoration in the right way (according to the logic).&lt;/p&gt;


&lt;p&gt;The support for plugins is not fully completed yet. The only ready part is placed in &lt;em&gt;opt.class.php&lt;/em&gt; file. The rest is moved somewhere else, which should improve the performance. Like in OPT 1.1.3, there will be a possibility to set many plugin directories, but the parser will not require them to be writeable. There were thrown some files describing the content and allowing to include everything without scanning all the directory. As we know, the more includes, the less performance and some people can produce more plugins than all the files in my framework :). The new OPT will try to link all these files into one, mega-file containing everything we need. By the way, I'll have also a new algorithm for the OPT Toolset sequel, which will be used now for all the libraries, not only OPT.&lt;/p&gt;


&lt;p&gt;The last issue concerns the available function set for the templates. Stormfly has recently written on his blog that OPT 1.1.x it was quite senseless and in fact, he was right. I took a look, what Smarty offers and it turned out that it has some nice and useful functions. The first list looks like that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;em&gt;spacify&lt;/em&gt; - puts a string between every two neighbour characters in the text.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;indent&lt;/em&gt; - makes an indentation in the text.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;truncate&lt;/em&gt; - reduces the text to the specified length (allowing not to splitting the words)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;strip&lt;/em&gt; - reduces all the white character groups to a single character&lt;/li&gt;
&lt;li&gt;&lt;em&gt;capitalize&lt;/em&gt; - equivalent to ucfirst()&lt;/li&gt;
&lt;li&gt;&lt;em&gt;upper&lt;/em&gt; - equivalent to strtoupper()&lt;/li&gt;
&lt;li&gt;&lt;em&gt;lower&lt;/em&gt; - equivalent to strtolower()&lt;/li&gt;
&lt;li&gt;&lt;em&gt;countWords&lt;/em&gt; - equivalent to str_word_count()&lt;/li&gt;
&lt;li&gt;&lt;em&gt;countChars&lt;/em&gt; - equivalent to strlen()&lt;/li&gt;
&lt;li&gt;&lt;em&gt;money&lt;/em&gt; - equivalent to money_format(), but the settings can be written in the OPT configuration.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;number&lt;/em&gt; - equivalent to number_format(), but the settings can be written in the OPT configuration.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;wordWrap&lt;/em&gt; - equivalent to word_wrap()&lt;/li&gt;
&lt;li&gt;&lt;em&gt;replace&lt;/em&gt; - equivalent to str_replace()&lt;/li&gt;
&lt;li&gt;&lt;em&gt;regexReplace&lt;/em&gt; - equivalent to preg_replace(), but the parameter order is changed.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;date&lt;/em&gt; - equivalent to date() :)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;firstof&lt;/em&gt; - returns the first non-empty element from the specified ones.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;nl2br&lt;/em&gt; - equivalent to nl2br() :)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;array&lt;/em&gt; - creating arrays on the template side&lt;/li&gt;
&lt;li&gt;&lt;em&gt;build&lt;/em&gt; - it was called &quot;apply()&quot; in the previous versions, but I still don't know, whether I keep this name or not.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The set contains no escaping functions, because the compiler is able to put them on his own in most of the places. There will be a possibility to escape something manually, but it won't be done through functions. Anyway, the point is the compiler must know, what is escaped. Otherwise it may add additional function call and this would produce a complete mess on the screen.&lt;/p&gt;


&lt;p&gt;To sum up, I've written so much functionality that I haven't tested all of them yet. I don't know if something works, however I don't expect any revelations. Many of the algorithms are reimplementations of the same code from OPT 1.1.x.  The next dev version will be available in the nearest days.&lt;/p&gt;


&lt;p&gt;Some statistics for the end:&lt;/p&gt;


&lt;blockquote&gt;&lt;p&gt;- &lt;em&gt;opt.class.php&lt;/em&gt; - 24 KB and still growing. In OPT 1.1.x, this file was 8 KB bigger, but offered less functionality.&lt;br /&gt;
- &lt;em&gt;opt.compiler.php&lt;/em&gt; - 65 KB and still growing.&lt;br /&gt;
- &lt;em&gt;opt.instructions.php&lt;/em&gt; - 25 KB and still growing.&lt;/p&gt;&lt;/blockquote&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/The-main-class-almost-finished#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/The-main-class-almost-finished#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/14</wfw:commentRss>
      </item>
    
  <item>
    <title>OPT 2.0.0-dev3</title>
    <link>http://blog.invenzzia.org/en/post/OPT-200-dev3</link>
    <guid isPermaLink="false">urn:md5:9843f60585ccf157ee19a973402b4cd2</guid>
    <pubDate>Fri, 15 Feb 2008 13:26:00 +0100</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>Open Power Template</category>
        <category>OPT2</category>    
    <description>&lt;p&gt;According to the my announcement from the last week, the development versions are going to appear much faster than before. This is the first of such events. The third dev of OPT 2.0.0 is ready to download. This time, I've paid much attention to the attribute processing. They can do a lot of interesting things with the tags they've been added to. The earl implementation has been ready so far - there were even examples showing the &quot;opt:section&quot; working. But to satisfy both me and probably other programmers, I had to extend it.&lt;/p&gt;    &lt;p&gt;Here are some examples showing, what can be done now. Let's start from something simple. In OPT, we use curly brackets to put expressions into a text, like:&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;text text text {$block} text text text
&lt;/pre&gt;


&lt;p&gt;There is also &lt;code&gt;opt:put&lt;/code&gt; instruction, which does the same for the first time we see it:&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;text text text &amp;lt;opt:put value=&amp;quot;$block&amp;quot;/&amp;gt; text text text
&lt;/pre&gt;


&lt;p&gt;However, it is an instruction, not curly brackets. It means we can make some nice things with it using attributes. Let's say we want to display something like &quot;Value 1 / Value 2 / Value 3&quot;. We will use &lt;code&gt;opt:put&lt;/code&gt;, a section and a separator:&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;&amp;lt;p&amp;gt;&amp;lt;opt:put value=&amp;quot;$section.value&amp;quot; opt:section=&amp;quot;section&amp;quot; str:separator=&amp;quot; / &amp;quot;/&amp;gt;&amp;lt;/p&amp;gt;
&lt;/pre&gt;


&lt;p&gt;As we see, such section affects also the tag which it was linked to and we can put the values of section elements in the attributes. The separator accepts expressions by default, but if we don't like writing &lt;em&gt;separator=&quot;'something'&quot;&lt;/em&gt; (double, and then a single quote), we can just switch the namespace to &quot;str&quot;.&lt;/p&gt;


&lt;p&gt;The implementation of reversed quotes is also ready. Compared to the previous versions, they change their function. Now it is the programmer who can give them a meaning and program them to do what he wants. It can be done by writing a simple function and giving its name to the parser. A sample use is an elegant implementation of language system a'la gettext:&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;&amp;lt;p&amp;gt;{`Some useful information...`}&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;{`Author:`} {$author}&amp;lt;/p&amp;gt;
&lt;/pre&gt;


&lt;p&gt;This is the last of the changes. As we have an XML compiler, we need some special instructions that allow to manage the tree directly, for example by adding an attribute with a variable name. OPT is going to provide two instructions for this task: &lt;code&gt;opt:tag&lt;/code&gt; and &lt;code&gt;opt:attribute&lt;/code&gt;. The second one has been already added to the newest dev. We can use it to read the attribute name from the block:&lt;/p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;&amp;lt;div&amp;gt;
  &amp;lt;opt:attribute name=&amp;quot;$some_name&amp;quot; value=&amp;quot;$some_value&amp;quot;/&amp;gt;
  body...
&amp;lt;/div&amp;gt;
&lt;/pre&gt;


&lt;p&gt;This is not the end - connected with sections, we get a powerful tool to add a lot of new attributes:&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;&amp;lt;div&amp;gt;
  &amp;lt;opt:attribute name=&amp;quot;$attr.name&amp;quot; value=&amp;quot;$attr.value&amp;quot; opt:section=&amp;quot;attr&amp;quot;/&amp;gt;
  body...
&amp;lt;/div&amp;gt;
&lt;/pre&gt;


&lt;p&gt;If we send the following table to this template: &lt;code&gt;array(0 =&amp;gt; array('name' =&amp;gt; 'class', 'value' =&amp;gt; 'dude'), array('name' =&amp;gt; 'id', 'value' =&amp;gt; 'lol'))&lt;/code&gt;, the result will be:&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;&amp;lt;div class=&amp;quot;dude&amp;quot; id=&amp;quot;lol&amp;quot;&amp;gt;
  body...
&amp;lt;/div&amp;gt;
&lt;/pre&gt;


&lt;p&gt;Unfortunately, the English manual is not started yet, but it will be ready before the first stable release.&lt;/p&gt;


&lt;p&gt;Download: &lt;a href=&quot;http://blog.invenzzia.org/en/post/&quot; hreflang=&quot;en&quot;&gt;http://www.invenzzia.org/download/opt-2.0.0-dev3.tar.gz&lt;/a&gt;&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/OPT-200-dev3#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/OPT-200-dev3#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/11</wfw:commentRss>
      </item>
    
  <item>
    <title>New dev</title>
    <link>http://blog.invenzzia.org/en/post/New-dev</link>
    <guid isPermaLink="false">urn:md5:a5d8cceafecfd239ba372c9cd993b8be</guid>
    <pubDate>Sat, 09 Feb 2008 11:02:00 +0100</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>Open Power Template</category>
        <category>OPT2</category>    
    <description>&lt;p&gt;The website now has the &quot;Download&quot; page. In it, you can find a new development version of Open Power Template. It also contains a simple script &quot;docgen&quot; which we use for automated generation of the DocBook manuals. The new development versions should appear now much more often than before. In case of many new features, they might appear even every 2-3 days. The reason why this was impossible in the past was the time. The process was not automated and it takes a while to prepare such archive (for example - it takes a couple of hours to publish new OPT 1.x version on the Internet).&lt;/p&gt;    &lt;p&gt;The pack contains everything I've implemented for last month:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nearly completed sections.&lt;/li&gt;
&lt;li&gt;Separators.&lt;/li&gt;
&lt;li&gt;&quot;For&quot; and &quot;Foreach&quot; loops.&lt;/li&gt;
&lt;li&gt;Mostly completed template inheritance.&lt;/li&gt;
&lt;li&gt;HTTP header management.&lt;/li&gt;
&lt;li&gt;Partially completed prolog parser.&lt;/li&gt;
&lt;li&gt;Some fixes in the compiler.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &quot;/dev&quot; directory contains some scripts that are used to test the new features. There are also unit tests: a complete set to test the expression parser and a part of the API test. There will be also a one to process the instructions, however the whitespace characters cause many problems, when it comes to prepare the files. If we try to compare the generated content with the expected result, we have to watch out on every space or line break. Otherwise the test fails, so you must be very patient to write a simple, stupid test. But I think this issue will be solved. To work, the tests require &quot;phpUnit 3&quot; package available in PEAR.&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/New-dev#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/New-dev#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/10</wfw:commentRss>
      </item>
    
  <item>
    <title>Licensing</title>
    <link>http://blog.invenzzia.org/en/post/Licensing</link>
    <guid isPermaLink="false">urn:md5:39280a371ee5afaf4f202ac1b0afe944</guid>
    <pubDate>Thu, 07 Feb 2008 10:19:00 +0100</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>Invenzzia</category>
        <category>licensing</category>    
    <description>&lt;p&gt;From time to time, I return to the library licensing issue. Undoubtedly, the right choice of a license is quite significant for the project success or failure. Simple, permissive licenses are very easy to follow and use, but in my opinion, they are quite dangerous for the project itself and can lead to some abuses. On the other hand, we have a GNU LGPL license, which has been used by Open Power Template so far. It provides the correct protection of the code, however the linking with non-GPL software is quite complex and produces many questions. Let's take a look: we write the libraries for all the website programmers and authors of complete scripts, whether they are open-source or not.&lt;/p&gt;    &lt;p&gt;I decided to check, how much place the &quot;simple&quot; explaination of LGPL conditions to the  end user would take, especially if he is about to make a commercial use of his software. I added the new appendix to the documentation and began to write. The result was a two-screen-long list of explainations, why and how the website creators can use it, when the source code must be published etc. Of course, it is unacceptable. I don't like too complex constraints and my intention is not to force the others to follow them unless there is a significant reason.&lt;/p&gt;


&lt;p&gt;The reason why I chose LGPL, was to protect the library against changing it into a proprietary software. Such story happened to Wine project, distributed under the X11 (MIT) license. After a while, a proprietary versions appeared, whose creators did not wish to share their source code. Although one 150-KB library is not too valuable, I prefer to be calm and be sure, especially if the other project are going to appear. Unfortunately, there is no license that would suit to our needs:&lt;/p&gt;


&lt;blockquote&gt;&lt;p&gt;- Full right to link with open-source and proprietary software under the condition of retain/reproduce copyright information, and retain the license conditions in case of source code.&lt;br /&gt;
- Requirement to redistribute the code itself (intented to link with non-author's software) with the source code, and as a consequence, retaining the license.&lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;I think such license would be the best protector of end-user laws. By forbidding the redistribution of the library itself only in a binary form and/or witch changed license, he is sure that every OPT package found in the Internet can be used in the same way, as the original one. If he encounters a closed-source version, it means that it is adapted to this exact project and it is not indented to link with other scripts.&lt;/p&gt;


&lt;p&gt;The best candidate is one of the modified BSD licenses without the advertising clause. Unfortunately, I'll have to add the statement mentioned above on my own in English, and the legal language is not so easy. It will take some time and probably will require some help from the West. That's why the development versions of OPT will be still available under GNU LGPLv3 and the final release will be released under the terms of much easier license.&lt;/p&gt;


&lt;p&gt;Except that, I would also like to provide a paid versions of the libraries, inspite of using a liberal license. They would not be expensive - the price of $10-20 should be acceptable to everyone interested. The income would be used to keep the domains, servers and advertising, because it requires some money. The paid version would be the same, as the free one, when it comes to the source code, but it would include some add-ons. The ideas are:&lt;/p&gt;


&lt;blockquote&gt;&lt;p&gt;- Additional articles and tutorials.&lt;br /&gt;
- The right to include them into your documentation.&lt;br /&gt;
- Sample projects with well-documented source code.&lt;br /&gt;
- Earlier access to the new releases.&lt;br /&gt;
- Additional releases in case of finding any non-critical bug.&lt;br /&gt;
- The right to provide detailed information about your project on our website.&lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;Unfortunately for the international user, for some time it will be available only for Poland. The international service will require some extra preparations. However, I think the idea is good and everyone should be happy. We have the money to keep our website and resources alive, the customers, because they have some extra content and rights and the rest of the users too - in order to convince them, we will try to prepare new tutorials, FAQ-s etc.&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/Licensing#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/Licensing#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/7</wfw:commentRss>
      </item>
    
  <item>
    <title>Template inheritance</title>
    <link>http://blog.invenzzia.org/en/post/Template-inheritance</link>
    <guid isPermaLink="false">urn:md5:18f9793a8c4c1405788e24861aa04ef1</guid>
    <pubDate>Sat, 02 Feb 2008 17:03:00 +0100</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>Open Power Template</category>
        <category>OPT2</category>    
    <description>&lt;p&gt;Unsually, the final HTML code of the website is composed of several smaller templates containing smaller pieces of it. There are many techniques of combining them. In PHP template engines, the most popular are two forms: manual execution of the templates from the script side and the &lt;em&gt;include&lt;/em&gt; directive. Similar solution can be found in OPT 1.x, however in the new version, it should be forgotten - unless we use the quirks mode, the parser does not let us to call the &lt;em&gt;parse()&lt;/em&gt; method more than once. In the beginning, I planned to replace it by extending inclusion with &quot;sequences&quot; - a groups of templates to include with their own variables and cache settings. However, one day I was asked on my blog by Coldpeer, whether OPT will support template inheritance. I googled for a while, I looked at it and thought it might be cool. That's how the implementation began.&lt;/p&gt;    &lt;p&gt;As far as I know, template inheritance appeared for the first time in the Python framework, Django. The idea is taken from the object oriented programming, where we can extend classes by adding new methods, fields and overwriting the existing ones. Here it looks similar. We have a main template where we mark some characteristic places and fill them with a default content. Another template extends the main one and is able to overwrite that places with its own content. There can go the next template, and next...&lt;/p&gt;


&lt;p&gt;I was quite surprised that a lot of required functionality already exists in OPT 1.x - the &lt;em&gt;bind&lt;/em&gt; and &lt;em&gt;insert&lt;/em&gt; instructions allowed to move whole template parts somewhere else (as well as their functionality, not only the result, like in Smarty's &lt;em&gt;capture&lt;/em&gt;), even if the destination was in the other template. Unfortunately, there was no proper detection, whether one of the files was modified, so unsually the parser decided that the main part needs to be compiled, but the template with snippet definitions - does not. As a result, the places remained empty, although they should not. The development of such system for OPT 2.0 was quite complicated. You do not have to check just the template you've called, whether it is modified. You must also look at all the templates it inherits. Yesterday, I decided to solve this problem definietly and a couple of hours ago everything seemed to work properly:&lt;/p&gt;


&lt;p&gt;The base template (&lt;em&gt;test_inherited_a.tpl&lt;/em&gt;):&lt;/p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;yes&amp;quot; ?&amp;gt;
&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot;
	   &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;

&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; lang=&amp;quot;en_US&amp;quot; xml:lang=&amp;quot;en_US&amp;quot;&amp;gt;
 &amp;lt;head&amp;gt;
  &amp;lt;title&amp;gt;Instruction test: snippet and insert&amp;lt;/title&amp;gt;
 &amp;lt;/head&amp;gt;
 &amp;lt;body&amp;gt;
  &amp;lt;opt:insert snippet=&amp;quot;header&amp;quot;&amp;gt;
   &amp;lt;h1&amp;gt;I'm a standard header&amp;lt;/h1&amp;gt;
   &amp;lt;p&amp;gt;Foo bar joe&amp;lt;/p&amp;gt;  
  &amp;lt;/opt:insert&amp;gt;
  
  &amp;lt;hr/&amp;gt;
  
  &amp;lt;opt:insert snippet=&amp;quot;content&amp;quot;&amp;gt;
  	&amp;lt;p&amp;gt;Well, i'm also a standard content.&amp;lt;/p&amp;gt;
  
  &amp;lt;/opt:insert&amp;gt;
  
  &amp;lt;hr/&amp;gt;
  
  &amp;lt;opt:insert snippet=&amp;quot;footer&amp;quot;&amp;gt;
  	&amp;lt;p&amp;gt;And I'm a footer.&amp;lt;/p&amp;gt;  
  &amp;lt;/opt:insert&amp;gt;
  
  &amp;lt;p&amp;gt;&amp;amp;copy; Pasteright 2008 by LMAO, It seems to work!&amp;lt;/p&amp;gt;
 &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;


&lt;p&gt;The extending template (&lt;em&gt;test_inherit_1.tpl&lt;/em&gt;):&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;xml&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;yes&amp;quot; ?&amp;gt;
&amp;lt;opt:extend file=&amp;quot;test_inherited_a.tpl&amp;quot;&amp;gt;
	&amp;lt;opt:snippet name=&amp;quot;header&amp;quot;&amp;gt;
		&amp;lt;h1&amp;gt;Webmaster Of Puppets&amp;lt;/h1&amp;gt;
	&amp;lt;/opt:snippet&amp;gt;

	&amp;lt;opt:snippet name=&amp;quot;content&amp;quot;&amp;gt;
		&amp;lt;p&amp;gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus ut tellus id nulla adipiscing eleifend. Sed dictum accumsan ante. Nullam at nisl vitae elit aliquet fringilla. Praesent egestas eros eget tellus. Praesent id odio a sapien rhoncus vehicula. Nunc fringilla, diam eget euismod tempor, tortor metus tincidunt sapien, eu cursus magna tellus at risus. Praesent non tellus eget magna facilisis pulvinar. Praesent libero mi, adipiscing a, pharetra eget, condimentum sodales, mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Donec ac elit. Duis iaculis tortor a metus. Aliquam id purus et eros faucibus fringilla. Praesent quis quam. In lectus urna, fringilla sit amet, iaculis eget, aliquet ac, quam. Donec vulputate dui sit amet lectus. Aenean tempor, orci at pretium ornare, tortor tortor venenatis ligula, eget blandit nisi risus eget dolor. Duis nunc neque, sodales porta, viverra non, tristique eu, sem. Curabitur magna neque, blandit ullamcorper, congue quis, tristique ut, felis.&amp;lt;/p&amp;gt;
	&amp;lt;/opt:snippet&amp;gt;

	&amp;lt;opt:snippet name=&amp;quot;footer&amp;quot;&amp;gt;
		&amp;lt;p&amp;gt;Bye!!!&amp;lt;/p&amp;gt;
	&amp;lt;/opt:snippet&amp;gt;
&amp;lt;/opt:extend&amp;gt;
&lt;/pre&gt;


&lt;p&gt;Some PHP code:&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;&amp;lt;?php

	define('OPT_DIR', '../lib/');
	require(OPT_DIR.'opt.class.php');

	try
	{
		$tpl = new optClass;
		$tpl -&amp;gt; sourceDir = './templates/';
		$tpl -&amp;gt; compileDir = './templates_c/';
		$tpl -&amp;gt; stripWhitespaces = false;
		$tpl -&amp;gt; printComments = false;
		$tpl -&amp;gt; setup();
		
		$tpl -&amp;gt; parse('test_inherit_1.tpl');
	}
	catch(optException $e)
	{
		optErrorHandler($e);
	}
?&amp;gt;
&lt;/pre&gt;


&lt;p&gt;And the result can be admired below:&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://blog.invenzzia.org/public/images/template_inheritance.png&quot;&gt;&lt;img src=&quot;http://blog.invenzzia.org/public/images/.template_inheritance_m.jpg&quot; alt=&quot;Template inheritance&quot; style=&quot;display:block; margin:0 auto;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;Some facts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;If we modify any of the templates in the inheritance chain, the parser will notice it and recompile proper files.&lt;/li&gt;
&lt;li&gt;If we remove any of &quot;opt:snippet&quot; instructions, the default content of &quot;opt:insert&quot; will be displayed.&lt;/li&gt;
&lt;li&gt;There is a possibility to overwrite an existing snippet by the more important template. You will be also able to call the parent content, however it is not implemented yet (some kind of &quot;opt:parent&quot; instruction).&lt;/li&gt;
&lt;li&gt;It can be mixed with &quot;opt:include&quot; and &quot;opt:sequence&quot; (the sequence system briefly mentioned in the introduction).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What is more, it's quite possible that the template inheritance will work faster than traditional way, although it will consume more disk space. Simply, if we have an inheritance like this: &quot;A extends  B extends C&quot;, the compiler puts all their code in the file belonging to the &quot;A&quot; template. It reduces the amount of disk operations (the execution of one bigger template is faster than the same content in five files). On the other hand, by default OPT still checks the file modification times, but fortunately, the number of tests is also smaller. The exact results will be available, when some benchmarks are done. Before we end, I'll say that two days ago I made a small test (a simple list with 15 items). The result:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;OPT 1.x: 1850 req/s&lt;/li&gt;
&lt;li&gt;OPT 2.0: 2100 req/s&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Well, it looks promising, but we have to remember that the new &lt;em&gt;opt.class.php&lt;/em&gt; file still does not have half of the options, which obviously will increase its size. Moreover, some optimizations are not implemented yet. But in fact, you can assume that the new features should not destroy the performance, and there is a chance that it will be even better.&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/Template-inheritance#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/Template-inheritance#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/6</wfw:commentRss>
      </item>
    
  <item>
    <title>Deeper processing</title>
    <link>http://blog.invenzzia.org/en/post/Deeper-processing</link>
    <guid isPermaLink="false">urn:md5:d6abe77b1e5105e2840bb0cc54643046</guid>
    <pubDate>Thu, 31 Jan 2008 13:42:00 +0100</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>Open Power Template</category>
        <category>Open Power Forms</category>    
    <description>&lt;p&gt;The last project I've created using Open Power Forms, shown some weaknesses of the current form implementation. There were some forms allowing a mass addition of many records in the following way: a table, in the columns the following fields: Name, Surname, PESEL number, etc. The numer of rows was 30, so the user is able to add 30 people to the database with one form. The adaptation of the &lt;em&gt;map()&lt;/em&gt; method to my problem was not too hard; in fact it seemed that &lt;em&gt;opfArrayContainer&lt;/em&gt; solved everything. But then the form renderer connected with Open Power Template went off.&lt;/p&gt;    &lt;p&gt;My code looked like that:&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;$this -&amp;gt; map('names', new opfArrayContainer(
	new opfConstraint(MAP_TYPE, TYPE_STRING),
	new opfConstraint(MAP_LEN_GT, 2)
), OPF_OPTIONAL);
$this -&amp;gt; map('surnames', new opfArrayContainer(
	new opfConstraint(MAP_TYPE, TYPE_STRING),
	new opfConstraint(MAP_LEN_GT, 2)
), OPF_OPTIONAL);
$this -&amp;gt; map('pesels', new opfArrayContainer(
	new sConstraint(MAP_PESEL)
), OPF_OPTIONAL);
&lt;/pre&gt;


&lt;p&gt;In other words, the script must have received for example the &quot;names&quot; field, which was an array of 30 elements with the names. If the user made a mistake while filling in the form, the form renderer did not have a clue, which component to display as invalid (in this case it should be colored red instead of green). Finally, I added a support for the &lt;em&gt;IGNORE_OPF_ERRORS&lt;/em&gt; constant so that shut it up and just display everything without all this color rotation stuff.&lt;/p&gt;


&lt;p&gt;Of course, it is not possible to keep this problem unsolved in the &quot;public&quot; releases and I decided to look for solution. It would be nice, if the improvement easily matched to the code, as well as was intuitive. It's not a problem to add something in 20 minut and a month later self-wishing a rapid death. The best solutions are simple and effective, so I started to think, how to describe a form with some definitions and transformations, so that it would be possible to construct every form and process it with OPF. My idea is to go somewhere deeper and remove distinguishing between forms and form elements. The reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Both have a value (in the form case we define it as a set of subelement values).&lt;/li&gt;
&lt;li&gt;Both have a state.&lt;/li&gt;
&lt;li&gt;Both can be processed.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;/pre&gt;

&lt;p&gt;Now we can easily treat a form as an element which is capable of storing other fields. If we try to build our form described above, it will look like this: we create a form for a single person: name, surname, PESEL, etc. Next, we put it into a bigger form and order to loop up to 30 times. We can also achieve an effect of looping a single field, like it was possible with &lt;em&gt;opfArrayContainer()&lt;/em&gt; so far. We just put in such loop not a form, but a single element.&lt;/p&gt;


&lt;p&gt;Well, now the problem is, how to render it :). However, I don't think it will be complicated, especially if I look at the new Open Power Template.&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/Deeper-processing#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/Deeper-processing#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/3</wfw:commentRss>
      </item>
    
  <item>
    <title>Let's go!</title>
    <link>http://blog.invenzzia.org/en/post/Lets-go</link>
    <guid isPermaLink="false">urn:md5:a3b471b31f5945196a91e5510a414e0a</guid>
    <pubDate>Wed, 30 Jan 2008 12:29:00 +0100</pubDate>
    <dc:creator>Zyx</dc:creator>
        <category>Invenzzia</category>
        <category>invenzzia</category><category>website</category>    
    <description>&lt;p&gt;Welcome to the devblog of the new programming group Invenzzia. The reason that I formed them are my open-source projects which need a good organization and infrastructure. To begin with, the group will take care of my advanced template engine that exists for over three years so far - Open Power Template. It will become the first part of a bigger series &quot;Open Power Libraries&quot;. Currently, we have already begun setting up everything and our website is run part by part. I'll do everything to make sure it won't last too long.&lt;/p&gt;    &lt;p&gt;As a typical English-language user you haven't probably heard about Open Power Board project. It was a Polish initiative started in the end of 2004 as a result of commercializing Invision Power Board. The goal was to create an open-source discussion board by the Polish PHP community. However, the project was closed after a couple of weeks, because almost everyone said they have no time to develop it. In fact, the only people who were still active were me with Open Power Template and Tomasz &quot;Slump&quot; Szczupliński as a manager. I tried to reactivate the project in 2005, but there was the same story: everyone except Slump and me went away. I gave up and decided to create more open-source libraries, using the infrastructure left by OpenPB. I managed to make the first stable release of OPT and started Open Power Forms, a library for data validation and form processing integrated with OPT. The code is still marked as beta, because I did not have anyone to finish the JavaScript part, although the PHP-side solutions proved their effectiveness many times.&lt;/p&gt;


&lt;p&gt;Of course the situation could not last forever. Two months ago I decided to close OpenPB definietly and throw away almost everything that had any connections with that project. The idea of a new programming group came to my mind and I asked some people whether they would like to participate in it. The team is formed by:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Jacek &quot;eXtreme&quot; Jędrzejewski - PHP/JS programmer and XHTML/CSS hacker. Personally, he's my brother.&lt;/li&gt;
&lt;li&gt;Radosław &quot;Radzio&quot; Piekarz - PHP/JS programmer. Personally, we study together.&lt;/li&gt;
&lt;li&gt;Tomasz &quot;Slump&quot; Szczupliński - our manager mentioned above.&lt;/li&gt;
&lt;li&gt;Tomasz &quot;Zyx&quot; Jędrzejewski - or in other words - me. I code libraries and everything that speeds up other software.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the beginning, we are going to finish Open Power Template 2, as well as Open Power Forms. We have some more ideas, but they will be coded later. Anyway, we'll try to provide a great set of open-source tools for PHP that present a completely new point of view to many issues.&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.invenzzia.org/en/post/Lets-go#comment-form</comments>
      <wfw:comment>http://blog.invenzzia.org/en/post/Lets-go#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.invenzzia.org/en/feed/rss2/comments/2</wfw:commentRss>
      </item>
    
</channel>
</rss>