<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: has12zen</title>
    <description>The latest articles on DEV Community by has12zen (@has12zen).</description>
    <link>https://dev.to/has12zen</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F514411%2Fad9b9887-d443-44d9-bd8b-2304cc178236.jpeg</url>
      <title>DEV Community: has12zen</title>
      <link>https://dev.to/has12zen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/has12zen"/>
    <language>en</language>
    <item>
      <title>Using Cron keep your eyes in check</title>
      <dc:creator>has12zen</dc:creator>
      <pubDate>Sun, 26 Sep 2021 16:42:57 +0000</pubDate>
      <link>https://dev.to/has12zen/using-cron-keep-your-eyes-in-check-k83</link>
      <guid>https://dev.to/has12zen/using-cron-keep-your-eyes-in-check-k83</guid>
      <description>&lt;h2&gt;
  
  
  basic syntax for cron
&lt;/h2&gt;

&lt;p&gt;a typical cron job looks like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# m h  dom mon dow   command
  * *   *   *   *   /usr/bin/sh ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;stand for wildcard
this is not a cron tutorial this is just how i use it. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  eyes.sh script
&lt;/h2&gt;

&lt;p&gt;the bash script looks like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/sh
export DISPLAY=:0
notify-send "EYES CHECK" "Look away for 15 seconds"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;without line no 2 it wont work as it sets the display for notify-send. I am using notify-send as my notification daemon. &lt;/p&gt;

&lt;p&gt;make sure that your display is :0 &lt;br&gt;
you can do this with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo $DISPLAY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  setting up crontab
&lt;/h2&gt;

&lt;p&gt;first you will need to make sure cron is running you can do this  by:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl status cronie
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;p.s. this is specific to arch based system.&lt;/p&gt;

&lt;p&gt;once cron is running you can create/edit cron job with &lt;code&gt;crontab -e&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then paste the code present below into the window.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*/15 * * * * /usr/bin/sh  /home/elnovo/.noti/eyes.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it runs every 15 min and eyes.sh is the bash script we discussed above. save it. &lt;br&gt;
you can find the cron jobs currently present by &lt;code&gt;crontab -l&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  sources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://askubuntu.com/questions/298608/notify-send-doesnt-work-from-crontab"&gt;notify-send doesn't work from crontab&lt;/a&gt;&lt;/p&gt;

</description>
      <category>bash</category>
      <category>linux</category>
      <category>wellbeing</category>
    </item>
    <item>
      <title>Automatic Program Verification using Dafny</title>
      <dc:creator>has12zen</dc:creator>
      <pubDate>Fri, 16 Apr 2021 14:13:41 +0000</pubDate>
      <link>https://dev.to/has12zen/automatic-program-verification-using-dafny-3cii</link>
      <guid>https://dev.to/has12zen/automatic-program-verification-using-dafny-3cii</guid>
      <description>&lt;h2&gt;
  
  
  Program Verification
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Program Verification is the process of proving that the program does exactly what the developer intended it to do and noting more.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;basically it can help prevent us from creating something like &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpodgy06c3wxcao7tf8e4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpodgy06c3wxcao7tf8e4.png" alt="HAL"&gt;&lt;/a&gt;&lt;br&gt;
not exactly but close enough.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why testing is not enough
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;“Testing shows the &lt;strong&gt;presence&lt;/strong&gt;, not the &lt;strong&gt;absence&lt;/strong&gt; of bugs”          &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;-Edsgar W. Dijkstra&lt;/p&gt;

&lt;p&gt;For this post HAL is not a super smart AI but a simple program that performs arithmetic operations.&lt;br&gt;
if we were to test HAL he is smart enough to give us correct output for our questions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hal what is 2 + 2?
HAL: 4
HAL what is 2*2 ?
HAL: 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;HAL gives correct answers to our questions in our test does this mean HAL works as we intended it to work.&lt;/p&gt;

&lt;p&gt;Spoiler alert &lt;br&gt;
No&lt;/p&gt;

&lt;p&gt;HAL can be returning 2 every time we run it and we wound not notice it with such test. In real life no one will use such small test for their program but even with exhaustive testing we cannot say with 100% confidence that program will work.&lt;/p&gt;
&lt;h2&gt;
  
  
  So what is the solution?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Formal Methods &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Formal methods is just a fancy way of using mathematics in the verification of your program. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsw4jm7lg2dyhjm3p3x4a.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsw4jm7lg2dyhjm3p3x4a.jpg" alt="mathematics meme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Formal methods are really difficult to do and this article is not exactly about them so I'll get straight to the point. but remember that a program that does formal verification for us will take the code we write and what the code is supposed to do from us in order to verify it.&lt;/p&gt;
&lt;h2&gt;
  
  
  Dafny
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Dafny is programming language that helps us in doing formal verification&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;dafny is close to C# so a lot of thing are similar in dafny.&lt;/p&gt;

&lt;p&gt;The most cool thing about Dafny is it can show we are making a mistake while we are writing the code.&lt;/p&gt;

&lt;p&gt;Eg:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;method&lt;/span&gt; &lt;span class="nf"&gt;Double&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="n"&gt;requires&lt;/span&gt;  &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;
   &lt;span class="n"&gt;ensures&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;==&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;*&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="p"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the above code has a method Double which returns the double value of the int it takes in.&lt;br&gt;
The keywords &lt;strong&gt;ensures&lt;/strong&gt; and &lt;strong&gt;requires&lt;/strong&gt; give us a way to specify what the code is supposed to do.&lt;br&gt;
If we make some silly mistake and instead of + we write - dafny will show the error to us&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F160vkzagydfy6q3jthzk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F160vkzagydfy6q3jthzk.png" alt="Dafny example "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dafny has a really good guide for learning all of this stuff which you can check out &lt;a href="https://rise4fun.com/dafny/tutorialcontent/guide" rel="noopener noreferrer"&gt;Best Guide&lt;/a&gt; and below I will be summarizing what I learned from it.&lt;/p&gt;
&lt;h2&gt;
  
  
  Summary from what I learnt
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Can detect bugs while writing code.&lt;/li&gt;
&lt;li&gt;Similar to C# and can be installed with &lt;a href="https://marketplace.visualstudio.com/items?itemName=correctnessLab.dafny-vscode#:~:text=This%20extension%20adds%20Dafny%203.0,requires%20the%20Dafny%20language%20server." rel="noopener noreferrer"&gt;VS code extension&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Provides a great learning opportunity.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Disadvantages
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Dafny uses the Boogie Intermediate language and Z3 SMT solver so is limited by what they both can do.&lt;/li&gt;
&lt;li&gt;Dafny cannot be used for existing code we need to write new code to use dafny.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Different parts of Dafny
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Method
&lt;/h4&gt;

&lt;p&gt;A method is function which takes zero or more arguments and returns zero or more  values. it is differnt than functions present inside dafny. The main method in dafny is Main()&lt;br&gt;
it is not necessary for verification but we need it for getting a .net executable from our code as the execution of code will begins here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt; &lt;span class="n"&gt;method&lt;/span&gt; &lt;span class="nf"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
 &lt;span class="p"&gt;{&lt;/span&gt;

   &lt;span class="n"&gt;print&lt;/span&gt; &lt;span class="s"&gt;"Hello World"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="n"&gt;print&lt;/span&gt; &lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Function
&lt;/h4&gt;

&lt;p&gt;the keyword function is used for pure functions in dafny. they cannot change the state of program and are ghost by default menas they do not appear in the compiled code. They are used to define mathematical logic.&lt;br&gt;
eg:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fib&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;nat&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="n"&gt;nat&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt; &lt;span class="n"&gt;then&lt;/span&gt;  &lt;span class="n"&gt;n&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;
        &lt;span class="nf"&gt;fib&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;fib&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Pre and Post Conditions
&lt;/h4&gt;

&lt;p&gt;They help in specifying the specifications of the program a precondition must be true before the execution of method and a post condition must be true after the execution of the program.&lt;/p&gt;

&lt;h4&gt;
  
  
  loop invariants
&lt;/h4&gt;

&lt;p&gt;They specify the range of loop condition  suppose for a loop i goes from 0 to n then we can specify loop invariants as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;
   &lt;span class="n"&gt;invariant&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;
   &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="n"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They help in dafny in understanding how many times the loop occurs.&lt;/p&gt;

&lt;h4&gt;
  
  
  Termination
&lt;/h4&gt;

&lt;p&gt;Dafny can automatically determine if a loop will terminate or not&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;
       &lt;span class="n"&gt;invariant&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;
   &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
       &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;}&lt;/span&gt;
       &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;==&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;}&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When we run this code we see dafny knows the code terminates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fiboncacci verification using dafny
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fib&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;nat&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="n"&gt;nat&lt;/span&gt;
&lt;span class="n"&gt;decreases&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt; &lt;span class="n"&gt;then&lt;/span&gt;  &lt;span class="n"&gt;n&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;
        &lt;span class="nf"&gt;fib&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;fib&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="n"&gt;method&lt;/span&gt; &lt;span class="nf"&gt;ComputeFib&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;nat&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;nat&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ensures&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="nf"&gt;fib&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="p"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="p"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="p"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;
        &lt;span class="n"&gt;invariant&lt;/span&gt;  &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;
        &lt;span class="n"&gt;invariant&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="nf"&gt;fib&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;invariant&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="nf"&gt;fib&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="p"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


 &lt;span class="n"&gt;method&lt;/span&gt; &lt;span class="nf"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
 &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="p"&gt;:=&lt;/span&gt; &lt;span class="nf"&gt;ComputeFib&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;6&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="n"&gt;print&lt;/span&gt; &lt;span class="s"&gt;"fib(6):= "&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="n"&gt;print&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="n"&gt;print&lt;/span&gt; &lt;span class="s"&gt;"\n"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>dafny</category>
      <category>verification</category>
    </item>
    <item>
      <title>KWoC Project Report</title>
      <dc:creator>has12zen</dc:creator>
      <pubDate>Fri, 08 Jan 2021 09:19:44 +0000</pubDate>
      <link>https://dev.to/has12zen/kwoc-draft-6ef</link>
      <guid>https://dev.to/has12zen/kwoc-draft-6ef</guid>
      <description>&lt;h1&gt;
  
  
  About KWoC
&lt;/h1&gt;

&lt;p&gt;KWOC — Kharagpur Winter of Code is a 5-week long online program organized by KOSS for the students of various colleges, especially for students of IIT Kharagpur, who are new to open source software development.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Projects I contributed to
&lt;/h1&gt;

&lt;p&gt;During KWoC I contributed to two projects &lt;code&gt;web-development-Resource&lt;/code&gt;, &lt;code&gt;url-shortener&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;web-development-Resource&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Under the direction of my Mentor, I started working on resources of Node.Js, and HTML. In this project, I collected resources and organized them in a structure.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m_jKO1gM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a7t6faui6hkem3xttjw0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m_jKO1gM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a7t6faui6hkem3xttjw0.png" alt="Screenshot (20)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;url-shortener&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I worked on making the basic structure of the URL-shortener Chrome extension this extension uses Rebrandly API to shorten URLs and also gives QR code for scanning the current URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CzxzoSev--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xtxa9f4becxcxj0ffboa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CzxzoSev--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xtxa9f4becxcxj0ffboa.png" alt="Screenshot (49)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;My experience with KWoC &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I had quite a good time working on projects in KWoC I always wanted to work on Open source and KWoC finally gave me the push that I needed to get started. I also learned how to effectively communicate with mentors and peers during working on these projects. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Links to the Repos I contributed to&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Closed PR's&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_github-liquid-tag"&gt;
  &lt;h1&gt;
    &lt;a href="https://github.com/the-browser-toolbox/url-shortener/pull/14"&gt;
      &lt;img class="github-logo" alt="GitHub logo" src="https://res.cloudinary.com/practicaldev/image/fetch/s--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg"&gt;
      &lt;span class="issue-title"&gt;
        Used Rebrandly API to shorten link and updated UI
      &lt;/span&gt;
      &lt;span class="issue-number"&gt;#14&lt;/span&gt;
    &lt;/a&gt;
  &lt;/h1&gt;
  &lt;div class="github-thread"&gt;
    &lt;div class="timeline-comment-header"&gt;
      &lt;a href="https://github.com/has12zen"&gt;
        &lt;img class="github-liquid-tag-img" src="https://res.cloudinary.com/practicaldev/image/fetch/s--i_5fC51W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://avatars2.githubusercontent.com/u/57583693%3Fv%3D4" alt="has12zen avatar"&gt;
      &lt;/a&gt;
      &lt;div class="timeline-comment-header-text"&gt;
        &lt;strong&gt;
          &lt;a href="https://github.com/has12zen"&gt;has12zen&lt;/a&gt;
        &lt;/strong&gt; posted on &lt;a href="https://github.com/the-browser-toolbox/url-shortener/pull/14"&gt;&lt;time&gt;Dec 11, 2020&lt;/time&gt;&lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag-github-body"&gt;
      &lt;h1&gt;
&lt;span class="octicon octicon-link"&gt;&lt;/span&gt;&lt;strong&gt;Pull request template for the-browser-toolbox/url-shortener.&lt;/strong&gt;
&lt;/h1&gt;
&lt;h3&gt;
&lt;span class="octicon octicon-link"&gt;&lt;/span&gt;&lt;em&gt;Create a pull request to add your new features or bug fixes.&lt;/em&gt;
&lt;/h3&gt;

&lt;h2&gt;
&lt;span class="octicon octicon-link"&gt;&lt;/span&gt;Description&lt;/h2&gt;
&lt;p&gt;Used rebrandly API to shorten the URL and also added Qr code panel to display the current page as Qr code&lt;/p&gt;
&lt;h2&gt;
&lt;span class="octicon octicon-link"&gt;&lt;/span&gt;Related Issue&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Please link to the related issue here.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
&lt;span class="octicon octicon-link"&gt;&lt;/span&gt;Proposed Changes:&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;using Rebradly API&lt;/li&gt;
&lt;li&gt;Adding Qr code panel&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;
&lt;span class="octicon octicon-link"&gt;&lt;/span&gt;Screenshots&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Updated Screenshot&lt;/strong&gt;
&lt;a href="https://user-images.githubusercontent.com/57583693/101897434-8e34e680-3bd0-11eb-919c-684c43a5b042.png" rel="nofollow"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vsEqTTKA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/57583693/101897434-8e34e680-3bd0-11eb-919c-684c43a5b042.png" alt="Screenshot (50)"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://user-images.githubusercontent.com/57583693/101897535-b7557700-3bd0-11eb-95ad-76a2fe6a22dd.png" rel="nofollow"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9zqleGW0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/57583693/101897535-b7557700-3bd0-11eb-95ad-76a2fe6a22dd.png" alt="Screenshot (47)"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://user-images.githubusercontent.com/57583693/101897636-db18bd00-3bd0-11eb-8514-a1a76c47d734.png" rel="nofollow"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gifQKjSp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/57583693/101897636-db18bd00-3bd0-11eb-8514-a1a76c47d734.png" alt="Screenshot (48)"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://user-images.githubusercontent.com/57583693/101897738-01d6f380-3bd1-11eb-9682-fc4f77f67693.png" rel="nofollow"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X1uHCEKr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/57583693/101897738-01d6f380-3bd1-11eb-9682-fc4f77f67693.png" alt="Screenshot (49)"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Please use the &lt;a href="https://gitter.im/the-browser-toolbox/community" rel="nofollow"&gt;Gitter&lt;/a&gt; channel to update about your pull request.&lt;/p&gt;

    &lt;/div&gt;
    &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/the-browser-toolbox/url-shortener/pull/14"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;div class="ltag_github-liquid-tag"&gt;
  &lt;h1&gt;
    &lt;a href="https://github.com/Surajbokde/web-development-Resource/pull/14"&gt;
      &lt;img class="github-logo" alt="GitHub logo" src="https://res.cloudinary.com/practicaldev/image/fetch/s--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg"&gt;
      &lt;span class="issue-title"&gt;
        Added Node.js Resources
      &lt;/span&gt;
      &lt;span class="issue-number"&gt;#14&lt;/span&gt;
    &lt;/a&gt;
  &lt;/h1&gt;
  &lt;div class="github-thread"&gt;
    &lt;div class="timeline-comment-header"&gt;
      &lt;a href="https://github.com/has12zen"&gt;
        &lt;img class="github-liquid-tag-img" src="https://res.cloudinary.com/practicaldev/image/fetch/s--i_5fC51W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://avatars2.githubusercontent.com/u/57583693%3Fv%3D4" alt="has12zen avatar"&gt;
      &lt;/a&gt;
      &lt;div class="timeline-comment-header-text"&gt;
        &lt;strong&gt;
          &lt;a href="https://github.com/has12zen"&gt;has12zen&lt;/a&gt;
        &lt;/strong&gt; posted on &lt;a href="https://github.com/Surajbokde/web-development-Resource/pull/14"&gt;&lt;time&gt;Dec 06, 2020&lt;/time&gt;&lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag-github-body"&gt;
      &lt;p&gt;&lt;a href="https://user-images.githubusercontent.com/57583693/101274716-5c81e100-37c6-11eb-8322-e6b281711908.png" rel="nofollow"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DjNnNppA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/57583693/101274716-5c81e100-37c6-11eb-8322-e6b281711908.png" alt="Screenshot_2020-12-06 has12zen web-development-Resource"&gt;&lt;/a&gt;&lt;/p&gt;

    &lt;/div&gt;
    &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Surajbokde/web-development-Resource/pull/14"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;div class="ltag_github-liquid-tag"&gt;
  &lt;h1&gt;
    &lt;a href="https://github.com/Surajbokde/web-development-Resource/pull/17"&gt;
      &lt;img class="github-logo" alt="GitHub logo" src="https://res.cloudinary.com/practicaldev/image/fetch/s--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg"&gt;
      &lt;span class="issue-title"&gt;
        added HTML resources
      &lt;/span&gt;
      &lt;span class="issue-number"&gt;#17&lt;/span&gt;
    &lt;/a&gt;
  &lt;/h1&gt;
  &lt;div class="github-thread"&gt;
    &lt;div class="timeline-comment-header"&gt;
      &lt;a href="https://github.com/has12zen"&gt;
        &lt;img class="github-liquid-tag-img" src="https://res.cloudinary.com/practicaldev/image/fetch/s--i_5fC51W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://avatars2.githubusercontent.com/u/57583693%3Fv%3D4" alt="has12zen avatar"&gt;
      &lt;/a&gt;
      &lt;div class="timeline-comment-header-text"&gt;
        &lt;strong&gt;
          &lt;a href="https://github.com/has12zen"&gt;has12zen&lt;/a&gt;
        &lt;/strong&gt; posted on &lt;a href="https://github.com/Surajbokde/web-development-Resource/pull/17"&gt;&lt;time&gt;Dec 06, 2020&lt;/time&gt;&lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag-github-body"&gt;
      &lt;p&gt;&lt;a href="https://user-images.githubusercontent.com/57583693/101288179-2c186200-381b-11eb-87c8-5ccc17a19dbc.png" rel="nofollow"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WWOOkwTQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/57583693/101288179-2c186200-381b-11eb-87c8-5ccc17a19dbc.png" alt="Screenshot_2020-12-06 has12zen web-development-Resource(1)"&gt;&lt;/a&gt;&lt;/p&gt;

    &lt;/div&gt;
    &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Surajbokde/web-development-Resource/pull/17"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>opensource</category>
    </item>
    <item>
      <title>Open ID protocol</title>
      <dc:creator>has12zen</dc:creator>
      <pubDate>Sun, 15 Nov 2020 11:15:47 +0000</pubDate>
      <link>https://dev.to/has12zen/open-id-protocol-1pil</link>
      <guid>https://dev.to/has12zen/open-id-protocol-1pil</guid>
      <description>&lt;p&gt;Authentication is a very important part of any project. The open id is an open standard and decentralized protocol. It allows users to be authenticated by cooperating sites using third party service, eliminating the need for webmasters to provide their own ad hoc login. Open Id is about authentication (ie. providing who you are).&lt;/p&gt;

&lt;p&gt;This protocol provides a way for a site to redirect a user somewhere else and come back with a verifiable assertion. OpenID provides an identity assertion.&lt;br&gt;
The most important feature of OpenID is its discovery process. OpenID does not require hard coding each the providers you want to use ahead of time. Using discovery, the user can choose any third-party provider they want to authenticate. This discovery feature has also caused most of OpenID's problems because the way it is implemented is by using HTTP URIs as identifiers which most web users just don't get.&lt;/p&gt;

&lt;p&gt;The scenario for use of OpenID:&lt;br&gt;
1) The user wants to access his account on example.com&lt;br&gt;
2) example.com asks the user for his OpenID&lt;br&gt;
3) The user enters his OpenID&lt;br&gt;
4) example.com redirects the user to his OpenID provider&lt;br&gt;
5) User authenticates himself to the OpenID provider&lt;br&gt;
6) OpenID provider redirects the user back to example.com&lt;br&gt;
7) example.com allows the user to access his account.&lt;br&gt;
search for OAuth or OpenID connect which will help you to know more.&lt;/p&gt;

</description>
      <category>auth</category>
    </item>
  </channel>
</rss>
