Sorry

This feed does not validate.

In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

Source: http://dpastov.blogspot.com/feeds/posts/default?alt=rss

  1. <?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-34728599</atom:id><lastBuildDate>Wed, 06 Mar 2024 01:58:11 +0000</lastBuildDate><category>lotus script</category><category>Java</category><category>lotus approach</category><category>lotus features</category><category>lotus notes</category><category>Domino</category><category>lotus news</category><category>web</category><category>javascript</category><category>me</category><category>lotus issues</category><category>lotus and java</category><category>notes api</category><category>DSAPI</category><category>Development</category><category>lotus formula</category><category>Play Framework</category><category>lotus integration</category><category>Google</category><category>lotus community</category><category>xPages</category><category>GitHub</category><category>SEO</category><category>LS2J</category><category>PDF</category><category>Velocity</category><category>lotus fun</category><category>lotus perfomance</category><category>Certificate</category><category>XML-XSL</category><category>Drupal</category><category>Jenkins</category><category>Node.js</category><category>XFDF</category><category>locale</category><category>Algorithms</category><category>Analytics</category><category>CSS</category><category>CloudFlare</category><category>DDE</category><category>FDF</category><category>FreeMarker</category><category>JSON</category><category>Jira</category><category>LS</category><category>Mongodb</category><category>RSS</category><category>SOAP</category><category>Scala</category><category>Typesafe</category><category>XPath</category><category>XSS</category><category>htmlminifier</category><category>iText</category><category>notes.ini</category><category>sqwish</category><category>uglifyjs</category><category>views</category><title>Find the best way</title><description>I write about Java, HCL Notes Domino, Web</description><link>https://dpastov.blogspot.com/</link><managingEditor>noreply@blogger.com (Dmytro)</managingEditor><generator>Blogger</generator><openSearch:totalResults>274</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-4321492353083690763</guid><pubDate>Thu, 02 Nov 2023 10:36:00 +0000</pubDate><atom:updated>2023-11-02T11:41:43.350+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><title>Configuring Entitlement Tracking in Domino 12</title><description>&lt;p&gt;In the realm of HCL Domino Server 12.0, the feature of &quot;Entitlement Tracking&quot; has become a vital component for organizations.&lt;/p&gt;
  2.  
  3. &lt;p&gt;While comprehensive information regarding Entitlement Tracking is available through HCL, I needed to know some practical management aspects, such as disabling the feature and adjusting intervals etc.&lt;/p&gt;
  4.  
  5. &lt;h2&gt;Disabling Entitlement Tracking:&lt;/h2&gt;
  6. &lt;p&gt;To disable entitlement tracking, add the following entry and restart the server:&lt;/p&gt;
  7. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;DISABLE_ENTITLEMENT_TRACKING=1
  8. &lt;/code&gt;&lt;/pre&gt;
  9.  
  10. &lt;h2&gt;Debugging for Entitlement Tracking Issues:&lt;/h2&gt;
  11. &lt;p&gt;Debug settings can be incredibly useful for troubleshooting any issues related to Entitlement Tracking. Here&#39;s how to configure debugging options:&lt;/p&gt;
  12.  &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;DEBUG_ENTITLEMENT_AGGREGATOR_INTERVAL=60
  13. DEBUG_UPDATE_ENTITLEMENT_TRACKING=2
  14. ES_OPT_TIMING=1
  15. DEBUG_DIRCAT=3
  16. &lt;/code&gt;&lt;/pre&gt;
  17.  
  18. &lt;p&gt;Hope that will help somebody.&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2023/11/configuring-entitlement-tracking-in.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-1274580201345768280</guid><pubDate>Fri, 27 Oct 2023 11:46:00 +0000</pubDate><atom:updated>2023-10-27T13:46:12.479+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Overcoming Domino&#39;s Agent Scheduling Limitations with JavaAddin</title><description>&lt;p style=&quot;text-align: justify;&quot;&gt;If you&#39;re frustrated with Domino&#39;s limitations on scheduling agents to run more frequently than once every 5 minutes, you&#39;re not alone. As a programmer, you understand the need for flexibility and control in your applications. In this article, we&#39;ll discuss a practical solution: creating a JavaAddin for Domino that can trigger agents at shorter intervals, allowing you to gain more fine-grained control over your scheduled tasks.&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Understanding the Domino Agent Scheduler&lt;/h3&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Domino provides a robust environment for running scheduled agents. However, it imposes a minimum time gap of 5 minutes between consecutive runs of the same agent. This limitation can be a roadblock for applications that require more frequent execution.&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;The Power of JavaAddins&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;JavaAddins offer a way to extend Domino&#39;s functionality using Java code. This opens up a world of possibilities, including overcoming the 5-minute scheduling restriction. Here&#39;s how you can do it:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;1. Setting Up Your JavaAddin&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;To get started, you&#39;ll need to create a JavaAddin. This involves writing Java code to interface with Domino. The code should enable you to trigger agents at shorter intervals than what Domino&#39;s native scheduling allows.&lt;/div&gt;&lt;b&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;2. Utilizing Timers&lt;/b&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One of the most effective ways to bypass the 5-minute limitation is to use timers in your JavaAddin. With timers, you can execute your agent at precise intervals, even down to seconds. Here&#39;s a simplified example of how this could look in your Java code:&lt;/div&gt;&lt;div&gt;
  19.    
  20. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;import lotus.domino.*;
  21. public class CustomScheduler extends JavaServerAddin {
  22.    public void runNotes() {
  23.        try {
  24.            Session session = NotesFactory.createSession();
  25.            Database database = session.getDatabase(&quot;&quot;, &quot;YourDatabase.nsf&quot;);
  26.            Agent agent = database.getAgent(&quot;YourAgent&quot;);
  27.  
  28.            // Set the execution interval in milliseconds
  29.            int interval = 30000; // 30 seconds
  30.  
  31.            while (true) {
  32.                agent.runWithDocumentContext(null);
  33.                sleep(interval);
  34.            }
  35.        } catch (Exception e) {
  36.            e.printStackTrace();
  37.        }
  38.    }
  39. }&lt;/code&gt;&lt;/pre&gt;
  40.  &lt;/div&gt;&lt;/div&gt;&lt;div&gt;This code defines a Java thread that runs your specified agent every 30 seconds, effectively bypassing Domino&#39;s 5-minute restriction.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;3. Deploying Your JavaAddin&lt;/b&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once you&#39;ve created your JavaAddin, you need to deploy it within your Domino environment. Ensure that the necessary permissions and access controls are in place.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;4. Monitoring and Maintenance&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Regularly monitor the execution of your custom scheduling solution. Ensure that it&#39;s working as expected and doesn&#39;t place undue stress on your Domino server.&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/h3&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;By creating a JavaAddin for Domino that can trigger agents more frequently, you can take control of your scheduling needs. This solution empowers you to run your agents at shorter intervals, achieving the level of precision your applications require. While this approach requires some development effort, the benefits of fine-grained agent scheduling can greatly enhance your Domino-based applications.&lt;br /&gt;&lt;br /&gt;In summary, if you&#39;re tired of being constrained by Domino&#39;s 5-minute scheduling limitation, consider the power of JavaAddins to break free and gain control over your scheduled agents.&lt;br /&gt;&lt;br /&gt;I have also created a bit more advanced setup which you can get on github: &lt;a href=&quot;https://github.com/dpastov/DominoAgentsHelper/&quot; target=&quot;_blank&quot;&gt;DominoAgentsHelper&lt;/a&gt;&amp;nbsp;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Stay tuned for more technical insights, delivered directly to the point, in future articles.&lt;/div&gt;&lt;/div&gt;</description><link>https://dpastov.blogspot.com/2023/10/overcoming-dominos-agent-scheduling.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-1597830296760357664</guid><pubDate>Mon, 25 Sep 2023 09:35:00 +0000</pubDate><atom:updated>2023-09-25T12:10:42.287+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">lotus script</category><category domain="http://www.blogger.com/atom/ns#">notes api</category><title>Change Database ReplicaID programmatically</title><description>&lt;p&gt;Here is a solution that change ReplicaId of NotesDatabase. Since native capabilities of LotusScript/Java classes do not allow such operation (at least yet), there is a way to do it using C Notes API. Our envrionment consists of both: Windows and Linux servers therefore I had to make a solution that cover both OS.&lt;/p&gt;
  41.  
  42.  
  43. &lt;h4&gt;Declare&lt;/h4&gt;
  44.  
  45. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Public Const W32_LIB = {nnotes.dll}
  46. Public Const LINUX_LIB = {libnotes.so}
  47.  
  48. Type TIMEDATE
  49. Innards(0 to 1) As Long
  50. End Type
  51.  
  52. Type DBREPLICAINFO
  53. ID As TIMEDATE &#39;ID that is same for all replica files
  54. Flags As Integer &#39;Replication flags
  55. CutoffInterval As Integer &#39;Automatic Replication Cutoff
  56. Cutoff As TIMEDATE &#39;Replication cutoff date
  57. End Type
  58.  
  59. Declare sub W32_OSCurrentTimeDate Lib W32_LIB Alias &quot;OSCurrentTIMEDATE&quot;(Ret As TIMEDATE)
  60. Declare Function W32_NSFDbOpen Lib W32_LIB Alias &quot;NSFDbOpen&quot; (ByVal dbName As String, hdb As Long) As Integer
  61. Declare Function W32_NSFDbClose Lib W32_LIB Alias &quot;NSFDbClose&quot; (ByVal hdb As Long) As Integer
  62. Declare Function W32_NSFDbReplicaInfoGet Lib W32_LIB Alias &quot;NSFDbReplicaInfoGet&quot; (ByVal hdb As Long, hdbr As DBREPLICAINFO) As Integer
  63. Declare Function W32_NSFDbReplicaInfoSet Lib W32_LIB Alias &quot;NSFDbReplicaInfoSet&quot; (ByVal hdb As Long, hdbr As DBREPLICAINFO) As Integer
  64.  
  65. Declare Sub LINUX_OSCurrentTimeDate Lib LINUX_LIB Alias &quot;OSCurrentTIMEDATE&quot;(Ret As TIMEDATE)
  66. Declare Function LINUX_NSFDbOpen Lib LINUX_LIB Alias &quot;NSFDbOpen&quot; (ByVal dbName As String, hdb As Long) As Integer
  67. Declare Function LINUX_NSFDbClose Lib LINUX_LIB Alias &quot;NSFDbClose&quot; (ByVal hdb As Long) As Integer
  68. Declare Function LINUX_NSFDbReplicaInfoGet Lib LINUX_LIB Alias &quot;NSFDbReplicaInfoGet&quot; (ByVal hdb As Long, hdbr As DBREPLICAINFO) As Integer
  69. Declare Function LINUX_NSFDbReplicaInfoSet Lib LINUX_LIB Alias &quot;NSFDbReplicaInfoSet&quot; (ByVal hdb As Long, hdbr As DBREPLICAINFO) As Integer&lt;/code&gt;&lt;/pre&gt;
  70.  
  71. &lt;h4&gt;Code C API (main part of it)&lt;/h4&gt;
  72.  
  73. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;&#39;GET CURRENT TIMEDATE (TO BUILD NEW REPLICAID): OSCurrentTimeDate
  74. If IS_WINDOWS Then
  75. Call W32_OSCurrentTimeDate(ReplicaID)
  76. Else
  77. Call LINUX_OSCurrentTimeDate(ReplicaID)
  78. End If
  79. ReplicaInfo.ID = ReplicaID
  80. &#39;SET NEW REPLICAID: NSFDbReplicaInfoSet
  81. If IS_WINDOWS Then
  82. rc = W32_NSFDbReplicaInfoSet(hDb, replicaInfo)
  83. Else
  84. rc = LINUX_NSFDbReplicaInfoSet(hDb, replicaInfo)
  85. End If&lt;/code&gt;&lt;/pre&gt;
  86.  
  87.  
  88. &lt;p&gt;You can find all solution on GitHub: &lt;a href=&quot;https://github.com/dpastov/DominoChangeDatabaseReplicaID&quot; target=&quot;_blank&quot;&gt;DominoChangeDatabaseReplicaID&lt;/a&gt;&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2023/09/here-is-solution-that-change-replicaid.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-7456492786871285795</guid><pubDate>Thu, 08 Sep 2022 12:27:00 +0000</pubDate><atom:updated>2022-09-08T14:28:25.009+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">FreeMarker</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Java Freemarker with Domino</title><description>There are plenty of different Java template engines but for last years I used to stick to &lt;a href=&quot;https://freemarker.apache.org/&quot;&gt;FreeMarker&lt;/a&gt;. It&#39;s open sourced and licensed under the Apache License, Version 2.0.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here I only want to demonstrate how to integrate it with Domino nicely as it requires to write TemplateLoader class.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
  89.  
  90. Build result based on tempalte &quot;page&quot;
  91.  
  92. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Configuration cfg = new Configuration(Configuration.VERSION_2_3_31);
  93. cfg.setDefaultEncoding(&quot;UTF-8&quot;);
  94. cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
  95. cfg.setLogTemplateExceptions(false);
  96.  
  97. Get the template (uses cache internally)
  98. DominoTemplateLoader dominoLoader = new DominoTemplateLoader(getDatabase());
  99. cfg.setTemplateLoader(dominoLoader);
  100.  
  101. Template template = cfg.getTemplate(&quot;page&quot;);
  102.  
  103. /* Merge data-model with template */
  104. HashMap&lt;String, Object&gt; tags = new HashMap&lt;String, Object&gt;();
  105. tags.put(&quot;title&quot;, &quot;hellow world&quot;);
  106. tags.put(&quot;description&quot;, &quot;Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit.&quot;);
  107. Writer out = new StringWriter();
  108. template.process(tags, out);
  109. String html = out.toString();
  110. &lt;/code&gt;&lt;/pre&gt;
  111.  
  112. The most important part was actually to build DominoTemplateLoader class and below you can see it
  113.  
  114. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;public class DominoTemplateLoader implements TemplateLoader {
  115. private View m_view;
  116.  
  117. public DominoTemplateLoader(Database database) throws NotesException {
  118. m_view = database.getView(&quot;($Template)&quot;);
  119. }
  120.  
  121. public void closeTemplateSource(Object templateSource) throws IOException {
  122. Document doc = (Document) templateSource;
  123. try {
  124. doc.recycle();
  125. } catch (NotesException e) {
  126. e.printStackTrace();
  127. }
  128. }
  129.  
  130. public Object findTemplateSource(String id) throws IOException {
  131. try {
  132. return m_view.getDocumentByKey(id, true);
  133. } catch (NotesException e) {
  134. e.printStackTrace();
  135. }
  136.  
  137. return null;
  138. }
  139.  
  140. public long getLastModified(Object templateSource) {
  141. Document doc = (Document) templateSource;
  142.  
  143. try {
  144. return doc.getLastModified().toJavaDate().getTime();
  145. } catch (NotesException e) {
  146. e.printStackTrace();
  147. }
  148.  
  149. return 0;
  150. }
  151.  
  152. public Reader getReader(Object templateSource, String encoding) throws IOException {
  153. if (templateSource == null) return null;
  154. Document doc = (Document) templateSource;
  155. try {
  156. return doc.getFirstItem(&quot;Body&quot;).getReader();
  157. } catch (NotesException e) {
  158. e.printStackTrace();
  159. }
  160. return null;
  161. }
  162. }
  163. &lt;/code&gt;&lt;/pre&gt;
  164.  
  165. As you can see the Loader class get document form a view and simply get data from item Body.
  166. </description><link>https://dpastov.blogspot.com/2022/09/java-freemarker-with-domino.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-8131522236122546237</guid><pubDate>Fri, 10 Dec 2021 11:42:00 +0000</pubDate><atom:updated>2021-12-10T12:50:24.979+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Journalize email from Exchange to Domino using Addin</title><description>&lt;p style=&quot;text-align: justify;&quot;&gt;One of my customer moves to Office 365 and also wants to move to to Exchange/Outlook 356 during next year while keeping Domino app running as it is of now.&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;They have customized mail boxes with few actions which allow to journalize emails into their Domino applications and that is quite critical functionality so that would need to be mirrored.&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;We have decided to built Outlook Add-in (works in web, client and also with mobile devices).&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;Here are a few advises to those who would need to developer similar functionality.&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;1. Create a outlook add-in project and define manifest&lt;/h2&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;You would have to create a project with manifest and needed html, css, js elementets. You can easily find information how to do that on MS sites (not going to provide any links as they could change in future). That will allow you to define UI, see my example.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh_4esBXJv79zol54gBm-sz2zOkSw29dSNOmGsmW0ox5bjrBYmYszxWcYzQAtgl9ylpUkwBHIT7PR6EQJ-ck03Agm6p_iCvJ_9AwZ7CS-vXjifEdpVARjPMycKFi3XTYls2BPFhwccfSA0Gc94tLBYEmSuwp1AtwhVutGzPTkleTwAM4hPHJQ=s1154&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;487&quot; data-original-width=&quot;1154&quot; height=&quot;169&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh_4esBXJv79zol54gBm-sz2zOkSw29dSNOmGsmW0ox5bjrBYmYszxWcYzQAtgl9ylpUkwBHIT7PR6EQJ-ck03Agm6p_iCvJ_9AwZ7CS-vXjifEdpVARjPMycKFi3XTYls2BPFhwccfSA0Gc94tLBYEmSuwp1AtwhVutGzPTkleTwAM4hPHJQ=w400-h169&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;h2 style=&quot;clear: both; text-align: left;&quot;&gt;2. Send memo ID to Domino&lt;/h2&gt;
  167.  
  168. &lt;p&gt;We need to get information about email from Outlook Add in and send those items to Domino (you would have to build REST API on Domino side that can receive data from Outlook).&lt;/p&gt;
  169.  
  170. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Office.context.mailbox.getCallbackTokenAsync(function(result) {
  171.  
  172.  ...
  173.  
  174.  var token = result.value;
  175.  var ewsurl = Office.context.mailbox.restUrl;
  176.  var ewsItemId = Office.context.mailbox.item.itemId;
  177.  const itemId = Office.context.mailbox.convertToRestId(ewsItemId,Office.MailboxEnums.RestVersion.v2_0);
  178.  
  179.  // send token, ewsurl and itemId to Domino endpoint
  180.  ...
  181.  
  182. }
  183. &lt;/code&gt;&lt;/pre&gt;
  184.  
  185. &lt;p&gt;Having those keys (token url and itemId) you can pull email in Mime format&lt;/p&gt;
  186.  
  187. &lt;h2&gt;3. Convert Mime to Notes email&lt;/h2&gt;
  188. &lt;p style=&quot;text-align: justify;&quot;&gt;So at this point Domino received data from Add in and can finally do another request to Exchange server (using token, ewsurl and itemId) to read the memo MIME&lt;/p&gt;
  189.  
  190. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Dim http As NotesHTTPRequest
  191. Dim enpoint As string
  192. Set http = m_app.NotesSession.Createhttprequest()
  193. Call http.Setheaderfield(&quot;Authorization&quot;, &quot;Bearer &quot; + token)
  194. enpoint = ewsurl + |/v2.0/me/messages/| + itemId + |/$value|
  195. getItemMIME = http.get(enpoint)&lt;/code&gt;&lt;/pre&gt;
  196.  
  197. &lt;p style=&quot;text-align: justify;&quot;&gt;There is no native Domino LS/Java Mime Parser however I found working example by Stephan: &lt;a href=&quot;https://notessensei.com/blog/2012/04/importing-eml-files-into-notes-lots-of-them.html&quot;&gt;Importing EML files into Notes (lots of them)&lt;/a&gt;. It worked well, but seems it does not handle inline images (need to do more testing etc).
  198. &lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;Alternatively I was told that there is &lt;a href=&quot;https://github.com/OpenNTF/XPagesExtensionLibrary/blob/master/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.commons/src/com/ibm/domino/commons/mime/MimeMessageParser.java&quot;&gt;MimeMessageParser.java&lt;/a&gt; that writes MIME to a Notes document. This class is part of the XPages Extension Library. So it has sense to compare them.&lt;/p&gt;
  199.  
  200. &lt;p&gt;&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2021/12/journalize-email-from-exchange-to.html</link><author>noreply@blogger.com (Dmytro)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEh_4esBXJv79zol54gBm-sz2zOkSw29dSNOmGsmW0ox5bjrBYmYszxWcYzQAtgl9ylpUkwBHIT7PR6EQJ-ck03Agm6p_iCvJ_9AwZ7CS-vXjifEdpVARjPMycKFi3XTYls2BPFhwccfSA0Gc94tLBYEmSuwp1AtwhVutGzPTkleTwAM4hPHJQ=s72-w400-h169-c" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-4002131272119632850</guid><pubDate>Mon, 22 Nov 2021 09:10:00 +0000</pubDate><atom:updated>2021-11-22T10:24:03.256+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">DSAPI</category><title>Alter user during authentication using DSAPI</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;I had a need to alter user during web-authentication process on fly (skipping password  validation).
  201. Initially the task looked impossible but I managed to solve it using DSAPI filter.&lt;/div&gt;
  202. &lt;div style=&quot;text-align: justify;&quot;&gt;Though the solution looks quite unsecure it could be very useful in some cases (by high level administrators) who needs to &#39;signin&#39; as a user in their organization to do some checks.&lt;/div&gt;
  203.  
  204. &lt;p&gt;Here are few most important snippets how to do that:&lt;/p&gt;&lt;p&gt;
  205.  
  206.  
  207. &lt;/p&gt;&lt;h4&gt;1. Subscribe for the event kFilterAuthenticate&lt;/h4&gt;
  208.  
  209. &lt;p&gt;That means that our dsapi filter only intercepts one specific event: kFilterAuthenticate), as there are other 10-15 other events which we do not wanna touch.&lt;/p&gt;
  210.  
  211. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;EXPORT unsigned int FilterInit(FilterInitData* filterInitData) {
  212. STATUS   error = NOERROR;
  213.  
  214. filterInitData-&amp;gt;appFilterVersion = kInterfaceVersion;
  215. filterInitData-&amp;gt;eventFlags = kFilterAuthenticate;
  216.  
  217. // other logic
  218. // ...
  219. }&lt;/code&gt;&lt;/pre&gt;
  220.  
  221. &lt;h4&gt;2. Catch the authenticate event and process it&lt;/h4&gt;
  222.  
  223. &lt;p&gt;Get our event and associate it with a C function&lt;/p&gt;
  224.  
  225. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;EXPORT unsigned int HttpFilterProc(FilterContext* context, unsigned int eventType, void* eventData) {
  226. /* Include only those events we want to handle */
  227. switch (eventType) {
  228. case kFilterAuthenticate:
  229. return Authenticate(context, (FilterAuthenticate *) eventData);
  230. default:
  231. break;
  232. }
  233.  
  234.   return kFilterNotHandled;
  235. } // end HttpFilterProc&lt;/code&gt;&lt;/pre&gt;
  236.  
  237.  
  238. &lt;h4&gt;3. Finally set a desired username&lt;/h4&gt;
  239.  
  240. &lt;p&gt;Below I only show the key moment - replace user name with another name&lt;/p&gt;
  241.  
  242. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;unsigned int Authenticate(FilterContext* context, FilterAuthenticate* authData) {
  243. /* logic that calculate username  */
  244.    // .................................
  245.    // char[] fullName = &quot;CN=T5 Tester5/O=DmytroDev&quot;;
  246.    // .................................
  247.  
  248. /* Copy the canonical name for this user that dsapi requires.  */
  249. strncpy ((char *)authData-&amp;gt;authName, fullName, authData-&amp;gt;authNameSize);
  250. authData-&amp;gt;authNameSize = strlen(alterAuthToken);
  251. authData-&amp;gt;authType = kAuthenticBasic;
  252. authData-&amp;gt;foundInCache = TRUE;
  253.  
  254. return kFilterHandledEvent;
  255. }
  256. &lt;/code&gt;&lt;/pre&gt;
  257.  
  258. &lt;p style=&quot;text-align: justify;&quot;&gt;In order to improve security I have built an application on Domino side that generates tokens which have to be set in cookie and then DSAPI filter reads the cookie and get username from database. Tokens could be generated only by certain people are will be deleted by schedule agents after some time.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK85lHFLoCOQDcGUz6PrsAY6Y4iKo059Z5apPuifaFqKsJZMKu_zmMxcxIyAx3yD13p_zzDikqBeTHowmsM9HEyvQuIMA7wRMO_A0fOIWyx5u2VB9qleNAnmA1fqtZXoc-80Pj/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;208&quot; data-original-width=&quot;552&quot; height=&quot;121&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK85lHFLoCOQDcGUz6PrsAY6Y4iKo059Z5apPuifaFqKsJZMKu_zmMxcxIyAx3yD13p_zzDikqBeTHowmsM9HEyvQuIMA7wRMO_A0fOIWyx5u2VB9qleNAnmA1fqtZXoc-80Pj/&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;On the screenshot below you can see that I signed in as a &quot;T5 Tester5&quot; using my custom token AlterAuthToken while I am Anonymous.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpRKdnunl09_7rE2Dt9z2Sh06MCN_MG_RbB2LWvC3oPQ5svmJm0wXm7gVdOSzFQU7J5Zkl2Kqc1bG9OhOsOi6KgcQDiGLS91c3rqNnT7DY5Ll8lRgcUgA-Yblxdk6PbZCa29Vc/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;446&quot; data-original-width=&quot;921&quot; height=&quot;194&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpRKdnunl09_7rE2Dt9z2Sh06MCN_MG_RbB2LWvC3oPQ5svmJm0wXm7gVdOSzFQU7J5Zkl2Kqc1bG9OhOsOi6KgcQDiGLS91c3rqNnT7DY5Ll8lRgcUgA-Yblxdk6PbZCa29Vc/w400-h194/image.png&quot; width=&quot;500&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2021/11/alter-user-during-authentication-using.html</link><author>noreply@blogger.com (Dmytro)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK85lHFLoCOQDcGUz6PrsAY6Y4iKo059Z5apPuifaFqKsJZMKu_zmMxcxIyAx3yD13p_zzDikqBeTHowmsM9HEyvQuIMA7wRMO_A0fOIWyx5u2VB9qleNAnmA1fqtZXoc-80Pj/s72-c" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-1308867666822181335</guid><pubDate>Fri, 12 Nov 2021 09:29:00 +0000</pubDate><atom:updated>2023-09-25T11:36:50.787+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">lotus script</category><category domain="http://www.blogger.com/atom/ns#">notes api</category><title>Clear database replication history programatically</title><description>&lt;p&gt;Recently I had a need to make a solution that can periodically clean replication history for list of databases.&lt;/p&gt;&lt;p&gt;Native LotusScript/Java classes do not allow that, but there is an C API for that.&lt;/p&gt;&lt;p&gt;Here is a cross platform solution (works for Windows/Linux)&lt;/p&gt;
  259.  
  260. &lt;h4&gt;Declare&lt;/h4&gt;
  261.  
  262. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Public Const W32_LIB = {nnotes.dll}
  263. Public Const LINUX_LIB = {libnotes.so}
  264.  
  265. Declare Function W32_NSFDbOpen Lib W32_LIB Alias {NSFDbOpen} (ByVal dbName As String, hDb As Long) As Integer
  266. Declare Function W32_NSFDbClose Lib W32_LIB Alias {NSFDbClose} (ByVal hDb As Long) As Integer
  267. Declare Function W32_NSFDbClearReplHistory Lib W32_LIB Alias {NSFDbClearReplHistory} (ByVal hDb As Long, flags As Integer) As Integer
  268.  
  269. Declare Function LINUX_NSFDbOpen Lib LINUX_LIB Alias {NSFDbOpen} (ByVal dbName As String, hDb As Long) As Integer
  270. Declare Function LINUX_NSFDbClose Lib LINUX_LIB Alias {NSFDbClose} (ByVal hDb As Long) As Integer
  271. Declare Function LINUX_NSFDbClearReplHistory Lib LINUX_LIB Alias {NSFDbClearReplHistory} (ByVal hDb As Long, flags As Integer) As Integer&lt;/code&gt;&lt;/pre&gt;
  272.  
  273. &lt;h4&gt;Using C API functions&lt;/h4&gt;
  274.  
  275. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;// get a handler to database
  276. If IS_WINDOWS Then
  277. rc = W32_NSFDbOpen(Server &amp;amp; &quot;!!&quot; &amp;amp; FileName, hDb)
  278. Else
  279. rc = LINUX_NSFDbOpen(Server &amp;amp; &quot;!!&quot; &amp;amp; FileName, hDb)
  280. End If
  281.  
  282. // clear replication history
  283. If IS_WINDOWS Then
  284. rc = W32_NSFDbClearReplHistory(hDb, 0)
  285. Else
  286. rc = LINUX_NSFDbClearReplHistory(hDb, 0)
  287. End If
  288.  
  289. // close datababase (be sure you always close hDb if you opened it, otherwise memory leak).
  290. If IS_WINDOWS Then
  291. rc = W32_NSFDbClose(hDb)
  292. Else
  293. rc = LINUX_NSFDbClose(hDb)
  294. End If
  295. &lt;/code&gt;&lt;/pre&gt;
  296.  
  297. &lt;p&gt;Be sure that you always close hDb handler if you opened the database, otherwise it would lead to memory leak)&lt;/p&gt;
  298.  
  299. &lt;p&gt;See the full solution on GitHub: &lt;a href=&quot;https://github.com/dpastov/DominoReplicationHistoryCleaner&quot; target=&quot;_blank&quot;&gt;DominoReplicationHistoryCleaner&lt;/a&gt;&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2021/11/clear-database-replication-history.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-6990268371903179935</guid><pubDate>Thu, 08 Apr 2021 10:27:00 +0000</pubDate><atom:updated>2021-04-08T12:40:27.650+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">lotus script</category><category domain="http://www.blogger.com/atom/ns#">notes api</category><title>Checking if database is encrypted with LotusScript (C API)</title><description>&lt;p&gt;
  300.  Since it&#39;s not possible to identify encryption status and level using native
  301.  LotusScript/Java classes here is a way to do that. The solution is based on
  302.  Notes CAPI (within LotusScript) but it works for both Linux/Windows
  303.  environment.
  304. &lt;/p&gt;
  305. &lt;p&gt;
  306.  I will omit&amp;nbsp;NSFDbOpen and NSFDbClose since it&#39;s easy to find out and
  307.  focus instead on the main function: NSFDbLocalSecInfoGetLocal.&lt;/p&gt;
  308. &lt;p&gt;&lt;b&gt;Declaration&lt;/b&gt;&lt;/p&gt;
  309.  
  310. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Const NNOTES =&quot;nnotes.dll&quot;
  311. Const LIBNOTES =&quot;libnotes.so&quot;
  312.  
  313. Declare Public Function WIN_NSFDbLocalSecInfoGetLocal Lib NNOTES Alias &quot;NSFDbLocalSecInfoGetLocal&quot;(ByVal hDb As Long, state As Long, strength As Long) As Integer
  314. Declare Public Function LIN_NSFDbLocalSecInfoGetLocal Lib LIBNOTES Alias &quot;NSFDbLocalSecInfoGetLocal&quot;(ByVal hDb As Long, state As Long, strength As Long) As integer&lt;/code&gt;&lt;/pre&gt;
  315.  
  316. &lt;p&gt;&lt;b&gt;Function check encryption status&lt;/b&gt;&lt;/p&gt;
  317. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;public Function NSFDbLocalSecInfoGetLocal(hDB As Long, state As Long, strength As long) As Integer
  318. If isDefined(&quot;WINDOWS&quot;) Then
  319.  NSFDbLocalSecInfoGetLocal = WIN_NSFDbLocalSecInfoGetLocal(hDb, state, strength)
  320. ElseIf isDefined(&quot;LINUX&quot;) Then
  321.  NSFDbLocalSecInfoGetLocal = LIN_NSFDbLocalSecInfoGetLocal(hDb, state, strength)
  322. End If
  323. End Function&lt;/code&gt;&lt;/pre&gt;
  324. &lt;p&gt;&lt;b&gt;Example how to use it&lt;/b&gt;&lt;/p&gt;
  325. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px; text-align: left;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Private Function calcEncryption(database As NotesDatabase, doc As notesdocument)
  326. Dim sDb As String
  327. Dim hDb As Long
  328. Dim state As Long
  329. Dim encrypt As Long
  330. Dim rc As Integer
  331.  
  332. sDb = database.server &amp;amp; &quot;!!&quot; &amp;amp; database.filepath
  333.  
  334. rc = NSFDbOpen(sDb, hDb)
  335. If rc &amp;lt;&amp;gt; 0 Then Exit function
  336.  
  337. rc = NSFDbLocalSecInfoGetLocal(hDB, &lt;b&gt;state&lt;/b&gt;, &lt;b&gt;encrypt&lt;/b&gt;)
  338. If rc &amp;lt;&amp;gt; 0 Then
  339.  Error 9001, &quot;Impossible to read encryption. Error code: &quot; &amp;amp; CStr(rc)
  340. End If
  341.  
  342. rc = NSFDbClose(hDb)
  343. End Function&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;
  344.  state&lt;/b&gt;: 0 (not encrypted), 1 (encrypted) or 2 (will be encrypted after compact)
  345. &lt;/li&gt;&lt;li&gt;&lt;b&gt;encrypt&lt;/b&gt;: 1 (easy), 2 (middle), 3 (strong)&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;
  346.  
  347.  
  348. </description><link>https://dpastov.blogspot.com/2021/04/checking-if-database-is-encrypted-with.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-5623655571788393425</guid><pubDate>Wed, 20 Jan 2021 11:25:00 +0000</pubDate><atom:updated>2021-01-20T12:31:35.005+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">lotus script</category><category domain="http://www.blogger.com/atom/ns#">LS2J</category><category domain="http://www.blogger.com/atom/ns#">web</category><title>How to post attachments using form to agent </title><description>&lt;p&gt;I have a form with some text fields and I also needed to send attachments within same form.&lt;/p&gt;
  349.  
  350. &lt;p&gt;Form is printed by agent and is processed by another agent written in LotusScript.&lt;/p&gt;
  351.  
  352. &lt;p&gt;I spent some time working on solution and here it is.&lt;/p&gt;
  353.  
  354. &lt;p&gt;The idea is to convert selected files to base64 on client side and then post data on submission and agent that process submission will conver base64 to file.&lt;/p&gt;
  355.  
  356. &lt;p&gt;Here is a form, note that we run some logic when files are added&lt;/p&gt;
  357.  
  358. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;&amp;lt;form name=&quot;formName&quot; method=&quot;post&quot; action=&quot;agentName?openagent&quot;&amp;gt;
  359. &amp;lt;input name=&quot;title&quot; value=&quot;xxx&quot;&amp;gt;
  360. &amp;lt;input type=&quot;file&quot; name=&quot;files&quot; multiple onchange=&quot;toBase64()&quot;&amp;gt;
  361. &amp;lt;/form&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  362.  
  363. &lt;p&gt;Here is how we convert selected files to base64 and how we results as text fields to form (JS is not optimal, it can be done without jQuery)&lt;/p&gt;
  364.  
  365. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;function toBase64() {
  366.  var files = document.querySelector(&#39;input[type=file]&#39;).files;
  367.  
  368.  var form = $(&quot;form&quot;);
  369.  form.find(&quot;input[name^=&#39;filebase64&#39;]&quot;).remove(); // replace
  370.  
  371.  function readAndSave(file, index) {
  372.    var reader = new FileReader();
  373.    reader.addEventListener(&quot;load&quot;, function() {
  374.      form.append(&quot;&lt;input name=&quot;filebase64_&amp;quot;+index + &amp;quot;&quot; type=&quot;hidden&quot; value=&quot;&amp;quot;+this.result+&amp;quot;&quot; /&gt;&quot;);
  375.      form.append(&quot;&lt;input name=&quot;filename_&amp;quot;+index + &amp;quot;&quot; type=&quot;hidden&quot; value=&quot;&amp;quot;+file.name+&amp;quot;&quot; /&gt;&quot;);
  376.    }, false);
  377.  
  378.    reader.readAsDataURL(file);
  379.  }
  380.  
  381.  if (files) {
  382.    [].forEach.call(files, readAndSave);
  383.  }
  384. }&lt;/code&gt;&lt;/pre&gt;
  385.  
  386. &lt;p&gt;Once form is submitted we have to read base64 items and convert them to file. There are at least 2 solutions: pure LS or Java/LS2J&lt;/p&gt;
  387.  
  388. a) LotusScript using NotesMIMEHeader
  389.  
  390. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Private Function saveBase64AsFile(base64 As String, filePath As string) As Boolean
  391. On Error GoTo ErrorHandler
  392.  
  393. Dim stub As NotesDocument
  394. Dim stream As NotesStream
  395. Dim item As NotesMIMEEntity
  396. Dim header As NotesMIMEHeader
  397. Dim emb As NotesEmbeddedObject
  398. Dim fileName As String
  399. Dim contentType As string
  400. Dim base64File As String
  401.  
  402. fileName = StrRightBack(filePath, &quot;\&quot;)
  403. contentType = StrRight(Strleft(base64, &quot;;&quot;), &quot;:&quot;)
  404. base64File = StrRight(Base64, &quot;,&quot;)
  405. Call scriptLog.loginfo(fileName)
  406. Call scriptLog.loginfo(contentType)
  407. Set stub = db.Createdocument()
  408. Set item = stub.CreateMIMEEntity(&quot;Body&quot;)
  409. Set header = item.createHeader(&quot;Content-Disposition&quot;)
  410. Call header.setHeaderVal({attachment; filename=&quot;} &amp;amp; fileName &amp;amp; {&quot;})
  411.  
  412. Set stream = app.NotesSession.CreateStream()
  413. Call stream.WriteText(base64File)
  414. Call item.SetContentFromText(stream, contentType, ENC_BASE64)
  415.  
  416. Call stream.Truncate
  417. Call stream.Close
  418. Call stub.Closemimeentities(True)
  419.  
  420. Set emb = stub.Getattachment(fileName)
  421. Call emb.Extractfile(filePath)
  422. Exit Function
  423. ErrorHandler:
  424. Error Err, Error
  425. End Function&lt;/code&gt;&lt;/pre&gt;
  426.  
  427.  
  428. b) Java with LS2J using native classses.
  429.  
  430. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;import java.util.Base64;
  431. import java.io.IOException;
  432. import java.nio.file.*;
  433.  
  434. public class Base64ToFile{
  435.  
  436. public boolean convert(String base64String, String filePath) {
  437. try {
  438. byte[] decodedImg = Base64.getDecoder().decode(base64String.getBytes());
  439. Path destinationFile = Paths.get(filePath);
  440. Files.write(destinationFile, decodedImg);
  441. return true;
  442. } catch (IOException e) {
  443. e.printStackTrace();
  444. }
  445. return false;
  446. }
  447. }&lt;/code&gt;&lt;/pre&gt;
  448.  
  449. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;UseLSX &quot;*javacon&quot;
  450. Use &quot;Base64ToFile&quot;
  451.  
  452. Class Base64ToFile
  453. Private jSession As JavaSession
  454. Private jClass As Javaclass
  455. Private jObject As JavaObject
  456. Private jError As JavaError
  457. Sub New()
  458. Set jSession = New JavaSession
  459. Set jClass = jSession.GetClass(&quot;Base64ToFile&quot;)
  460. Set jObject = jClass.Createobject()
  461. End Sub
  462. Public Function convert(base64 As String, filePath As String) As Boolean
  463. convert = jObject.convert(base64, filePath)
  464. End Function
  465. End Class&lt;/code&gt;&lt;/pre&gt;</description><link>https://dpastov.blogspot.com/2021/01/how-to-post-attachments-using-form-to.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-610147718484182841</guid><pubDate>Tue, 20 Oct 2020 09:32:00 +0000</pubDate><atom:updated>2020-10-21T14:55:53.957+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>JavaServerAddin in Domino - constructor and schedule</title><description>&lt;p&gt;In this article we will improve our java addin &#39;DemoAddin&#39; with following features:&lt;/p&gt;
  466.  
  467. &lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Constructor that accepts parameters when we load java addin from console.&lt;/li&gt;&lt;li&gt;We will schedule output to console amount of registered person in names.nsf (every 33 seconds).&lt;/li&gt;&lt;li&gt;Define destructor.&lt;/li&gt;&lt;li&gt;Load (with parameter) and Unload addin from console&lt;/li&gt;&lt;/ol&gt;
  468.  
  469. &lt;h4&gt;Constructor&lt;/h4&gt;
  470.  
  471. &lt;p&gt;We will define 2 constructor, one that can accept parameters and one in case if we load addin without any parameters. It is pretty obvious how it works.&lt;/p&gt;
  472.  
  473. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;// we expect our first parameter is dedicated for secondsElapsed
  474. public DemoAddin(String[] args) {
  475. this.secondsElapsed = Integer.parseInt(args[0]);
  476. }
  477.  
  478. // constructor if no parameters
  479. public DemoAddin() {}&lt;/code&gt;&lt;/pre&gt;
  480.  
  481. &lt;p&gt;Means if we run command like below it will run using constructor with parameters&lt;/p&gt;
  482.  
  483. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;load runjava org.demo.DemoAddin 33&lt;/code&gt;&lt;/pre&gt;
  484.  
  485. &lt;h4&gt;Schedule worker&lt;/h4&gt;
  486.  
  487. &lt;p&gt;There is a method (it works but deprecated, however I have not found what should be use instead). The snippet below run constant loop, open names.nsf, read amount of users in the view People and output it to console. The main line here is &lt;strong&gt;this.addInRunning()&lt;/strong&gt;, it keeps loop running forever (until we change it to &lt;strong&gt;this.stopAddin()&lt;/strong&gt; or unload addin from console)&lt;/p&gt;
  488.  
  489. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;session = NotesFactory.createSession();
  490. String server = session.getServerName();
  491.  
  492. while (this.addInRunning()) {
  493. /* gives control to other task in non preemptive os*/
  494. OSPreemptOccasionally();
  495.  
  496. if (this.AddInHasSecondsElapsed(secondsElapsed)) {
  497. ab = session.getDatabase(server, &quot;names.nsf&quot;);
  498. long count = ab.getView(&quot;People&quot;).getAllEntries().getCount();
  499. logMessage(&quot;Count of persons: &quot; + Long.toString(count));
  500. ab.recycle();
  501. }
  502. }&lt;/code&gt;&lt;/pre&gt;
  503.  
  504. &lt;h4&gt;Destructor&lt;/h4&gt;
  505.  
  506. &lt;p&gt;Keep in mind that we need to be careful with Notes object, we have to release memory (recycle) after we no longer use them. So it&#39;s a good idea to create own terminate method that release memory for all Notes object you delcared and use it when addin unloads. There is also built-in method &lt;strong&gt;finalize&lt;/strong&gt; so you can put code there, but I prefer to have own method and use it in places I need&lt;/p&gt;
  507.  
  508. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;private void terminate() {
  509. try {
  510. if (this.ab != null) {
  511. this.ab.recycle();
  512. }
  513. if (this.session != null) {
  514. this.session.recycle();
  515. }
  516.  
  517. logMessage(&quot;UNLOADED (OK)&quot;);
  518. } catch (NotesException e) {
  519. logMessage(&quot;UNLOADED (**FAILED**)&quot;);
  520. }
  521. }&lt;/code&gt;&lt;/pre&gt;
  522.  
  523. &lt;h4&gt;Load (with parameter) and Unload addin from console&lt;/h4&gt;
  524. &lt;p&gt; In order to run addin with parameter simply add it after name of Addin, use space as a separator when you need more than 1 parameter&lt;/p&gt;
  525.  
  526. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;load runjava org.demo.DemoAddin 33&lt;/code&gt;&lt;/pre&gt;
  527.  
  528. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;[1098:0002-23A0] 10/20/2020 11:15:00 AM  JVM: Java Virtual Machine initialized.
  529. [1098:0002-23A0] 10/20/2020 11:15:00 AM  RunJava: Started org/demo/DemoAddin Java task.
  530. [1098:0004-3984] 10/20/2020 11:15:00 AM  DemoAddin: version             2
  531. [1098:0004-3984] 10/20/2020 11:15:00 AM  DemoAddin: build date          2020-10-19 11:00 CET
  532. [1098:0004-3984] 10/20/2020 11:15:00 AM  DemoAddin: java                1.8
  533. [1098:0004-3984] 10/20/2020 11:15:00 AM  DemoAddin: seconds elapsed     33
  534. [1098:0004-3984] 10/20/2020 11:15:33 AM  DemoAddin: Count of persons: 11
  535. [1098:0004-3984] 10/20/2020 11:16:06 AM  DemoAddin: Count of persons: 11
  536. [1098:0004-3984] 10/20/2020 11:16:39 AM  DemoAddin: Count of persons: 11
  537. [1098:0004-3984] 10/20/2020 11:17:12 AM  DemoAddin: Count of persons: 11&lt;/code&gt;&lt;/pre&gt;
  538.  
  539. &lt;p&gt;When you want to unload addin using console here is a command&lt;/p&gt;
  540.  
  541. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;tell runjava unload org.demo.DemoAddin&lt;/code&gt;&lt;/pre&gt;
  542.  
  543. &lt;p&gt;And you should be see confirmation on console if everything went fine&lt;/p&gt;
  544.  
  545. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;[1098:0004-3984] 10/20/2020 11:26:55 AM  DemoAddin: UNLOADED (OK)
  546. [1098:0002-23A0] 10/20/2020 11:26:55 AM  RunJava: Finalized org/demo/DemoAddin Java task.
  547. [1098:0002-23A0] 10/20/2020 11:26:56 AM  RunJava shutdown.&lt;/code&gt;&lt;/pre&gt;
  548.  
  549. &lt;p&gt;If you are interested in this topic I can recommend at least two more sources
  550. &lt;a href=&quot;https://www.nsftools.com/tips/JavaAddinTest.java&quot;&gt;NSFTools.com JavaAddinTest&lt;/a&gt; and &lt;a href=&quot;https://github.com/AndyBrunner/Domino-JAddin&quot;&gt;AndyBrunner / Domino-JAddin&lt;/a&gt; or wait for new articles in my blog :-). Also feel free to ask questions if you are uncertain.&lt;/p&gt;
  551.  
  552. &lt;p&gt;Full version of DemoAddin class is hosted on github: &lt;a href=&quot;https://github.com/dpastov/DominoJavaAddin&quot;&gt;DominoDemoAddin&lt;/a&gt;&lt;/p&gt;
  553.  
  554. &lt;strong&gt;All articles in series&lt;/strong&gt;&lt;br&gt;
  555. &lt;ol&gt;
  556. &lt;li&gt;&lt;a href=&quot;https://dpastov.blogspot.com/2020/10/javaserveraddin-in-domino-introduction.html&quot;&gt;JavaServerAddin in Domino - introduction&lt;/a&gt;&lt;/li&gt;
  557. &lt;li&gt;&lt;a href=&quot;https://dpastov.blogspot.com/2020/10/javaserveraddin-in-domino-constructor.html&quot;&gt;JavaServerAddin in Domino - constructor and schedule&lt;/a&gt;&lt;/li&gt;
  558. &lt;/ol&gt;
  559. </description><link>https://dpastov.blogspot.com/2020/10/javaserveraddin-in-domino-constructor.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-1941771492360303198</guid><pubDate>Wed, 14 Oct 2020 07:00:00 +0000</pubDate><atom:updated>2020-10-20T11:51:25.792+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>JavaServerAddin in Domino - introduction</title><description>&lt;p style=&quot;text-align: justify;&quot;&gt;I will show how to build, register and load simple JavaAddin for Domino. I&#39;m not entirely sure if lotus.notes.addins.JavaServerAddin is supported by HCL, so use that for your own sake.&lt;/p&gt;
  560.  
  561. &lt;h3&gt;1) Java class&lt;/h3&gt;
  562.  
  563. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;import lotus.notes.addins.JavaServerAddin;
  564.  
  565. public class DemoAddin extends JavaServerAddin {
  566. public void runNotes() {
  567. AddInLogMessageText(&quot;Hello world&quot;, 0);
  568. }
  569. }&lt;/code&gt;&lt;/pre&gt;
  570. &lt;h3&gt;2) JAR - from project&lt;/h3&gt;
  571. &lt;p style=&quot;text-align: justify;&quot;&gt;Export/build JAR file from the DemoAddin project (we are going to put jar file in the Domino folder).&lt;/p&gt;
  572.  
  573. &lt;h3&gt;3) Register JavaAddin&lt;/h3&gt;
  574. &lt;p style=&quot;text-align: justify;&quot;&gt;Place JAR file under Domino, f.x. path could be (DemoAddin is a folder and it could be just any name, DemoAddin-1.jar is our JAR file we built earlier)&lt;/p&gt;
  575.  
  576. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;C:\IBM\Domino\DemoAddin\DemoAddin-1.jar&lt;/code&gt;&lt;/pre&gt;
  577. &lt;p style=&quot;text-align: justify;&quot;&gt;and then register it in server&#39;s notes.ini using variable &lt;b&gt;JAVAUSERCLASSES&lt;/b&gt;. In case if there are other addin registered there use semicolon as a separator for Windows and a colon for Linux&lt;/p&gt;
  578. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;JAVAUSERCLASSES=addin-1;.\DemoAddin\DemoAddin-1.jar;addin-2&lt;/code&gt;&lt;/pre&gt;
  579.  
  580. &lt;p style=&quot;text-align: justify;&quot;&gt;&lt;strong&gt;Alternatively&lt;/strong&gt; simply put JAR file into the folder \jvm\lib\ext, but personally I prefer to keep customization separately instead of mixing core JAR files with customization. Additionally I&#39;m not sure what happens to custom JAR file when is upgradet.&lt;/p&gt;
  581.  
  582. &lt;h3&gt;4) Load JavaAddin&lt;/h3&gt;
  583. &lt;p style=&quot;text-align: justify;&quot;&gt;It&#39;s time to run our DemoAddin. From console run following command&lt;/p&gt;
  584.  
  585. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;load runjava DemoAddin&lt;/code&gt;&lt;/pre&gt;
  586.  
  587. &lt;p style=&quot;text-align: justify;&quot;&gt;Take into account if your include your class into a package, f.x. package org.demo; than you should add that into run command&lt;/p&gt;
  588.  
  589. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;load runjava org.demo.DemoAddin&lt;/code&gt;&lt;/pre&gt;
  590.  
  591. &lt;p style=&quot;text-align: justify;&quot;&gt;If everything went fine you should see 3 lines&lt;/p&gt;
  592.  
  593. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;RunJava: Started DemoAddin Java task.
  594. Hello world
  595. RunJava: Finalized DemoAddin Java task.&lt;/code&gt;&lt;/pre&gt;
  596.  
  597. &lt;h3&gt;Possible error&lt;/h3&gt;
  598.  
  599. &lt;p style=&quot;text-align: justify;&quot;&gt;If you registered JAR file incorrectly, the error could be like this. In such case just make sure you followed steps properly.&lt;/p&gt;
  600.  
  601. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;RunJava: Can&#39;t find class DemoAddin1 or lotus/notes/addins/demoaddin1/DemoAddin1 in the classpath.  Class names are case-sensitive.&lt;/code&gt;&lt;/pre&gt;
  602.  
  603. &lt;p style=&quot;text-align: justify;&quot;&gt;If I find time, I will make few more posts about this topic. It&#39;s really just a tip of the iceberg.&lt;/p&gt;
  604.  
  605. &lt;strong&gt;All articles in series&lt;/strong&gt;&lt;br&gt;
  606. &lt;ol&gt;
  607. &lt;li&gt;&lt;a href=&quot;https://dpastov.blogspot.com/2020/10/javaserveraddin-in-domino-introduction.html&quot;&gt;JavaServerAddin in Domino - introduction&lt;/a&gt;&lt;/li&gt;
  608. &lt;li&gt;&lt;a href=&quot;https://dpastov.blogspot.com/2020/10/javaserveraddin-in-domino-constructor.html&quot;&gt;JavaServerAddin in Domino - constructor and schedule&lt;/a&gt;&lt;/li&gt;
  609. &lt;/ol&gt;
  610. </description><link>https://dpastov.blogspot.com/2020/10/javaserveraddin-in-domino-introduction.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>6</thr:total><georss:featurename>Copenhagen, Denmark</georss:featurename><georss:point>55.6760968 12.5683372</georss:point><georss:box>27.365862963821158 -22.587912799999998 83.986330636178849 47.7245872</georss:box></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-3749560390882886022</guid><pubDate>Wed, 26 Feb 2020 23:06:00 +0000</pubDate><atom:updated>2020-02-27T00:10:39.196+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><title>NotesRichText to HTML native within Domino 10</title><description>Just realized that Domino 10+ came with possibility to convert RichTextItem to HTML almost in 1 line.&lt;br /&gt;
  611. &lt;br /&gt;
  612. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;RichTextItem rt = (RichTextItem) doc.getFirstItem(&quot;Body&quot;);
  613. String html = rt.convertToHTML(null);
  614. &lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
  615. Finally all these tricky transformation of RichText to HTML can be removed, same goes to custom JSON and HTTPRequest libraries.&lt;br /&gt;
  616. &lt;br /&gt;
  617. I wonder what other useful improvements I missed?</description><link>https://dpastov.blogspot.com/2020/02/notesrichtext-to-html-native-from-10.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-4869138124769123073</guid><pubDate>Mon, 17 Feb 2020 22:24:00 +0000</pubDate><atom:updated>2020-02-17T23:31:39.455+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CloudFlare</category><category domain="http://www.blogger.com/atom/ns#">DSAPI</category><title>Rewrite URL with CloudFlare for Domino</title><description>&lt;div&gt;
  618. Years ago I created few solutions for Domino using DSAPI:&lt;/div&gt;
  619. &lt;ol&gt;
  620. &lt;li&gt;remove last slash in URL served by Domino.&lt;/li&gt;
  621. &lt;li&gt;rewrite URL.&lt;/li&gt;
  622. &lt;li&gt;better control over 404/500 error pages.&lt;/li&gt;
  623. &lt;/ol&gt;
  624. &lt;br /&gt;
  625. &lt;div&gt;
  626. It was quite complicated solution (DSAPI is not easy topic).&lt;/div&gt;
  627. &lt;div&gt;
  628. Today another client asked similar features (remove last slash and rewrite url).&lt;/div&gt;
  629. &lt;div&gt;
  630. I started to recall how DSAPI works but then I reminded myself that the client stick with CloudFlare in front of their Domino servers.&lt;/div&gt;
  631. &lt;br /&gt;
  632. &lt;div&gt;
  633. Cloudflare has &#39;page rules&#39; which allow to solve issue with last trailing slash. Just matter of configuration.&lt;/div&gt;
  634. &lt;br /&gt;
  635. &lt;div&gt;
  636. And about rewriting URL it&#39;s actually possible to achieve with workers! You can see below how to rewrite URL.&lt;/div&gt;
  637. &lt;div&gt;
  638. In example below I changed url like&lt;br /&gt;
  639. domain.com/section/page?param1=aaa&amp;amp;param2=bbb&lt;br /&gt;
  640. =&amp;gt;&lt;br /&gt;
  641. domain.com/router?openagent&amp;amp;req=section/page&amp;amp;param1=aaa&amp;amp;param2=bbb&lt;/div&gt;
  642. &lt;br /&gt;
  643. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;addEventListener(&#39;fetch&#39;, event =&amp;gt; {
  644.  const url = new URL(event.request.url);
  645.  const pathname = url.pathname.substr(1);
  646.  if (pathname.startsWith(&quot;design&quot;) || pathname.startsWith(&quot;files&quot;) || pathname.startsWith(&quot;api&quot;)) {
  647.    return;
  648.  }
  649.  event.respondWith(handleRequest(event.request));
  650. })
  651.  
  652. /**
  653. * Rewrite URL and makes query param available
  654. * @param {Request} request
  655. */
  656. async function handleRequest(request) {
  657.  let url = new URL(request.url);
  658.  let pathname = url.pathname.substr(1);
  659.  url.pathname = &quot;?openagent&amp;amp;req=&quot;+pathname;
  660.  var query = url.search;
  661.  if (query!=&quot;&quot;) {
  662.    url.pathname += &quot;&amp;amp;&quot; + query.substr(1);
  663.  }
  664.  
  665.  const newRequest = new Request(url, new Request(request));
  666.  return await fetch(newRequest)
  667. }
  668. &lt;/code&gt;&lt;/pre&gt;
  669. </description><link>https://dpastov.blogspot.com/2020/02/rewrite-url-with-cloudflare-for-domino.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-4083845564953667170</guid><pubDate>Wed, 25 Sep 2019 10:46:00 +0000</pubDate><atom:updated>2019-09-25T12:46:26.807+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">JSON</category><title>JSON Reader in LotusScript</title><description>For those who are still running Domino v9 (or below) here is a LotusScript library that can parse JSON into something useful. I implemented it some time ago and since that time almost had no issues with it. Since many customers that did not migrate to v10 (and probably won&#39;t do that in near future) it could be very useful to them.&lt;br /&gt;
  670. &lt;br /&gt;
  671. You can download my realization on github: &lt;a href=&quot;https://github.com/dpastov/jsonparser-ls&quot;&gt;jsonparser-ls&lt;/a&gt;&lt;br /&gt;
  672. &lt;br /&gt;
  673. See example below how it works&lt;br /&gt;
  674. &lt;br /&gt;
  675. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Dim parser As JSONParser
  676. Dim jsonObj As JSONObject
  677. Dim jsonArr As JSONArray
  678. Dim jsonString As String
  679.  
  680. Set parser = New JSONParser
  681.  
  682. &#39;object
  683. jsonString = |{&quot;array&quot;:[1,  2  ,   300.56  ]  ,  &quot;boolean&quot;:true,&quot;null&quot;:null,&quot;number&quot;:123,&quot;object&quot;:{&quot;a&quot;:&quot;b&quot;,&quot;c&quot;:&quot;d&quot;,&quot;arr&quot;:[&quot;12&quot;,&quot;23&quot;,34.56],&quot;e&quot;:&quot;f&quot;,&quot;ho&quot;:true},&quot;string&quot;:&quot;Hello World&quot;}|
  684. Set jsonObj = parser.parse(jsonString)
  685. &#39;test
  686. Print jsonObj.HasItem(&quot;array&quot;) &#39;true
  687. Print jsonObj.HasItem(&quot;array1&quot;) &#39;false
  688. print jsonObj.GetItem(&quot;array&quot;).Items(2) &#39;300.56
  689. print IsNull(jsonObj.GetItem(&quot;null&quot;)) &#39;true
  690. print jsonObj.GetItem(&quot;number&quot;) &#39;123
  691. print jsonObj.GetItem(&quot;object&quot;).getItem(&quot;c&quot;) &#39;d
  692. print jsonObj.GetItem(&quot;object&quot;).getItem(&quot;ho&quot;) &#39;true
  693. print jsonObj.GetItem(&quot;object&quot;).getItem(&quot;arr&quot;).Items(2) &#39;34.56
  694.  
  695. &#39;array
  696. jsonString = |[{a:1,b:true,_dd:null},12,&quot;13&quot;,true,{}]|
  697. Set jsonArr = parser.parse(jsonString)
  698. &#39;test
  699. print jsonArr.Items(0).getItem(&quot;b&quot;) &#39;true
  700. print jsonArr.Items(1) &#39;12
  701. print jsonArr.Items(2) &#39;13
  702. print jsonArr.Items(3) &#39;true
  703. print TypeName(jsonArr.Items(4)) &#39;&quot;JSONOBJECT&quot;&lt;/code&gt;&lt;/pre&gt;
  704. &lt;br /&gt;</description><link>https://dpastov.blogspot.com/2019/09/json-reader-in-lotusscript.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-6711847220246992020</guid><pubDate>Tue, 24 Sep 2019 12:02:00 +0000</pubDate><atom:updated>2019-09-24T14:03:13.800+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><category domain="http://www.blogger.com/atom/ns#">LS2J</category><title>Create Excel files with LotusScript without Excel installed</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;
  705. One of my customer asked me to find a solution to create Excel files using LotusScript on server without Excel on it (well who wants to do install Excel and other tools on Server). Took some time but I have made a proof of concept using&amp;nbsp;&lt;a href=&quot;https://poi.apache.org/&quot;&gt;Apache POI&lt;/a&gt; and it worked very very nice. I have also made a LS2J cover so it&#39;s more easily for people who are not familiar with Java to create Excel files.&lt;/div&gt;
  706. &lt;br /&gt;
  707. I put demo on my github account with some explanation so feel free to have a look on it: &lt;a href=&quot;https://github.com/dpastov/excel-apache-ls&quot;&gt;excel-apache-ls&lt;/a&gt;&amp;nbsp;but if you wonder how it works, see snippet below:&lt;br /&gt;
  708. &lt;br /&gt;
  709. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Option Public
  710. Option Declare
  711.  
  712. UseLSX &quot;*javacon&quot;
  713. Use &quot;Apache.Excel&quot;
  714.  
  715. Sub Initialize
  716. Dim jSession As JavaSession
  717. Dim jClass As Javaclass
  718. Dim jObject As JavaObject
  719. Dim filepath As String
  720. Dim row As Integer
  721.  
  722. Set jSession = New Javasession
  723. Set jClass = jSession.GetClass(&quot;explicants.office.Excel&quot;)
  724. Set jObject = jClass.Createobject()
  725. Call jObject.createSheet(&quot;sheet A-100&quot;)
  726. Call jObject.createSheet(&quot;sheet B-100&quot;)
  727. Call jObject.createSheet(&quot;sheet C-100&quot;)
  728. Call jObject.getSheet(&quot;sheet A-100&quot;)
  729.  
  730. row = row + 1
  731. Call jObject.setCellValueString(&quot;lorem&quot;, row, 0)
  732. Call jObject.setCellValueString(&quot;ipsum&quot;, row, 1)
  733. Call jObject.setCellValueDouble(55, row, 2)
  734. row = row + 1
  735. Call jObject.setCellValueString(&quot;hello&quot;, row, 0)
  736. Call jObject.setCellValueString(&quot;world&quot;, row, 1)
  737. Call jObject.setCellValueDouble(200.50, row, 2)
  738. row = row + 1
  739. Call jObject.setCellValueString(&quot;gurli gris&quot;, row, 0)
  740. Call jObject.setCellValueString(&quot;george&quot;, row, 1)
  741. Call jObject.setCellValueDouble(0.505, row, 2)
  742. filepath = Environ(&quot;Temp&quot;) &amp;amp; Join(Evaluate({@Unique})) &amp;amp; &quot;.xls&quot;
  743. Call jObject.saveAsFile(filepath)
  744. MsgBox filepath
  745. End Sub&lt;/code&gt;&lt;/pre&gt;
  746. &lt;br /&gt;</description><link>https://dpastov.blogspot.com/2019/09/create-excel-files-with-lotusscript.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-8696763436701578120</guid><pubDate>Tue, 03 Sep 2019 12:49:00 +0000</pubDate><atom:updated>2019-09-29T10:00:55.955+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">LS</category><title>Formatting NotesDatetime as Java SimpleDateFormat</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;Recently I had to made proper formatting of NotesDateTime object (using LotusScript) with respect to different locale. I had written a cover in LS2J for Java SimpleDateFormat class that works independently (without Java library), so copy/paste and go on.&lt;/div&gt;&lt;br /&gt;
  747. Here is an example how it works&lt;br /&gt;
  748. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Dim jdtr As New jDateTimeRich
  749. Dim dt As New NotesDateTime(&quot;15-10-2017 10:20:30&quot;)
  750.  
  751. MsgBox jdtr.SimpleDateFormat(dt, &quot;dd-MM-yyyy&quot;, &quot;&quot;, &quot;&quot;) &#39; &quot;15-10-2017&quot;
  752. MsgBox jdtr.SimpleDateFormat(dt, &quot;d-MMM-yy&quot;, &quot;ru&quot;, &quot;RU&quot;) &#39; &quot;15-окт-17&quot;
  753. MsgBox jdtr.SimpleDateFormat(dt, &quot;EEEEE MMMMM yyyy HH:mm:ss.SSSZ&quot;, &quot;da&quot;, &quot;DK&quot;) &#39; &quot;søndag oktober 2017 11:20:30.000+0200&quot;)
  754. &lt;/code&gt;&lt;/pre&gt;&lt;div&gt;&lt;code style=&quot;background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;&lt;br /&gt;
  755. &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;code style=&quot;background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;The beautiful part of it - is translation of months and days according to Locale.&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;I have uploaded source/class on github. Feel free to re-use it: &lt;a href=&quot;https://github.com/dpastov/jdatetimerich-ls&quot;&gt;&lt;b&gt;jDatetimeRich-LS&lt;/b&gt;&lt;/a&gt;&amp;nbsp;and report issues of course.&lt;/div&gt;&lt;/div&gt;</description><link>https://dpastov.blogspot.com/2019/09/formatting-notesdatetime-as-java.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-6610518483329320203</guid><pubDate>Tue, 17 Jul 2018 11:51:00 +0000</pubDate><atom:updated>2018-09-13T10:28:12.661+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Domino with Java 6 and TSL 1.2</title><description>Recently I have faced an issue where one of our provider changed SSL and they disabled supporting of TLS 1.0 (as far as I understand it&#39;s non secure ourdays) and TLS 1.2 should be used instead. As a result our java agents (which used HttpsURLConnection) could not connect anymore to provider.&lt;br /&gt;
  756. &lt;br /&gt;
  757. Error message looked like this:&lt;br /&gt;
  758. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Caused by: java.security.AccessControlException: Access denied (&lt;a href=&quot;http://javax.net/&quot;&gt;javax.net&lt;/a&gt;.ssl.SSLPermission setHostnameVerifier)&lt;/span&gt;&lt;/pre&gt;I have found 2 possible solutions:&lt;br /&gt;
  759. &lt;br /&gt;
  760. &lt;h3&gt;Enable TLS 1.2 on Domino (applicable only for 9.0.1 FP3 IF2 and higher)&lt;/h3&gt;&lt;br /&gt;
  761. The Domino JVM is based on Java 1.6 and default settings configured in a way to use TLS 1.0. Luckily our Domino servers had version 9.0.1 FP4 (and TSL 1.2 support has been added since FP3 IF2). So our version was capable to work with 1.2 (in theory) but it took some time to make it work.&lt;br /&gt;
  762. &lt;br /&gt;
  763. In order to configure Domino JVM to use TLS 1.2 you need to:&lt;br /&gt;
  764. &lt;ol&gt;&lt;li&gt;Create JVM settings file, f.x. C:\Domino\jvmOptions.ini&lt;/li&gt;
  765. &lt;li&gt;Add parameter in jvmOptions.ini&lt;br /&gt;
  766. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;https.protocols=TLSv1.2&lt;/span&gt;&lt;/pre&gt;&lt;/li&gt;
  767. &lt;li&gt;Add path to jvmOptions.ini file in notes.ini&lt;br /&gt;
  768. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;JavaUserOptionsFile=C:\Domino\jvmOptions.ini&lt;/span&gt;&lt;/pre&gt;&lt;/li&gt;
  769. &lt;/ol&gt;After you added settings don&#39;t forget to restart Domino server. Keep in mind that setting is global meaning all agents that will start to use TLS1.2 therefore it is definitely worth to verify everything before and after this fix.&lt;br /&gt;
  770. &lt;br /&gt;
  771. &lt;h3&gt;Java library solution&lt;/h3&gt;&lt;br /&gt;
  772. If that is not a way you can go with (f.x. Domino has lower version or something won&#39;f work if you switch to TLS 1.2) then it&#39;s still possible to make custom Java Library that will make it possible, see link: &lt;a href=&quot;https://stackoverflow.com/questions/33364100/how-to-use-tls-1-2-in-java-6&quot;&gt;How to use TLS 1.2 in Java 6&lt;/a&gt;.&lt;br /&gt;
  773. &lt;br /&gt;
  774. It worked for me as well, but it requires to give permission in java policy on Domino server.</description><link>https://dpastov.blogspot.com/2018/07/domino-with-java-6-and-tsl-12.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-4574629473821550347</guid><pubDate>Wed, 08 Mar 2017 14:31:00 +0000</pubDate><atom:updated>2017-03-09T09:38:33.960+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Play Framework</category><title>View.html.index cannot be resolved to a type</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;If your play project in eclipse says that it can&#39;t resolve a type (see message below), but you are certain that everything should be fine&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ View.html.index cannot be resolved to a type
  775. &lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;try to make a clean compile&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ activator clean compile eclipse&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;It helped me to resolve my issue.&lt;/div&gt;</description><link>https://dpastov.blogspot.com/2017/03/viewhtmlindex-cannot-be-resolved-to-type.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-1670596980056503904</guid><pubDate>Thu, 12 Jan 2017 12:08:00 +0000</pubDate><atom:updated>2017-01-12T13:08:49.000+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Play Framework</category><title>Kill Play Framework process</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;When we run application in DEV mode (using command activator run) the process normally will be killed when terminal is closed. It&#39;s pretty easy since PID is started/closed automatically and therefore we do not care about it at all.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Once we start application in PROD mode there is a file RUNNING_PID is created (./target/universal/stage/RUNNING_PID). There is a command (since version 2.4) in activator (stopProd) which will close PID&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ activator stopProd&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Alternatively you can just kill process &#39;manually&#39;&lt;br /&gt;
  776. &lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ kill $(cat target/universal/stage/RUNNING_PID)&lt;/span&gt;&lt;/pre&gt;</description><link>https://dpastov.blogspot.com/2017/01/kill-play-framework-process.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-802839450719715223</guid><pubDate>Thu, 12 Jan 2017 09:31:00 +0000</pubDate><atom:updated>2017-01-12T15:18:18.096+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Play Framework</category><title>Play Framework project in production - Building process</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;We want to deploy our Play project to production environment.&lt;/div&gt;&lt;br /&gt;
  777. &lt;h3&gt;Create a binary version of application&lt;/h3&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;There are two commands that can help you to make a build. Simply run &lt;b&gt;dist&lt;/b&gt; (it invokes universal:packageBin) or &lt;b&gt;universal:packageZipTarball&lt;/b&gt; in Play console and wait&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ dist&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ universal:packageZipTarball&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Result will be a ZIP or TGZ file located in target/universal folder with everything needed for you project (it means you do not need to install SBT or Activator on your server, just pure Java). Once you extract ZIP you will find 2 runner files in bin folder (one for unix and one for windows). Just run it and your server will up&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ path/to/hellow-world/bin/hello-world-app
  778. [info] play.api.Play - Application started (Prod)
  779. [info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Make sure you have rights to run server, sometimes you need to give rights (see example below)&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ chmod +x /path/to/bin/project-name&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;To run process in background&lt;br /&gt;
  780. &lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ sudo nohup target/universal/stage/bin/eqa-app -Dhttp.port=80 -Dplay.crypto.secret=&quot;secret_token_123&quot; &lt;/dev/null &gt;/dev/null 2&gt;&amp;1 &amp;&lt;/span&gt;&lt;/pre&gt;</description><link>https://dpastov.blogspot.com/2017/01/play-project-production-building-process.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-6201891631946620722</guid><pubDate>Thu, 12 Jan 2017 07:00:00 +0000</pubDate><atom:updated>2017-01-12T10:32:58.600+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Play Framework</category><title>Play Framework project in production - Application Secret</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;I am going to make series of articles about how to deploy &lt;a href=&quot;https://www.playframework.com/&quot;&gt;Play Framework&lt;/a&gt;&amp;nbsp;(version 2.5) application on &lt;a href=&quot;https://www.centos.org/&quot;&gt;centOS&lt;/a&gt;&amp;nbsp;together with build system &lt;a href=&quot;https://jenkins.io/&quot;&gt;Jenkins&lt;/a&gt;. I&#39;m doing this first time and want to document everything for myself and at the same time I hope it can be useful for somebody else as well.&lt;br /&gt;
  781. &lt;br /&gt;
  782. Before I wrote few articles how to setup hello-world project on centOS or macOS however now I&#39;m going to work on production setup. I assume you already have you hello-world project and clean centOS environment.&lt;br /&gt;
  783. &lt;br /&gt;
  784. Let&#39;s have a look on important moment.&lt;br /&gt;
  785. &lt;/div&gt;&lt;br /&gt;
  786. &lt;h1&gt;Application secret&lt;/h1&gt;&lt;br /&gt;
  787. &lt;div style=&quot;text-align: justify;&quot;&gt;Each play application has secret key which is used for signing session and some other important stuff. It is not possible to run play project in production mode in case if secret is not set or if it is set to default value &#39;changeme&#39;. Secret key is stored in application.conf file /path/to/hello-word/conf/application.conf in variable play.crypto.secret (see below).&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;## Secret key
  788. # http://www.playframework.com/documentation/latest/ApplicationSecret
  789. # ~~~~~
  790. # The secret key is used to sign Play&#39;s session cookie.
  791. # This must be changed for production, but we don&#39;t recommend you change it in this file.
  792. play.crypto.secret = &quot;changeme&quot;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Of course we should not share our secret key and therefore it has to be used/stored on production side only.&lt;br /&gt;
  793. &lt;/div&gt;&lt;br /&gt;
  794. There are at least 3 ways how we can use secret key on production side.&lt;br /&gt;
  795. &lt;br /&gt;
  796. &lt;h3&gt;1. Secret key as a parameter&lt;/h3&gt;It is fine if you have simple application on 1 server, but I would not really recommend that for bigger project.&lt;br /&gt;
  797. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;/path/to/hello-world -Dplay.crypto.secret=&quot;secret_token_123&quot;
  798. &lt;/span&gt;&lt;/pre&gt;&lt;h3&gt;2. Environment variables&lt;/h3&gt;That would read variable from OS environment, otherwise default value will be used (actually the last defined one, in example below it is &quot;chagneme&quot;).&lt;br /&gt;
  799. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;play.crypto.secret=&quot;changeme&quot;
  800. play.crypto.secret=${?APPLICATION_SECRET}&lt;/span&gt;&lt;/pre&gt;&lt;h3&gt;3. Use separate configuration file&lt;/h3&gt;Separate configuration is probably the best way to go.&lt;br /&gt;
  801. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;include &quot;application&quot;
  802. play.crypto.secret=&quot;QCY?tAnfk?aZ?iwrNwnxIlR6CTf:G3gf:90Latabg@5241AB`R5W:1uDFN];Ik@n&quot;
  803. &lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;They include config while running application.&lt;br /&gt;
  804. &lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;/path/to/hello-word/bin/yourapp -Dconfig.file=/path/to/production.conf&lt;/span&gt;&lt;/pre&gt;&lt;h3&gt;Secret tools&lt;br /&gt;
  805. &lt;/h3&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;There are few already builtin function that can help you deal with secrets: playGenerateSecret (generate secret) and playUpdateSecret (generate and update into config).&lt;br /&gt;
  806. &lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;$ playGenerateSecret
  807. [info] Generated new secret: G28Dze]Z4lr@Or_9DCoz;tT_yCj6opKkkIh27K&gt;[0l_NT9lZaFfs?=zx[Wulz&gt;cX
  808. [success] Total time: 0 s, completed Jan 11, 2017 6:24:12 PM
  809. &lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;$ playUpdateSecret
  810. [info] Generated new secret: QmJ?udauJgDj34AYifbprJvbT5I8^Vw1MY0WmbYRscZmAOotkalbhXbIs^48_Uc9
  811. [info] Updating application secret in /Users/dpa/git/eqa-app/conf/application.conf
  812. [info] Replacing old application secret: changeme
  813. [success] Total time: 0 s, completed Jan 11, 2017 9:22:06 PM
  814. &lt;/span&gt;&lt;/pre&gt;</description><link>https://dpastov.blogspot.com/2017/01/play-project-production-application-secret.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-5478261138628991011</guid><pubDate>Sun, 25 Dec 2016 18:55:00 +0000</pubDate><atom:updated>2016-12-25T19:58:08.765+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Play Framework</category><title>HTTP Routing in Play Framework</title><description>&lt;p&gt;We are going to check how Play connect http requests with our code. F.x. when user hits http://localhost:9000/ what happens?&lt;/p&gt;&lt;h3&gt;HTTP Routing&lt;/h3&gt;&lt;p&gt;There is already built in http router in Play Framework. It allows to connect incoming requests with &lt;a href=&quot;https://dpastov.blogspot.dk/2016/12/actions-in-play-framework-25.html&quot; title=&quot;Action in Play Framework&quot;&gt;Play Action&lt;/a&gt; and therefore with public method in a controller class.&lt;/p&gt;&lt;h3&gt;Configuring HTTP Routing&lt;/h3&gt;&lt;p&gt;Normally the configuration for HTTP routing is located in conf/routes. See example:&lt;/p&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;# Static path
  815. GET   /clients/all                  controllers.Clients.list()
  816. # Dynamic path
  817. GET   /clients/:id                  controllers.Clients.show(id: Long)
  818. GET   /files/*name               controllers.Application.download(name)
  819. # Dynamic parts with regexp
  820. GET   /items/$id&lt;[0-9]+&gt;    controllers.Items.show(id: Long)
  821. &lt;/span&gt;&lt;/pre&gt;&lt;p&gt;If there are few routes are matched for the same request then the first one in a configuration file will be used.&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2016/12/http-routing-in-play-framework.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-3485099017221828262</guid><pubDate>Fri, 23 Dec 2016 07:00:00 +0000</pubDate><atom:updated>2016-12-23T08:00:32.463+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><title>Template literals</title><description>&lt;p&gt;I have to follow up with changes to ES6. Today I noticed template literals (there is also tagged template literals but that I will check later).&lt;br /&gt;
  822. I am really happy with that, it is simple and helps a lot.&lt;/p&gt;&lt;p&gt;Template literals are a new feature in ES6 that provide us string template things!&lt;/p&gt;&lt;p&gt;Let&#39;s have a look on real example&lt;/p&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;var a = &quot;Apples&quot;;
  823. var b = 10;
  824. console.log(`I would like to buy ${b+b} ${a}.`);
  825. // I would like to buy 20 Apples.&lt;/span&gt;&lt;/pre&gt;</description><link>https://dpastov.blogspot.com/2016/12/template-literals.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-75119149454015195</guid><pubDate>Thu, 22 Dec 2016 15:13:00 +0000</pubDate><atom:updated>2016-12-22T16:37:22.869+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Play Framework</category><title>Actions in Play Framework 2.5</title><description>&lt;p&gt;Requests that come to application based on Play usually are processed by thing which is called action.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Action&lt;/strong&gt; it is just a method that processes parameters of requests and sends result back to web client&lt;/p&gt;&lt;p&gt;Let&#39;s look on example below&lt;/p&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;package controllers;
  826.  
  827. import play.mvc.*;
  828.  
  829. /**
  830. * This controller contains an action to handle HTTP requests
  831. * to the application&#39;s home page.
  832. */
  833. public class HomeController extends Controller {
  834.  
  835.    /**
  836.     * An action that renders an HTML page with a welcome message.
  837.     * The configuration in the &lt;code&gt;routes&lt;/code&gt; file means that
  838.     * this method will be called when the application receives a
  839.     * &lt;code&gt;GET&lt;/code&gt; request with a path of &lt;code&gt;/&lt;/code&gt;.
  840.     */
  841.    public Result index() {
  842.        return ok(&quot;Hello World!&quot;);
  843.    }
  844.  
  845. }&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;We see an action index that return Result (HTTP response which we send to web client).&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2016/12/actions-in-play-framework-25.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-4810745915189334794</guid><pubDate>Wed, 21 Dec 2016 11:06:00 +0000</pubDate><atom:updated>2016-12-21T12:06:29.565+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Play Framework</category><category domain="http://www.blogger.com/atom/ns#">Typesafe</category><title>Hello World on Play Framework 2.5 on OSX</title><description>&lt;h2&gt;Today we are going to make Hello World project based on Play Framework 2.5 on OS X&lt;/h2&gt;&lt;p&gt;I&#39;m getting back to &lt;a href=&quot;https://www.playframework.com/&quot;&gt;Play Framework&lt;/a&gt; again and I&#39;m going to build simple start project.&lt;/p&gt;&lt;h3&gt;1. Checking if Java is installed&lt;/h3&gt;&lt;p&gt;Make sure you have java installed.&lt;/p&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;java -version&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;If java is installed you will see message like that:&lt;/p&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;java version &quot;1.8.0_45&quot;
  846. Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
  847. Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
  848. &lt;/span&gt;&lt;/pre&gt;&lt;h3&gt;2. Installing Typesafe activator (current version is 1.3.12)&lt;/h3&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;brew install typesafe-activator&lt;/span&gt;&lt;/pre&gt;&lt;h3&gt;3. Let&#39;s create a new project&lt;/h3&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;activator new hello-world
  849. &lt;/span&gt;&lt;/pre&gt;&lt;p&gt;Activator will ask you what template you want to use for new project? (I used play-java).&lt;br /&gt;
  850. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;  1) minimal-akka-java-seed
  851.  2) minimal-akka-scala-seed
  852.  3) minimal-java
  853.  4) minimal-scala
  854.  5) play-java
  855.  6) play-scala
  856. &lt;/span&gt;&lt;/pre&gt;&lt;p&gt;That will create a java project for us&lt;/p&gt;&lt;p&gt;Now let&#39;s run it. Go into newly create project and run activator&lt;/p&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;activator run
  857. &lt;/span&gt;&lt;/pre&gt;&lt;p&gt;That will run our project and up server as well. You can access project by localhost:9000&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2016/12/hello-world-on-play-framework-25-on-osx.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>3</thr:total></item></channel></rss>
Copyright © 2002-9 Sam Ruby, Mark Pilgrim, Joseph Walton, and Phil Ringnalda