<?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: Pejman</title>
    <description>The latest articles on DEV Community by Pejman (@pejmannik).</description>
    <link>https://dev.to/pejmannik</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%2F126319%2F8929b271-4982-494c-b80b-eb40dfc51ebe.jpg</url>
      <title>DEV Community: Pejman</title>
      <link>https://dev.to/pejmannik</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pejmannik"/>
    <language>en</language>
    <item>
      <title>Azure Service Bus Simulator</title>
      <dc:creator>Pejman</dc:creator>
      <pubDate>Sun, 07 Jan 2024 14:01:43 +0000</pubDate>
      <link>https://dev.to/pejmannik/azure-service-bus-simulator-5fe3</link>
      <guid>https://dev.to/pejmannik/azure-service-bus-simulator-5fe3</guid>
      <description>&lt;p&gt;TL;DR? check the repository:&lt;br&gt;
&lt;a href="https://github.com/PejmanNik/lazvard-message"&gt;https://github.com/PejmanNik/lazvard-message&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;In the intricate world of software development and testing, simulating server environments is not just a luxury, it’s a necessity. This is particularly true for those integrating Azure Service Bus into their tech stacks. The frustration is real for anyone searching “Azure Service Bus Simulator,” due to the lack of viable, straightforward solutions.&lt;/p&gt;

&lt;p&gt;The challenge intensifies when debugging applications locally. The standard approach is to set up a Service Bus instance in Azure. This is fine for solo projects, but with enterprise-level applications, the complexity multiplies. Each developer needing a separate instance isn’t just cumbersome, it’s a nightmare.&lt;/p&gt;

&lt;p&gt;In my typical fashion, I thought, “Why not build a simulator 🤔” This seemed simple, but I was in for a surprise 🫣.&lt;/p&gt;

&lt;p&gt;Delving into this project, I quickly realized that Azure Service Bus is more than just an AMQP protocol message broker. It involves custom behaviors and logic, requiring meticulous reverse engineering, including inspecting Azure Service Bus responses and exploring client test suites.&lt;/p&gt;

&lt;p&gt;But there’s more to it than simulating the message broker behavior., Azure Service Bus relies on secure communication, so the simulator had to function over HTTPS. After several attempts, I ended up Copy/Pasting 🧑‍💻dotnet dev-certs tools (From Microsoft ASP.NET Core) source code into the project, which efficiently generates a self-signed certificate and adds it to the operating system’s trusted certificates list.&lt;/p&gt;

&lt;p&gt;However, this approach works flawlessly on macOS and Windows, but Linux users face challenges in trusting certificates, requiring manual addition of the trusted certificate, which is inconvenient 😶‍🌫️.&lt;/p&gt;

&lt;p&gt;Navigating these challenges, my quest to create a lightweight Azure Service Bus simulator was a rollercoaster of disappointment and regret. Finally, “Lazvard Message” was born 🐣. It adeptly mirrors Azure Service Bus, but it is possible to encounter varying behaviors between the simulator and the actual Service Bus. If you spot any quirky behaviors, please create an issue in the GitHub repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/PejmanNik/lazvard-message"&gt;https://github.com/PejmanNik/lazvard-message&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lazvard Message is a compact CLI tool designed for simplicity. To use it, you only need to add your queue, topic, and subscription to the configuration and then run the CLI. It doesn’t yet offer all the features of Azure Service Bus, with aspects like Message Sessions and Transactions still under development.&lt;/p&gt;




&lt;p&gt;The name ‘Lazvard’ (LAZH-vard) is derived from an alternative Persian pronunciation of ‘lazuli’, referring to a vivid blue mineral from which the color Azure derives its name.&lt;/p&gt;

&lt;p&gt;Wikipedia:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The color azure ultimately takes its name from the intense blue mineral lapis lazuli. Lapis is the Latin word for “stone” and lāzulī is the genitive form of the Medieval Latin lāzulum, which is taken from the Arabic لازورد lāzaward, itself from the Persian لاژورد lāžaward, which is the name of the stone in Persian and also of a place where lapis lazuli was mined&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>azure</category>
      <category>azureservicebus</category>
      <category>simulator</category>
      <category>csharp</category>
    </item>
    <item>
      <title>Jikji - Layout library for building effortless reports in React</title>
      <dc:creator>Pejman</dc:creator>
      <pubDate>Sat, 14 May 2022 11:33:28 +0000</pubDate>
      <link>https://dev.to/pejmannik/jikji-layout-library-for-building-effortless-reports-in-react-4op4</link>
      <guid>https://dev.to/pejmannik/jikji-layout-library-for-building-effortless-reports-in-react-4op4</guid>
      <description>&lt;p&gt;I'm kinda obsessed with reports and PDFs tools :) It started with a simple need. Creating PDF reports for my project, There were a few libraries for building PDFs, but most of them didn't support non-English or right to left language. Also, it was tough to work and design reports with them.&lt;/p&gt;

&lt;p&gt;I finally decided to continue with HTML to PDF solutions as it lets me design my report freely, and there was no localization problem. Again most of the libs don't support Header/Footer or pagination. The tools that support these features were built over QtWebKit and didn't support new HTML/CSS specifications.&lt;/p&gt;

&lt;p&gt;In the end, none of them satisfied my needs, So I developed a tool that can convert HTML to PDF by separating the header and footer from content and creating two HTML files. Converting both HTML to PDF (by puppeteer) and eventually merging each page of two files together.&lt;/p&gt;

&lt;p&gt;This hacky solution resolved my problems and other developers (According to the NPM, it has 900 weekly downloads at the time I'm writing this blog).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Github&lt;/strong&gt;: &lt;a href="https://github.com/PejmanNik/puppeteer-report/"&gt;puppeteer-report&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qjC8ENwl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/PejmanNik/puppeteer-report/master/.attachment/image1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qjC8ENwl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/PejmanNik/puppeteer-report/master/.attachment/image1.png" alt="puppeteer-report" width="880" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/PejmanNik/puppeteer-report/"&gt;puppeteer-report&lt;/a&gt; provides a simple solution for having a custom header, footer, and page numbers. Still, I got a bunch of requests on GitHub for new features and had to reject most of them because &lt;a href="https://pptr.dev/"&gt;puppeteer&lt;/a&gt; has a lot of limitations in the customization of layout and printing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jGSKrXma--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ktytb8xl2xtlebxo3sdc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jGSKrXma--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ktytb8xl2xtlebxo3sdc.png" alt="github issues" width="813" height="570"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"NOT POSSIBLE"&lt;/strong&gt; Was not a satisfactory answer for me, so I started a new project to fix all of the limitations and provide more features. The idea came to me when I was working on a doc in Google Docs. When the cursor jumped to a new page, I asked myself how they handled the pagination? It has a sample answer. They break lines and elements by JS before the browser decides to how split/wrap the lines and elements to layout the pages.&lt;/p&gt;

&lt;p&gt;So I started to develop a JS engine that handles the pagination before the browser print preview engine gets the elements. It lets me edit and customize every engine's behavior over any component.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7lO_kFgq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1flghg6ijfbeuxo9luo9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7lO_kFgq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1flghg6ijfbeuxo9luo9.png" alt="layout convert" width="880" height="634"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result was "Jikji" library (why Jikji? it will need another blog:)) ). It uses &lt;a href="https://github.com/acdlite/react-fiber-architecture"&gt;React Fiber&lt;/a&gt; to get the component hierarchy and reorganized, split, and layout the components before rendering and making a print-ready web view that can easily be printed or converted to PDF or images.&lt;/p&gt;

&lt;p&gt;I'm trying to complete the documentation and make it ready to publish. soon you will be able to check form &lt;a href="https://github.com/PejmanNik/jikji"&gt;Jikji&lt;/a&gt; &lt;/p&gt;

</description>
      <category>html</category>
      <category>pdf</category>
      <category>report</category>
      <category>react</category>
    </item>
  </channel>
</rss>
