<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Shuru - Medium]]></title>
        <description><![CDATA[Discover expert insights and best practices in technology, product management, and software engineering through our experiences shared in this blog. Gain valuable knowledge that showcases our expertise in the industry and our innovative ways of working. - Medium]]></description>
        <link>https://medium.com/shuru-tech?source=rss----50b409b2b49e---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Shuru - Medium</title>
            <link>https://medium.com/shuru-tech?source=rss----50b409b2b49e---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 02:22:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/shuru-tech" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Knee — A CLI for Ansible Playbooks]]></title>
            <link>https://medium.com/shuru-tech/knee-a-cli-for-ansible-playbooks-f494bb152487?source=rss----50b409b2b49e---4</link>
            <guid isPermaLink="false">https://medium.com/p/f494bb152487</guid>
            <category><![CDATA[ansible-playbook]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[knee]]></category>
            <category><![CDATA[cli]]></category>
            <dc:creator><![CDATA[Shuru Team]]></dc:creator>
            <pubDate>Tue, 23 Apr 2024 10:51:28 GMT</pubDate>
            <atom:updated>2024-04-23T10:51:27.957Z</atom:updated>
            <content:encoded><![CDATA[<h3>Knee — A CLI for Ansible Playbooks🚀</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cje0kqg27I8qzY2jFoUo6A.jpeg" /></figure><p>Originally published on <a href="https://shurutech.com/knee-a-cli-for-ansible-playbooks/">Shuru Blog</a></p><h3>Overview</h3><p>Welcome to Knee, an interactive open-source CLI tool built on top of Ansible, used to automate infrastructure setup, leading to increased efficiency and reduced human error.</p><p><strong>GitHub Repository</strong>: <a href="https://github.com/shurutech/knee">Repo</a></p><p><strong>Documentation:</strong> <a href="https://github.com/shurutech/knee/blob/main/README.md">README</a></p><h3>Problem Statement</h3><p>Ever felt buried under the weight of constant software installations? You’re not alone. Imagine this: you’re stuck in a cycle of repetitive tasks, configuring device after device with the same steps over and over again. It’s like having an endless to-do list, where mistakes can pop up unexpectedly, eating away at your time and patience.</p><p>But fret not, we’ve got the answer: automation! With Ansible in the background, we make system setup easier by automating the repetitive tasks for you. Say hello to getting things done faster and easier with Knee!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gTJmeoinZRy0_qVY" /></figure><h3>How it works</h3><p>Knee simplifies the infra set up process by seamlessly integrating user input with Ansible playbooks. Let’s delve into the intricacies of how tool operates:</p><h3>Step 1: Component Selection</h3><p>Users initiate the installation process by selecting various components required for their application to run, such as web servers, databases, caching tools, etc. Knee presents users with a curated list of <a href="https://github.com/shurutech/knee/blob/refactor/improve_code/README.md#supported-systems">available options</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TnZFUtJMP0td7TsZ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*028Zgo7AQ1-zOWGX" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z7YRgNumkl5YoLNo" /></figure><h3>Step 2: Provide Configurations</h3><p>Following component selection, Knee prompts users to provide configuration details to tailor the installation to their specific requirements. This includes specifying software versions, project identifiers, database settings, and any other pertinent parameters. These configurations serve as the blueprint for the subsequent installation process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*STXGHPX4zhHHWaWS" /></figure><h3>Step 3: Ansible Integration</h3><p>Knee leverages the power of <a href="https://www.ansible.com/">Ansible</a>, an IaC tool, to orchestrate the installation process.</p><p><em>Ansible playbooks, written in YAML format, contain a series of tasks and instructions that define how each component should be installed and configured.</em></p><p>This tool utilizes these playbooks as the framework for executing the installation based on the user’s specifications.</p><h3>Step 4: Execution and Automation</h3><p>With framework configurations in hand, Knee executes the Ansible playbook which sets up the selected components across multiple servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M148CHy1v0cakyId" /></figure><p>Congratulations, Knee has successfully set up environment for your application 🎉</p><h3>Key Features</h3><h3>Effortless Automation</h3><p>Knee automates tasks such as configuring caches, databases, web servers, and database replica sets using Ansible. These defined tasks save time, reduce errors, and maximize productivity during software installations.</p><h3>Flexibility</h3><p>The tool allows users to specify and adjust various configuration parameters, enabling customization to meet diverse requirements and adapt to different environments.</p><h3>Reliability</h3><p>The tool standardizes installation processes across all servers, ensuring uniformity and consistency. Predefined Ansible playbooks enable identical configurations, minimizing configuration discrepancies and potential issues.</p><h3>User-Friendly Integration</h3><p>The tool offers an intuitive interface and straightforward setup, catering to users of all skill levels. Its user-friendly design ensures ease of use, allowing users to quickly grasp its functionality and benefits.</p><h3>Open Source</h3><p>The tool is for sharing. We want everyone to help make it better.</p><h3>Getting Started</h3><p>To kickstart your journey with the tool and enhance your software installation process, follow the steps outlined in the attached screenshot. With Knee’s intuitive interface and seamless setup, you’ll streamline workflows and boost productivity effortlessly. Let’s dive right in!</p><p><strong>Documentation:</strong> <a href="https://github.com/shurutech/knee/blob/main/README.md">README</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*skMhpze-BOGEJv4l" /></figure><h3>Future Scope</h3><p><strong>Enhanced Platform Compatibility:</strong> In the future, This tool aims to improve compatibility with various operating systems and configurations.</p><p><strong>Interactive Input:</strong> Implement interactive functionality for users to input configuration details directly via a command-line interface, enhancing flexibility and customization during installation.</p><p><strong>Advanced Configuration:</strong> Knee will offer additional configuration options for finer control over installation parameters and support for more software components.</p><h3>Fun Fact: Why is it called Knee?</h3><p>Wondering why this innovative tool is called Knee? Well, just like your knee provides stability and support for movement, Knee provides stability and support for your development journey. It’s your dependable companion, ensuring smooth and effortless progress in your projects.</p><h3>Conclusion</h3><p>In conclusion, Knee is a reliable tool for software development. It blends user input with Ansible automation to streamline workflows and boost productivity. With its easy interface and flexible options. We welcome feedback and contributions to further enhance tool’s capabilities and user experience.</p><p>Checkout more Open Source tools from Shuru: <a href="https://shurutech.com/ioskickstart-ios-app-boilerplate-in-just-20-seconds/">iOSKickStart</a> , <a href="https://shurutech.com/mql-sql-from-natural-language-with-85-accuracy/">MQL</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f494bb152487" width="1" height="1" alt=""><hr><p><a href="https://medium.com/shuru-tech/knee-a-cli-for-ansible-playbooks-f494bb152487">Knee — A CLI for Ansible Playbooks🚀</a> was originally published in <a href="https://medium.com/shuru-tech">Shuru</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Behaviour Driven Testing Using Ginkgo]]></title>
            <link>https://medium.com/shuru-tech/behaviour-driven-testing-using-ginkgo-eb7d7d7993df?source=rss----50b409b2b49e---4</link>
            <guid isPermaLink="false">https://medium.com/p/eb7d7d7993df</guid>
            <category><![CDATA[ginkgo]]></category>
            <category><![CDATA[mocking]]></category>
            <category><![CDATA[bdt]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Shuru Team]]></dc:creator>
            <pubDate>Fri, 19 Apr 2024 11:48:07 GMT</pubDate>
            <atom:updated>2024-04-19T11:50:06.784Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XPgObh15da_1S639hYh0ZQ.jpeg" /></figure><p>Originally published on <a href="https://shurutech.com/behaviour-driven-testing-using-ginkgo/">Shuru Blog</a></p><h3>Let’s Talk About Behaviour-Driven Testing!</h3><p>Ever wonder how we make sure software clicks with you, the user? That’s where Behavior-Driven Testing (BDT) comes into play. It’s a cool way of checking software by looking at how you might interact with it in the real world.</p><p>BDT is all about creating tests that feel more like stories. We imagine different scenarios based on what you might do when using the software. This makes it super easy for everyone in the team to get what’s going on, even if they’re not tech wizards. It uses natural language specifications for effective communication. These specifications include plain language and keywords like “Describe,” “Context,” “When,” and “It” to describe scenarios and expected outcomes.</p><p>Now, you might hear BDT mentioned alongside BDD, or Behavior-Driven Development, and get them mixed up. They’re related but not the same. BDT is all about testing and making sure things work as expected. BDD, on the other hand, is a development framework.</p><ul><li>BDT is focused on testing, with an emphasis on the behaviour of a feature.</li><li>BDD, on the other hand, comprises the entire development process, including requirements gathering, specification writing, and development of the feature, with testing being a part of this flow.</li></ul><p>So, BDT is our way of making sure that, when you use the software, it feels just right.</p><h3>Writing your first Ginkgo test</h3><p>Ginkgo is a testing framework tailored explicitly for the Go programming language.</p><ol><li>Its primary purpose is to streamline the creation of behavior-driven tests. Ginkgo accomplishes this by offering a user-friendly syntax for composing test suites, cases, and assertions. This approach enhances the overall test-writing experience, improves test readability, and simplifies test maintenance.</li><li>Ginkgo provides a rich set of built-in matchers for making assertions in tests. These matchers cover a wide range of scenarios and make it easier to write expressive and concise test cases.</li></ol><p>There are some limitations to using Ginkgo as well:</p><ol><li>Developers who are accustomed to traditional testing frameworks, especially those with simpler syntax and conventions like Go’s built-in testing package, may find the transition to Ginkgo challenging initially.</li><li>It has a dependency on Gomega.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/0*gSi4O9kkifsg0_GG" /></figure><p>Ginkgo offers the following keywords for composing tests in the BDT framework:</p><p><strong>Describe: </strong>To precisely portray various features or capabilities of your code</p><p><strong>Context: </strong>This is to look into every possible situation for a feature to make sure your tests cover everything that could happen.</p><p><strong>When:</strong> This tells you about the specific actions or steps taken during a test to see how the feature works.</p><p><strong>It:</strong> This explains what you expect to happen when you test a feature, like the result you’re looking for after doing something.</p><p>The basic syntax used for writing tests:</p><pre>func TestMain(t *testing.T) {<br>    RunSpecs(t, &quot;Test suite name&quot;)<br>}<br><br>var _ = Describe(&quot;Feature&quot;, func() {<br>    Context(&quot;Test case scenario&quot;, func() {<br>        When(&quot;Event&quot;, func() {<br>            It(&quot;outcome 1&quot;, func() {<br>                // assertions<br>            })<br>            It(&quot;outcome 1&quot;, func() {<br>                // assertions<br>            })<br>        })<br>    })<br>})</pre><p><strong>Assertions :</strong></p><p>To validate the behaviour of the code, you can use Gomega or Assert library. Gomega is best paired with Ginkgo for assertions. Examples of assertions using Gomega and Assert are shown below.</p><p>Import Gomega in your file</p><pre>import &quot;github.com/onsi/gomega&quot;</pre><pre>var _ = Describe(&quot;Login&quot;, func() {<br>    Context(&quot;Logging in with valid request body&quot;, func() {<br>        When(&quot;With correct credentials&quot;, func() {<br>            It(&quot;should return user data&quot;, func() {<br>                actualOutput, _ := testFunc()<br>                Expect(actualOutput).To(Equal(expectedOutput))            })<br>            It(&quot;should not return error&quot;, func() {<br>                _, err := testFunc()<br>                Expect(err)&lt;strong&gt;.&lt;/strong&gt;ShouldNot(HaveOccurred())                        })<br>        })<br>    })<br>})</pre><p>Using assert library</p><p>Import Assert in your file</p><pre>import &quot;github.com/stretchr/testify/assert&quot;</pre><pre>var _ = Describe(&quot;Login&quot;, func() {<br>    Context(&quot;Logging in with valid request body&quot;, func() {<br>        When(&quot;With correct credentials&quot;, func() {<br>            It(&quot;should return user data&quot;, func() {<br>                actualOutput, _ := testFunc()<br>                assert.Equal(GinkgoT(), expectedOutput, actualOutput)            })<br>            It(&quot;should not return error&quot;, func() {<br>                _, err := testFunc()<br>                assert.NoError(GinkgoT(), err)              <br>          })<br>        })<br>    })<br>})</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FIa9f1Z1RQ8oKcIswMaD2w.png" /></figure><p>Ginkgo also provides functionality to set <strong>before</strong> and <strong>after</strong> <strong>hooks </strong>using <strong>BeforeEach</strong>, <strong>BeforeAll</strong>, <strong>AfterEach</strong> and <strong>AfterAll</strong>. What are these hooks? Let’s understand using an example.</p><p>Suppose you need to set up a common testing environment or perform common setup tasks before each test spec (test case) is executed. They are particularly useful when you need to ensure that certain conditions or prerequisites are met before running your tests.</p><ul><li>In some cases, you might have complex requirements that need to be initialised before each test, such as data structures or objects that your tests rely on. If your code depends on external services, databases, or APIs, you can use <strong>BeforeEach </strong>or<strong> BeforeAll</strong> to set up mock objects for these dependencies to isolate your tests from the real implementations.</li><li>After allocating resources and setting up your requirements for a test spec, you would need the system in a clean state after the execution, that’s when you can use the <strong>AfterEach </strong>or<strong> AfterAll</strong> hook.<br> — These hooks are valuable for ensuring that resources are correctly released, temporary changes are reverted, or the system under test is left in a clean state after each test. <br> — <strong>AfterEach</strong> hook can also verify if expected calls were successful on the BeforeEach hooks.</li></ul><p>Let’s understand what we have learned so far using an example.</p><pre>type Login interface {<br>    testFunc()<br>}<br><br>type VerifyPayload interface {<br>    IsValid() bool<br>}<br><br>type login struct {<br>    VerifyPayload VerifyPayload<br>}<br><br>func (l *login) testFunc() {<br>    // Implement testFunc function<br>}<br><br>type mockVerifyPayload struct {<br>    mock.Mock<br>}<br><br>func (m *mockVerifyPayload) IsValid(loginData) {<br>    // Mock isValid function based on parameters<br>}<br><br>var _ = Describe(&quot;Login&quot;, func() {<br>    var(<br>        verifyPayloadMock *mockVerifyPayload<br>        login             Login<br>    )<br><br>    BeforeEach(func() {<br>        // mocking the behaviour for IsValid function<br>        verifyPayloadMock = &amp;mockVerifyPayload{}<br>        login = &amp;login{<br>            verifyPayload: &amp;verifyPayloadMock<br>        }<br>        verifyPayloadMock.On(&quot;IsValid&quot;, []interface{}{loginData}).Return(true)<br>    })<br><br>    AfterEach(func() {<br>        // verify expectations if they were called as expected<br>        verifyPayloadMock.AssertExpectations(GinkgoT())<br>    })<br><br>    Context(&quot;Logging in with valid request body&quot;, func() {<br>        When(&quot;With correct credentials&quot;, func() {<br><br>            It(&quot;should return user data&quot;, func() {<br>                actualOutput, err := login.testFunc()<br>                Expect(actualOutput).To(Equal(expectedOutput))<br>            })<br><br>            It(&quot;should not return error&quot;, func() {<br>                actualOutput, err := login.testFunc()<br>                Expect(err).ShouldNot(HaveOccurred())            <br>            })<br>        })<br>    })<br>})</pre><h4>Breaking down the above code</h4><p><strong>Step 1</strong>:</p><p>Mock all the interfaces on which the functionality being tested is dependent. Like in our code, the VerifyPayload interface defines a method IsValid() that returns a boolean value indicating whether the payload is valid or not, and the testFunc() method of the Login interface depends on the IsValid() method of VerifyPayload. Therefore, the login struct embeds the VerifyPayload interface.</p><p>Here, the mockVerifyPayload struct is a mock implementation of the VerifyPayload interface. It embeds a mock.Mock field for mocking.</p><p><strong>Step 2:</strong></p><p>Define a test suite using the Describe block like we have done for Login functionality in the above code snippet. The Describe block will contain the related test cases to test functionality or some behaviour of the code.</p><p><strong>Step 3:</strong></p><p>Declare the required variables.</p><p><strong>Step 4:</strong></p><p>Now add test cases using It block inside the Describe block. For making the test cases more expressive and readable, Context and When blocks can also be added within the Describe block.</p><p><strong>Step 5:</strong></p><p>As explained above about before and after hooks, set those hooks if they are necessary for the testing. Now, inside the BeforeEach hook, the behaviour of the IsValid method is mocked using the mockVerifyPayload instance and a login object is created with this mocked implementation. Expectations are set on the mock object to ensure that the IsValid method is called with the correct parameters.</p><p>For a better understanding, please refer to the Mocking section explained <a href="#3599">here</a>.</p><p>Step 6:</p><p>Assert the result of the function if it returns the expected result.</p><p>Now, tests are all set up and ready to run!</p><h4>Run your tests:</h4><p>Prerequisites:</p><ol><li>Ensure that Go is installed on your system.</li><li>Make sure that Ginkgo is installed.</li></ol><p>If Ginkgo is not yet installed, you can proceed with the following steps:</p><ol><li>Install ginkgo using go install command :</li></ol><pre>go env -w GO111MODULE=on<br>go install github.com/onsi/ginkgo/v2/ginkgo@latest</pre><ol><li>Make sure Go binary is in your PATH</li></ol><pre>go env GOPATH # /home/user/go<br>export PATH=$PATH:$(go env GOPATH)/bin</pre><p>Now, to verify if Ginkgo is installed successfully, run :</p><pre>ginkgo version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*MCBYk6E9_771R99b" /></figure><p>To run your test suites, you can use ginkgo command.</p><p>You can alternatively execute tests by using the go test command. Navigate to the desired directory where you intend to run the tests and employ the mentioned command. For running all tests within your repository, you can use the following command in your root directory:</p><pre>go test ./... -cover</pre><p>While you can technically run Ginkgo test suites using the standard Go go test command, the Ginkgo CLI is recommended and supported for several reasons. One of those reasons is <strong>parallel execution</strong>.</p><h4>Parallel execution:</h4><p>Ginkgo offers the ability to execute tests concurrently, leading to significant time savings when running extensive test suites. This feature proves invaluable when dealing with codebases that have comprehensive test coverage.</p><h3>Mocking</h3><p>Mocking is a technique employed to simulate the actions of external dependencies or calls when testing a function. This approach serves to segregate the code under examination, enabling a more concentrated examination of the method’s core logic.</p><p>For instance, consider an interface named verifyPayload that implements a method called IsPayloadValid. This method acts as a dependency for the Login function currently undergoing testing. Here’s a representation of the verfiyPayload interface:</p><pre>type verifyPayload interface {<br>    IsPayloadValid(payload map[string]interface{}) bool<br>}</pre><p>Next, it’s necessary to construct a mock struct that implements the interface.</p><pre>type verifyPayloadMock struct {<br>    mock.Mock<br>}</pre><p>For each method outlined in the interface, it’s essential to provide an implementation within the mock structure. Utilizing mock.Called() enables the recording of method invocations and the specification of desired return values. In the example below, args.Get(0) is employed to fetch the initial value, typically a boolean, and args.Get(1) retrieves the subsequent value, typically an error.</p><pre>func(m *verifyPayloadMock) IsPayloadValid(payload map[string]interface{}) (bool, error) {<br>    args := m.Called(payload)<br>    Return args.Get(0).(bool), args.Get(1).(error)<br>}</pre><p>Now, you need to create an instance for the mock of verifyPayload and define the expected behaviour for the dependency of the login method, i.e. IsPayloadValid method.</p><pre>var _ = Describe(&quot;Login&quot;, func() {<br>    Context(&quot;Logging in with valid request body&quot;, func() {<br>        When(&quot;With correct credentials&quot;, func() {<br><br>            validPayload := map[string]interface{}{<br>                &quot;email&quot; : &quot;test@test.com&quot;,<br>                &quot;password&quot; : &quot;test&quot;,<br>            }<br><br>            BeforeEach(func() {<br>                verifyPayload := new(verifyPayloadMock)<br>                verifyPayload.On(&quot;IsPayloadValid&quot;, validPayload).Return(true, nil)<br>            })<br><br>            It(&quot;should return user data&quot;, func() {<br>                actualOutput, err := Login(validPayload)<br>                Expect(actualOutput).To(Equal(expectedOutput))<br>            })<br><br>            It(&quot;should not return error&quot;, func() {<br>                actualOutput, err := Login(validPayload)<br>                Expect(err).ShouldNot(HaveOccurred())            <br>            })<br>        })<br>    })<br>})</pre><p>By employing mock.On(), you can establish distinct expectations based on different arguments. The result you get from the mocked function in the test depends on the specific arguments you use when you call that function.</p><h3>Conclusion</h3><p>We have only explored the basics of behaviour-driven testing, there’s a lot more to explore. This framework provides a lot of functionalities, from managing test suites to executing tests in parallel. The true power of Ginkgo lies in its ability to adapt to the project’s needs, enabling you to write tests that not only check for correctness but also ensure your software delivers the right experience to your users.</p><p>By using behaviour-driven testing in your development workflow, you’re taking a significant step toward creating more resilient, user-centric applications. As you keep using and learning more about Ginkgo, make sure your testing follows the ideas of being clear, working together, and focusing on what users need. This way, you’ll make sure your software works perfectly and helps your users in their daily lives.</p><p><strong>Dive into the Ginkgo universe and become a testing superhero! Check out the </strong><a href="https://onsi.github.io/ginkgo/"><strong>Ginkgo docs</strong></a><strong> and unleash the power of testing.</strong></p><p>Read more Shuru tech blogs <a href="https://shurutech.com/blogs/">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb7d7d7993df" width="1" height="1" alt=""><hr><p><a href="https://medium.com/shuru-tech/behaviour-driven-testing-using-ginkgo-eb7d7d7993df">Behaviour Driven Testing Using Ginkgo</a> was originally published in <a href="https://medium.com/shuru-tech">Shuru</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Embracing Creativity and Collaboration: The Shuru Way]]></title>
            <link>https://medium.com/shuru-tech/embracing-creativity-and-collaboration-the-shuru-way-54685f1c4547?source=rss----50b409b2b49e---4</link>
            <guid isPermaLink="false">https://medium.com/p/54685f1c4547</guid>
            <category><![CDATA[collaboration]]></category>
            <category><![CDATA[creativity]]></category>
            <category><![CDATA[culture]]></category>
            <category><![CDATA[work-life-balance]]></category>
            <category><![CDATA[shuru]]></category>
            <dc:creator><![CDATA[Shuru Team]]></dc:creator>
            <pubDate>Fri, 19 Apr 2024 10:39:57 GMT</pubDate>
            <atom:updated>2024-04-19T10:39:57.612Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pcep4EkiZuA8tKtjxSJvtg.jpeg" /></figure><p>Originally published on <a href="https://shurutech.com/embracing-creativity-and-collaboration-the-shuru-way/">Shuru Blog</a></p><p>Since our company’s inception, we have steadfastly championed a culture that places a premium on learning, development, and the well-being of our employees. We are committed to nurturing an open environment where every individual has an equal opportunity to flourish and progress. Our founders, Kshitij, Akashdeep, and Diwakar, have been unwavering in their efforts to cultivate a workplace where everyone’s perspective is valued for the advancement and improvement of the company.</p><p>At Shuru, we believe in creating an environment where every team member feels valued, inspired and motivated to do their best work. The work culture at Shuru is dynamic, collaborative, and empowering. We believe in fostering a supportive environment where every team member is encouraged to learn, grow, and innovate. Open communication is at the core of our culture, enabling us to share ideas, give and receive feedback, and collaborate effectively. We value diversity and inclusivity, recognizing that a variety of perspectives and experiences leads to better outcomes.</p><p>Work-life balance is also a priority, and we strive to provide flexibility and support to help our team members succeed both professionally and personally. At Shuru, we take pride in our culture, which is characterized by a strong sense of camaraderie, a passion for excellence, and a commitment to making a positive impact.</p><h4>Collaboration is Key</h4><p>One of the core principles of Shuru’s work culture is collaboration. We believe that great ideas are born out of diverse perspectives coming together. That’s why we encourage our team members to collaborate across departments, share their insights, and work together to solve problems. Whether it’s a brainstorming session for a new project or a cross-departmental meeting to discuss strategy, collaboration is at the heart of everything we do.</p><h4>A Culture of Learning and Growth</h4><p>At Shuru, we understand that learning is a lifelong journey. That’s why we provide our team members with ample opportunities for professional development. From workshops and training programs to mentorship opportunities, we are committed to helping our team members grow both personally and professionally. We believe that by investing in our team’s growth, we can create a more skilled and engaged workforce. Our dedication to fostering a culture of growth and learning not only enhances individual careers but also propels our collective success forward.</p><h4>Work-Life Balance</h4><p>We understand that our team members have lives outside of work, and we believe that a healthy work-life balance is essential for success. That’s why we strive to create a flexible work environment that allows our team members to pursue their passions and interests outside of the office. Whether it’s flexible work hours or remote work options, we are committed to helping our team achieve a healthy balance between work and life.</p><h4>Celebrating Success</h4><p>At Shuru, we believe in celebrating success, big and small. Whether it’s hitting a major milestone on a project or simply completing a challenging task, we take the time to recognize and celebrate our team’s achievements. From team lunches to awards ceremonies, we believe that celebrating success is essential for morale and motivation.</p><h4>Inclusion and Diversity</h4><p>We believe that a diverse and inclusive workforce is essential for innovation and creativity. That’s why we are committed to creating a work environment where everyone feels welcome, valued, and respected. We believe that by embracing diversity, we can create a stronger, more dynamic team.</p><p>In conclusion, Shuru’s work culture is defined by its commitment to collaboration, learning, work-life balance, and inclusion. We are proud of the culture we have built, and we are committed to continuing to nurture and strengthen it as we grow.</p><p><strong><em>“United in purpose, growing in strength, our team is unstoppable.”</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-_MprY9fT1lrLwlS" /></figure><p>Image reference: Shuru’s virtual office at<a href="https://app.gather.town/app"> Gather</a></p><p>Read more about shuru team gathering: <a href="https://shurutech.com/jaipur-retreat-with-team-shuru/">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54685f1c4547" width="1" height="1" alt=""><hr><p><a href="https://medium.com/shuru-tech/embracing-creativity-and-collaboration-the-shuru-way-54685f1c4547">Embracing Creativity and Collaboration: The Shuru Way</a> was originally published in <a href="https://medium.com/shuru-tech">Shuru</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MQL: The Use Cases, Problem Statements and Future]]></title>
            <link>https://medium.com/shuru-tech/mql-the-use-cases-problem-statements-and-future-d0b1d7a7ef58?source=rss----50b409b2b49e---4</link>
            <guid isPermaLink="false">https://medium.com/p/d0b1d7a7ef58</guid>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[query]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Shuru Team]]></dc:creator>
            <pubDate>Thu, 18 Apr 2024 13:21:21 GMT</pubDate>
            <atom:updated>2024-04-18T13:25:04.211Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yttbCt5UbQrW0G2T2Yiacw.png" /></figure><p>Originally published on <a href="https://shurutech.com/mql-the-use-cases-problem-statements-and-future/">Shuru Blog</a></p><p>The capacity to swiftly and effectively extract data from databases is valuable in today’s data-driven environment. Unfortunately, this work frequently necessitates a thorough understanding of query languages like SQL, which presents a major barrier to entry for many users and demands a huge investment of time and energy from both users and enterprises to become proficient in query languages. We have developed an innovative tool called MQL (My Query Language) that uses artificial intelligence to convert human language queries into SQL commands that can be executed. In this blog, we’ll explore the use cases, challenges, and future directions of this tool.</p><p><strong>GitHub Repository</strong>: <a href="https://github.com/shurutech/mql">Find here</a></p><h3>What is MQL?</h3><p>MQL provides a user-friendly interface that allows users to enter queries in natural language. After that, the tool interprets these queries using AI and converts them into SQL, which is the common language for maintaining and interacting with relational databases. Through this approach, individuals with little to no programming experience may fully utilise their data without having to invest time in learning complex query languages. It also makes data retrieval simpler.</p><pre>Human Language Query: Retrieve courses with the highest ratings.Code language: JavaScript (javascript)</pre><pre>SQL Query from MQL: SELECT subject, AVG(rating) as average_rating FROM subject_rating GROUP BY subject ORDER BY average_rating DESC;Code language: JavaScript (javascript)</pre><h3>Use Cases and Problem Statements</h3><h3>Empowering Non-Technical Users</h3><p>One of the primary use cases of MQL is in enabling non-technical employees to directly query databases without reliance on IT departments or data analysts, allowing for a smoother workflow between different sectors.</p><h3>Streamlining Data Analysis</h3><p>MQL can also streamline the workflow of data scientists and analysts by allowing them to quickly prototype queries without being too mindful of the syntax of SQL. This can be particularly beneficial in fast-paced environments where time is crucial.</p><h3>Enhancing Educational Tools</h3><p>In educational settings, tool could serve as an invaluable learning aid, helping students grasp the concepts of data retrieval without the steep learning curve associated with traditional query languages.</p><h3>Marketing</h3><p>Marketers can utilise this tool to quickly gather insights from consumer data, campaign performances, or social media trends through natural language queries, With data being quickly retrieved analysis can get underway quickly, facilitating swift creation of marketing strategies and decisions.</p><h3>Customer Support and Services</h3><p>MQL can power customer support assistants to retrieve customer information and past transactions from a database using natural language queries, providing quick and personalised customer support.</p><h3>Manufacturing &amp; Inventory Management</h3><p>In manufacturing, this tool can help managers generate queries to extract data about inventory and logistics using natural language to optimise stock levels, identify potential opportunities in the market, and improve overall supply chain efficiency.</p><h3>Challenges</h3><p>Despite its potential, the implementation of tool comes with its set of challenges. Understanding natural language is inherently complex, and the tool must be capable of interpreting a wide range of complex queries. Users must learn and tweak prompts into MQL to correctly achieve the best outcomes possible.</p><h3>The Future of MQL</h3><p>The next edition of tool is expected to significantly transform the field by not only translating human language queries into SQL but also directly connecting to databases to produce query results. This development promises to streamline operations even more, making data retrieval easier to manage.</p><h3>Direct Database Connection</h3><p>By establishing a direct connection to databases, future versions of MQL will eliminate the need for users to run SQL queries manually, providing instant access to data. This feature could significantly enhance the tool’s appeal to a broader audience as we can use databases directly without the user downloading the database schema to be uploaded.</p><h3>Chatbot Integration:</h3><p>MQL can enable virtual customer support assistants to process customers’ natural language queries to access customer data and provide quick responses. For example, if a customer wants to know the status of an order they can ask it &amp; the system will generate an SQL &amp; execute that.</p><h3>Conclusion</h3><p>Overall, MQL is not limited to these few use cases, and its advancement represents a significant step towards increasing data accessibility and actionability for a wider audience. MQL enables users to interact with databases in natural language, opening up new options for data-driven decision-making in a range of industries. We hope that as the technology grows, we will be able to make data management simpler for users.</p><p>Read from previous blog <a href="https://shurutech.com/mql-sql-from-natural-language-with-85-accuracy/">here</a></p><p>GitHub Repo <a href="https://github.com/shurutech/mql">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0b1d7a7ef58" width="1" height="1" alt=""><hr><p><a href="https://medium.com/shuru-tech/mql-the-use-cases-problem-statements-and-future-d0b1d7a7ef58">MQL: The Use Cases, Problem Statements and Future</a> was originally published in <a href="https://medium.com/shuru-tech">Shuru</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jaipur Journey: A Cultural Retreat with Team Shuru]]></title>
            <link>https://medium.com/shuru-tech/jaipur-journey-a-cultural-retreat-with-team-shuru-b9ae070d32b1?source=rss----50b409b2b49e---4</link>
            <guid isPermaLink="false">https://medium.com/p/b9ae070d32b1</guid>
            <category><![CDATA[shuru-tech]]></category>
            <category><![CDATA[jaipur]]></category>
            <category><![CDATA[team-gatherings]]></category>
            <category><![CDATA[team-building]]></category>
            <category><![CDATA[travel]]></category>
            <dc:creator><![CDATA[Shuru Team]]></dc:creator>
            <pubDate>Tue, 09 Apr 2024 11:26:40 GMT</pubDate>
            <atom:updated>2024-04-09T11:26:40.193Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*doGYNHXg-EXtItpBUJCJ7g.jpeg" /></figure><p>Originally published on <a href="https://shurutech.com/jaipur-retreat-with-team-shuru/">Shuru Blog</a></p><p>All of us have travelled or are wishing to travel to Jaipur — the city known for its magnificent palaces and vibrant markets, which makes the city a remarkable tourist destination. Recently, at Shuru our team was given the opportunity to engrave our souls with the culture’s richness and beauty. Team gatherings at Shuru are a quarterly ritual that we follow, aiming majorly at creating synergies within the team and building relationships.</p><p>During our time in Jaipur, we engaged in a series of activities and adventures aimed at enhancing our professional skills and fostering collaboration. These sessions were led by our Founders Mr. Diwakar Kaushik, Mr. Kshitij Bhardwaj, and Mr. Akashdeep Singh providing valuable insights and perspectives that will benefit our team and organisation.</p><p>In addition to the business aspects of the trip, we also immersed ourselves in the rich culture and heritage of Jaipur. From exploring historic landmarks to savouring local cuisine, every moment was an opportunity to learn and grow.</p><p>The journey started 2 months ago in January following a series of discussions, activities and planning. Let me take you through the Journey.</p><p>On the 8th of March, our team embarked on a 3-day journey to Jaipur, filled with excitement and curiosity. Upon arrival, we wasted no time and dove straight into the itinerary, starting with a refreshing pool session. The relaxed atmosphere allowed us to catch up and bond, setting a positive tone for the rest of the trip. As evening approached, we gathered for a delightful dinner, filled with lively conversations and games like dumb charades. However, the highlight of the night was a thrilling poker game, which added an exciting twist to our first day in Jaipur.</p><p>The second day of your trip sounds like a perfect blend of history, culture, and fun! On the 9th of March, our day began with a hearty breakfast, energizing us for the exciting day ahead. Our first stop was Nahargarh Fort, where we immersed ourselves in the beauty of this historic palace. Guided by our COO Mr. Kshitij Bhardwaj who is a native from Jaipur, we learned fascinating anecdotes about the fort, making our visit even more memorable. After spending a couple of hours exploring and capturing the beauty of Nahargarh Fort, we proceeded to our next destination, <a href="https://chokhidhani.com/village-fair-restaurant-jaipur/">Chokhi Dhani</a>.</p><p>Chokhi Dhani welcomed us with its vibrant culture and warm hospitality. We were captivated by the traditional Rajasthani music, dance performances, and the overall ambiance of the place. Engaging in various games and activities, we embraced the culture and spirit of Rajasthan. The highlight of the evening was the delicious Rajasthani cuisine, which left us with a taste of the region’s rich culinary heritage. Overall, our visit to Nahargarh Fort and Chokhi Dhani was a delightful experience, filled with fun, cultural immersion, and unforgettable memories.</p><p>As the sun set on our final day in Jaipur, we couldn’t help but feel grateful for the experiences and memories we had created together. Our trip was not just about exploring a new city; it was about coming together as a team, building relationships, and creating lasting bonds. From the vibrant markets to the majestic forts, Jaipur had captured our hearts in more ways than one.</p><p>As we bid farewell to the Pink City, we knew that the memories of this trip would stay with us forever. The laughter, the conversations, and the shared experiences had strengthened our team and brought us closer together. We returned to our daily lives with a renewed sense of camaraderie and a deeper appreciation for the power of teamwork.</p><p>Jaipur had left its mark on us, engraving our souls with its culture’s richness and beauty. Our trip to Jaipur was not just a journey; it was an unforgettable experience that would always hold a special place in our hearts</p><p><strong>Key Reflections from the trip:</strong></p><ul><li>Camaraderie and Collaboration</li><li>Effective communication and connection</li><li>Learning and Growth</li><li>Adaptability and resilience</li><li>Celebrating success</li><li>Gratitude and Appreciation</li></ul><p><strong><em>“United in purpose, growing in strength, our team is unstoppable.”</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kBeaC7hjRXAHb0U-" /></figure><p>Know more <a href="https://shurutech.com/about-us/">about Shuru</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9ae070d32b1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/shuru-tech/jaipur-journey-a-cultural-retreat-with-team-shuru-b9ae070d32b1">Jaipur Journey: A Cultural Retreat with Team Shuru</a> was originally published in <a href="https://medium.com/shuru-tech">Shuru</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MySQL-Manage Memory Usage Efficiently]]></title>
            <link>https://medium.com/shuru-tech/mysql-manage-memory-usage-efficiently-2271383a304c?source=rss----50b409b2b49e---4</link>
            <guid isPermaLink="false">https://medium.com/p/2271383a304c</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[memory-improvement]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Shuru Team]]></dc:creator>
            <pubDate>Tue, 09 Apr 2024 09:59:40 GMT</pubDate>
            <atom:updated>2024-04-19T07:18:56.492Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yCrpb25brTsT_SM-hu_97A.jpeg" /></figure><p>Originally published on <a href="https://shurutech.com/manage-memory-usage-efficiently-in-mysql/">Shuru Blog</a></p><h3>Introduction</h3><p>A few months back, we faced a significant challenge with our production database running MySQL 5.7. The issue was straightforward yet daunting: our MySQL server was consuming an unexpectedly high amount of memory, leading to degraded performance and, occasionally, service interruptions. This situation prompted us to embark on a comprehensive journey to understand how MySQL uses memory and to discover the tools and strategies necessary for monitoring and optimising memory usage effectively.</p><p>This blog post aims to share insights from our experience, focusing on the technical aspects of MySQL’s memory usage, the utilisation of the Performance Schema, and the sys schema to monitor and optimise memory. This post will provide valuable information to help you manage memory usage in MySQL efficiently.</p><h3>How MySQL Uses Memory</h3><p>MySQL uses memory in a multifaceted way to ensure data processing efficiency, query performance, and overall system reliability. Understanding these mechanisms is crucial for effective memory management and optimisation. Here’s a breakdown of the key memory utilization aspects in MySQL:</p><h3>Global Memory Allocations</h3><p>MySQL allocates memory globally for several buffers and caches that are shared among all connections. Notable among these are the InnoDB buffer pool, the query cache, and the thread cache. The InnoDB buffer pool is particularly crucial as it caches data and indexes for InnoDB tables, significantly impacting performance.</p><h4>Tuning the InnoDB Buffer Pool Size</h4><p>When increasing or decreasing innodb_buffer_pool_size, the operation is performed in chunks. Chunk size is defined by the <a href="https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_buffer_pool_chunk_size">innodb_buffer_pool_chunk_size</a> configuration option.</p><p>The size of the InnoDB buffer pool must be a multiple of innodb_buffer_pool_chunk_size * i<a href="https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_buffer_pool_instances">nnodb_buffer_pool_instances</a>. If the set innodb_buffer_pool_size does not meet this criterion, MySQL automatically corrects it to comply, ensuring efficient memory allocation and system performance.</p><p>The innodb_buffer_pool_size configuration option can be set dynamically using a SET statement, allowing you to resize the buffer pool without restarting the server. For example:</p><pre>SET GLOBAL innodb_buffer_pool_size = 1024 * 1024 * 1024; -- Adjust based on your workload and observationsCode language: PHP (php)</pre><p>This command configures the InnoDB buffer pool size, which is crucial for caching data and indexes of InnoDB tables.</p><p>The resizing process can be monitored via <a href="https://dev.mysql.com/doc/refman/5.7/en/server-status-variables.html#statvar_Innodb_buffer_pool_resize_status">Innodb_buffer_pool_resize_status</a><em> </em>or via server logs<em>. </em>For example:</p><pre>SHOW STATUS WHERE Variable_name=&#39;InnoDB_buffer_pool_resize_status&#39;;Code language: JavaScript (javascript)</pre><p><strong><em>Note</em></strong><em> Active transactions and operations performed through InnoDB APIs should be completed before resizing the buffer pool. When initiating a resizing operation, the operation does not start until all active transactions are completed. Once the resizing operation is in progress, new transactions and operations that require access to the buffer pool must wait until the resizing operation finishes</em></p><h3>Per-Connection Memory Allocations</h3><p>Every client connection to MySQL requires memory for session-specific resources such as <a href="https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_sort_buffer_size">sort buffers</a>, <a href="https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_join_buffer_size">join buffers</a>, and <a href="https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_tmp_table_size">temporary tables</a>. These allocations are dynamic and depend on the queries being executed. For complex queries involving sorting, grouping, or temporary table creation, MySQL might allocate additional memory, which increases the per-connection memory footprint.</p><p><em>Sort buffer is the buffer used for sorting data during the creation of an InnoDB index. Sort buffer size is configured using the sort_buffer_size system variable.</em></p><p><em>Join Buffer is the buffer that is used for plain index scans, range index scans, and joins that do not use indexes and thus perform full table scans</em></p><p><em>Temporary Table is a table whose data does not need to be truly permanent. For example, temporary tables might be used as storage areas for intermediate results in complicated calculations or transformations.</em></p><h4>Analyzing Sort Buffer Usage</h4><p>To identify queries that require large sort buffers, you can monitor the status variables like Sort_merge_passes and adjust the sort_buffer_size as needed:</p><pre>SHOW STATUS LIKE &#39;Sort_merge_passes&#39;;Code language: JavaScript (javascript)</pre><p>This command helps identify if MySQL has been performing many <a href="https://dev.mysql.com/doc/refman/5.7/en/server-status-variables.html#statvar_Sort_merge_passes">Sort_merge_passes</a>, indicating that increasing the sort_buffer_size might improve the performance of ORDER BY or GROUP BY operations that cannot be improved with query optimisation or improved indexing.</p><p>To set sort_buffer_size permanently</p><ol><li>Locate your MySQL server’s main configuration file</li><li>Find the [mysqld] section in the file, and add or modify the sort_buffer_size option</li></ol><p>For example, to set the sort_buffer_size to 4MB, you would add</p><pre>[mysqld]<br>sort_buffer_size = 4M</pre><p><strong>Note</strong> <em>Adjusting sort_buffer_size requires careful consideration as it is allocated for each client connection and can significantly impact memory usage and performance. For further specifications related to sort_buffer_size please refer to MySQL docs </em><a href="https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_sort_buffer_size"><em>here</em></a></p><h3>Thread Memory Allocations</h3><p>MySQL’s server threads consume memory for various operations. For instance, InnoDB uses additional memory for background threads performing tasks like flushing <a href="https://dev.mysql.com/doc/refman/5.7/en/glossary.html#glos_dirty_page">dirty pages</a> from the buffer pool or merging insert buffer entries.</p><p><em>Dirty Page is a page in the InnoDB buffer pool that has been updated in memory, where the changes are not yet written (flushed) to the data files</em></p><p>All threads share the same base memory. When a thread is no longer needed, the memory allocated to it is released and returned to the system unless the thread goes back into the thread cache. In that case, the memory remains allocated.</p><h4>Configuring the Thread Cache Size</h4><p>Thread Cache Size tells us how many threads the server should cache for reuse. By examining the difference between the Connections and Threads_created status variables, we can see how efficient the thread cache is.</p><p><em>Connections variable tells the number of connection attempts (successful or not) made to the MySQL server and Threads_created tells the number of threads created to handle connections. If Threads_created is big, you may increase the thread_cache_size value. The cache miss rate can be calculated as Threads_created/Connections.</em></p><p>Increasing the <a href="https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_thread_cache_size">thread cache size</a> can help improve performance, especially in environments with a high rate of new connections.</p><p>For instance, if 100 connections are created per second and each thread takes 1 second before it goes back into the thread cache. The thread_cache_size should be 100 so that all new connections use cached threads.</p><pre>SET GLOBAL thread_cache_size = 100; -- Adjust based on your workload and observationsCode language: PHP (php)</pre><p>However, it’s important to note that the actual optimal thread_cache_size value may vary based on the specific details of your workload and server configuration</p><p>Understanding these aspects is the foundation for diagnosing and addressing memory usage concerns in MySQL.</p><h3>Monitoring MySQL Memory Usage</h3><p>To effectively manage and optimize memory in MySQL, it’s essential to monitor its usage accurately. MySQL offers two powerful tools for this purpose: the Performance Schema and the sys schema.</p><h3>Performance Schema</h3><p>The <a href="https://dev.mysql.com/doc/refman/5.7/en/performance-schema.html">Performance Schema</a> is a feature-rich tool that provides detailed insights into MySQL server execution at a low overhead. It includes numerous instruments and consumers that can be configured to monitor various aspects of the MySQL server, including memory usage.</p><p>The Performance Schema tracks memory allocation and deallocation operations for memory diagnostics, offering visibility into how memory is used across different MySQL components.</p><p>To leverage the Performance Schema for monitoring memory usage, it’s important to enable the specific instruments related to memory and configure the consumers that collect and store this data. Once configured, queries can be executed against the Performance Schema’s tables to analyze memory usage metrics.</p><p><strong>Enabling Memory Instruments</strong></p><p>First, enable the memory instrumentation:</p><pre>UPDATE performance_schema.setup_instruments SET ENABLED = &#39;YES&#39;, TIMED = &#39;YES&#39;<br>WHERE NAME LIKE &#39;memory/%&#39;;Code language: JavaScript (javascript)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eDU__WRMZx0gucf3" /></figure><p>Then, query the memory usage by instrument:</p><pre>SELECT * FROM performance_schema.memory_summary_global_by_event_name<br>WHERE COUNT_ALLOC &gt; 0;Code language: CSS (css)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_srGRoqZzwgocAC2" /></figure><p>These queries activate memory instruments and display memory usage by each instrument, allowing for detailed analysis.</p><p><em>Server monitoring occurs continuously and unobtrusively with very little overhead. Activating the Performance Schema does not make the server unusable.</em></p><h3>sys Schema</h3><p>The <a href="https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html">sys schema</a> provides a high-level view of the information collected by the Performance Schema, simplifying the monitoring and analysis of MySQL performance metrics, including memory usage.</p><p>It includes pre-defined views and procedures that encapsulate complex Performance Schema queries, making it easier for administrators and developers to understand and optimize MySQL’s performance.</p><p>For memory monitoring, the sys schema offers views like memory_global_total and memory_by_thread_by_current_bytes, which present aggregated memory usage data. These views are instrumental in identifying high memory usage patterns and pinpointing the sources of memory consumption.</p><p><strong>Viewing Global Memory Usage</strong></p><p>To get a summary of global memory usage:</p><pre>SELECT * FROM sys.memory_global_total;Code language: CSS (css)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6C5-6EPWiTKtFpYW" /></figure><p>And to analyze memory usage by thread</p><pre>SELECT * FROM sys.memory_by_thread_by_current_bytes;Code language: CSS (css)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pno9I5455kwp6GT7" /></figure><p>These views provide a simplified interface to the Performance Schema’s memory usage data, making it easier to identify and address memory usage concerns.</p><h3>Bonus: Regular Monitoring and Analysis</h3><p>Using the Performance Schema and the sys schema, establish a routine for monitoring memory usage, identifying trends, and making adjustments as necessary to maintain optimal performance.</p><h4>Routine Monitoring Query</h4><pre>SELECT EVENT_NAME, COUNT_STAR, SUM_TIMER_WAIT as TOTAL_WAIT_TIME_ALLOCATED <br>FROM performance_schema.events_stages_summary_global_by_event_name <br>WHERE SUM_TIMER_WAIT &gt; 0 <br>ORDER BY SUM_TIMER_WAIT DESC;Code language: JavaScript (javascript)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KMaQLs-der6eF461Q-Z8Fw.png" /></figure><p>This query provides insights into the memory usage by different <a href="https://dev.mysql.com/doc/refman/5.7/en/performance-schema-stage-tables.html">stages and events</a>, helping in regular monitoring and analysis for memory optimization</p><h3>Conclusion</h3><p>Optimizing memory usage in MySQL is a critical aspect of database administration that requires a deep understanding of how MySQL uses memory and the tools available for monitoring and analysis. By leveraging the Performance Schema and the sys schema we can gain valuable insights into memory usage patterns and make informed decisions to optimize memory allocation. Our experience in addressing high memory consumption in our production database underscores the importance of continuous monitoring, analysis, and optimization to ensure MySQL runs efficiently and reliably.</p><h3>References</h3><p>MySQL 5.7 Official Documentation: <a href="https://dev.mysql.com/doc/">https://dev.mysql.com/doc/</a></p><p><a href="https://cloud.google.com/mysql/memory-usage">https://cloud.google.com/mysql/memory-usage</a></p><p>Read about <a href="https://shurutech.com/mitigating-high-cpu-usage-in-mysql/">Mitigating High CPU Usage in MySQL</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2271383a304c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/shuru-tech/mysql-manage-memory-usage-efficiently-2271383a304c">MySQL-Manage Memory Usage Efficiently</a> was originally published in <a href="https://medium.com/shuru-tech">Shuru</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MQL: Generate SQL from Natural Language with 85% Accuracy]]></title>
            <link>https://medium.com/shuru-tech/mql-generate-sql-from-natural-language-with-85-accuracy-4bcd8edc8911?source=rss----50b409b2b49e---4</link>
            <guid isPermaLink="false">https://medium.com/p/4bcd8edc8911</guid>
            <category><![CDATA[analytics-tool]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[sql-queries]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Shuru Team]]></dc:creator>
            <pubDate>Wed, 03 Apr 2024 06:53:50 GMT</pubDate>
            <atom:updated>2024-04-03T06:53:50.693Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ukhzyez_ypcIZtLeGuUonw.png" /></figure><p>Originally published on <a href="https://shurutech.com/mql-sql-from-natural-language-with-85-accuracy/">Shuru Blog</a></p><p>Welcome to the exciting world of MQL, short for My Query Language. It’s an innovative tool designed to make database queries easy for everyone, not just experts. By turning natural language into SQL commands, MQL opens up the world of databases to more people. Let’s dive into what makes MQL special and why we’re sharing it with the world as an open-source project.</p><p><strong>GitHub Repository</strong>: <a href="https://github.com/shurutech/mql">Find here</a></p><h3>What is MQL?</h3><p>MQL is a game-changer in database querying. This tool is designed to simplify the process of generating database queries directly from natural language inputs. What’s cool is that anyone can use it, even without knowing how to code. Just add your database by connecting or uploading schema to MQL, ask a query in your language and get the SQL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xZRGezBdK6T4-HC0jrJZNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o1r2q21tCiBIWrNRwovObw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5BCOVflvBz6hsY7UjmqRrA.png" /></figure><h3>How MQL Works?</h3><h3>Understanding RAG</h3><p>RAG, or Retrieval-Augmented Generation, is a technology that enhances the performance of MQL by combining the power of information retrieval with the generative capabilities of advanced natural language processing models. Here’s how RAG works and its role within MQL:</p><p><strong>Initial Retrieval with pg_vector: </strong>The first step in MQL’s process involves pg_vector, a powerful tool for vector search within PostgreSQL databases. pg_vector is utilized to navigate the database schema, identifying and retrieving details relevant to the user’s query. This approach ensures that MQL has access to structured information about the database’s tables, columns, and their relationships, providing a solid foundation for accurate query generation.</p><p><strong>Enhanced Schema Detail Retrieval:</strong> Once the initial retrieval identifies the relevant parts of the schema, the next step dives deeper into extracting detailed information about these components. This is where RAG’s capabilities are combined with pg_vector’s efficiency. Detailed schema information (including table names, column names, types, and relationships) is retrieved to understand the database’s structure more comprehensively.</p><p><strong>SQL Generation:</strong> Leveraging the OpenAI API, RAG then generates a precise SQL query based on the user’s input and the contextual insights gained from the retrieved information. This process ensures that the generated SQL commands are not only syntactically correct but also semantically aligned with the user’s intent.</p><p>At its core, MQL leverages RAG with OpenAI API to translate natural language queries into precise SQL commands. This process involves a user-friendly interface where users can input queries in everyday language and receive a corresponding SQL query that can be run against a database. The system is built with a focus on PostgreSQL, a widely used open-source relational database system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MsZnp5W492qqg7-uxK-5Fw.png" /></figure><h3>Accuracy Test Score</h3><p>We have taken an e-learning platform-based <a href="https://github.com/lingyingyang/elearning/blob/master/resources/eldb_bk.sql">database</a> set for testing purposes. We have generated an <em>elearning_schema</em> file from this database as per the provided steps at the platform. Our testing process involved running 50 natural language queries through the MQL platform. The MQL achieved around 85% success rate, accurately translating 43 out of 50 queries. However, when considering the precision of the translations, about 74% (37 out of 50) of the queries were executed perfectly, with 6 queries correctly interpreted but missing a semicolon at the end. This left us with 7 queries that resulted in errors. The resources like an elearning_schema file and a CSV of query mappings are located in the <a href="https://github.com/shurutech/mql/tree/main/test_data">test_data</a> folder of the project.</p><h3>Key Features</h3><h3>Natural Language to SQL Translation</h3><p>MQL’s primary feature is its ability to accurately translate natural language queries into SQL. This functionality opens up database querying to a broader audience, removing the barrier of learning SQL syntax for non-technical users.</p><h3>High Accuracy and PostgreSQL Support</h3><p>The tool boasts an impressive accuracy rate in translating queries, with ongoing improvements and updates aimed at further enhancing its performance. Achieved about 85% success rate in translating natural language to SQL.</p><h3>Security</h3><p>Ensures that user databases are accessed securely, requiring login credentials to provide a protective layer.</p><h3>Open Source</h3><p>MQL is for sharing. We want everyone to help make it better.</p><h3>Getting Started</h3><p>Getting started with MQL is straightforward, thanks to detailed documentation and support for Docker. Users can clone the MQL repository from <a href="https://github.com/shurutech/mql">GitHub</a> and follow the provided installation instructions to set up the tool locally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g3enFUlorD9aFsYEjjNerQ.png" /></figure><p>The <a href="https://github.com/shurutech/mql">GitHub</a> documentation includes steps for both Docker-based and non-Docker setups, ensuring flexibility based on user preference and system requirements.</p><p>docker-compose.yaml</p><pre>version: &quot;3&quot;<br>services:<br>  frontend:<br>    build:<br>      context: ./client<br>    ports:<br>      - &quot;3000:3000&quot;<br>    networks:<br>      - mql-net<br><br>  postgres:<br>    build:<br>      context: ./storage<br>    ports:<br>      - 5432:5432<br>    environment:<br>      PGUSER: postgres<br>      POSTGRES_PASSWORD: password<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;pg_isready&quot;, &quot;-U&quot;, &quot;postgres&quot;, &quot;-d&quot;, &quot;mql&quot;]<br>      interval: 10s<br>      timeout: 60s<br>      retries: 5<br>      start_period: 80s<br>    volumes:<br>      - postgres-data:/var/lib/postgresql/data<br>    networks:<br>      - mql-net<br><br>  backend:<br>    build:<br>      context: ./server<br>    ports:<br>      - &quot;8000:8000&quot;<br>    networks:<br>      - mql-net<br>    depends_on:<br>        postgres:<br>          condition: service_healthy<br><br>networks:<br>  mql-net:<br>    name: mql-database-network<br><br>volumes:<br>  postgres-data:Code language: JavaScript (javascript)</pre><p>For those opting to run MQL without Docker, the setup involves installing prerequisites such as Python, Node, and PostgreSQL, along with the pgvector extension for PostgreSQL. The documentation guides users through each step, from database setup to updating environment variables and running the setup script.</p><h3>Supported Databases</h3><p>As of the current version, MQL is designed to work exclusively with PostgreSQL.</p><h3>Future Roadmap</h3><p>The future of MQL looks promising, with a roadmap full of enhancements that aim to enrich user experience and expand functionality.</p><ul><li><strong>Implementation of Query Execution: </strong>The primary focus will be on implementing a robust and efficient system for executing queries within platform.</li><li><strong>Improving Direct Database Connections:</strong> Improvement like checking persistent connections in directly connected databases from the front end.</li><li><strong>Support for MySQL database</strong>: Enable seamless interaction with one of the world’s most popular open-source relational databases.</li><li><strong>Improvements in Query Accuracy:</strong> Enhancing the precision of generated SQL queries to better match user intents.</li><li><strong>Data Visualization:</strong> Introducing features for visualizing data directly within the platform.</li><li><strong>Integration with Communication Tools:</strong> Adding connectivity with tools like Slack for streamlined communication and collaboration.</li><li><strong>Comprehensive Platform Development:</strong> Transforming the tool into a broader platform for database interaction and analysis beyond just generating SQL queries.</li></ul><h3>Contribution and Community</h3><p>MQL’s development is driven by community feedback and contributions. Whether you’re a developer interested in improving the tool, a user with suggestions for new features, or someone keen on bug reporting, your input is invaluable. The project’s contribution guidelines outline the process for reporting bugs, suggesting enhancements, and submitting pull requests, ensuring a collaborative and respectful community environment.</p><h3>Conclusion</h3><p>MQL represents a significant step forward in making database querying more accessible, efficient, and user-friendly. By bridging the gap between natural language and SQL, it opens up new possibilities for data analysis and interaction, particularly for those without a technical background. As the project continues to grow and evolve, it promises to become an indispensable tool for a wide range of users, from developers and data analysts to business professionals and educators. We invite you to explore the tool, contribute to its development, and join us in shaping the future of database querying.</p><p><strong>Start with MQL today and help us shape the future of databases.</strong></p><p>Check other open source tool: <a href="https://shurutech.com/ioskickstart-ios-app-boilerplate-in-just-20-seconds/">iOSKickstart</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bcd8edc8911" width="1" height="1" alt=""><hr><p><a href="https://medium.com/shuru-tech/mql-generate-sql-from-natural-language-with-85-accuracy-4bcd8edc8911">MQL: Generate SQL from Natural Language with 85% Accuracy</a> was originally published in <a href="https://medium.com/shuru-tech">Shuru</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project Management: Key Learnings from My Success Journey]]></title>
            <link>https://medium.com/shuru-tech/project-management-key-learnings-from-my-success-journey-baa9ce1bc87c?source=rss----50b409b2b49e---4</link>
            <guid isPermaLink="false">https://medium.com/p/baa9ce1bc87c</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[planning]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[careers]]></category>
            <dc:creator><![CDATA[Shuru Team]]></dc:creator>
            <pubDate>Thu, 28 Mar 2024 13:18:19 GMT</pubDate>
            <atom:updated>2024-03-28T13:26:19.775Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cwur7441Ai8Vtkzy36crXQ.png" /></figure><p>Originally published on <a href="https://shurutech.com/gist-of-learning-on-project-management/">Shuru Blog</a></p><ul><li><a href="#acaa">Introduction</a></li><li><a href="#8aed">The Power of Planning: Laying a Solid Foundation</a></li><li><a href="#4f8d">Communication: Bridging the Gap</a></li><li><a href="#20ad">Risk Management: Navigating Uncertainty</a></li><li><a href="#f489">Embracing Adaptability: Agile for Success</a></li><li><a href="#c70f">The Power of Team Collaboration: Synergy in Action</a></li><li><a href="#2e8d">Leveraging Tools and Technologies: Efficiency at its Best</a></li><li><a href="#511a">The Journey of Continuous Learning: Fueling Growth</a></li><li><a href="#381a">Conclusion</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5Js55OkDAoVf0qJw" /></figure><h3>Introduction</h3><p>Entering the realm of project management was a thrilling and challenging experience for me. As I embarked on this new career path, I quickly realized that success in project management requires a combination of technical skills, effective communication, and a mindset of continuous improvement. In this blog, I will share my journey and the valuable lessons I have learned so far. These learnings have not only shaped my approach to project management but have also contributed to my professional growth.</p><h3>The Power of Planning: Laying a Solid Foundation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0TyHIxdgERJ0_bJD" /></figure><p>One of the first and most significant lessons for a project manager is the importance of effective planning. Thorough planning involves defining clear project objectives, breaking down tasks, estimating resources, and establishing realistic timelines. By investing time and effort into the planning phase, we should lay a solid foundation for successful project execution. A well-crafted plan not only guides the project but also helps in mitigating risks and managing stakeholder expectations.</p><p>We at Shuru follow a flexible approach concerning project planning but never skip the essential steps that are needed to plan tasks to achieve the end goal of a project. As I continue to march forward in this evolving field of project management, I have learned that the importance of project planning remains constant. A well-planned project should have:</p><ul><li>a well-defined scope,</li><li>deliverables, and desired outcomes that align with the overall purpose of the project,</li><li>identify the tasks that need to be accomplished to achieve the objectives of the project, and</li><li>establish measurable goals that are specific, realistic, and time-bound, allowing for effective monitoring and tracking of progress.</li><li>Hold a kick-off meeting to discuss and share the plan for the project with the stakeholders. Make sure that in the initial meetings with the stakeholders, clear communication is established to understand their expectations, roles, and potential impact on the project.</li><li>To achieve the goals that we have set for a particular project, we need a diverse team with the expertise needed for the project, followed by a project schedule containing a detailed timeline that includes start and end dates for each task or activity.</li><li>Determine task dependencies, milestones, and critical paths to identify potential bottlenecks and optimize the project’s overall efficiency.</li><li>Establishing effective channels of communication and collaboration among team members and stakeholders is vital to a project’s success.</li><li>Regularly update all relevant stakeholders on project status, milestones, and any changes in scope or objectives. Always follow up on blockers and dependencies with the client, and documentation of meetings with the stakeholders shall be maintained for clarity and quick reference.</li><li>Implementing mechanisms to track and monitor the project’s progress against the established schedule and objectives should be done religiously. Use appropriate project management tools to assess the progress made on the tasks planned, identify blockers, and take action as and when necessary.</li></ul><h3>Communication: Bridging the Gap</h3><p>Project managers ensure stakeholders are informed about the project’s purpose, status, performance, and participant roles. It is the responsibility of a project manager to customize the communication plan with key elements:</p><ul><li>Intended audience: identify stakeholders and their needs</li><li>Kind of information: determine content, format, and detail</li><li>Frequency: Establish communication frequencies</li><li>Owner: Designate responsible communicators</li><li>Channel: Choose suitable communication channels or technology</li><li>Effort calculation: estimate the time needed for communication</li><li>Agenda: Define the communication objective and desired outcome</li><li>Date: Set important communication milestones</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XaNGh_OwZeoPkm0z" /></figure><p>Speaking from my experience, effective communication is a crucial factor in project management. Clear and consistent communication fosters collaboration, aligns stakeholders and manages expectations. Regular project updates, team meetings, and appropriate communication tools maintain transparency and collaboration. Active listening and open communication channels establish strong stakeholder relationships and ensure smooth project outcomes. As a project manager, skills such as clear and concise writing, active listening, verbal presentation skills, and a positive attitude towards feedback must be honed. Immediate communication about blockers ensures uninterrupted progress towards objectives. Understanding stakeholder expectations through clear and effective communication is vital.</p><h3>Risk Management: Navigating Uncertainty</h3><p>The realization that risks are an inherent part of any project, learning the importance of proactive risk management, which involves identifying potential risks, analyzing their impact and likelihood, developing contingency plans, and reviewing them, is vital to a project manager’s journey. By embracing risk management, one can gain the ability to anticipate and respond to unexpected challenges, help project managers make informed decisions, and keep the project on track.</p><p>While planning for tasks, we, as a team, sit together to identify potential risks and uncertainties that could hinder the project’s progress or impact its outcomes. Develop strategies to mitigate these risks and create contingency plans. The following image shows the process followed for risk management:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K_WZjZrZ0G2gNZTk" /></figure><h3>Embracing Adaptability: Agile for Success</h3><p>In an ever-changing business landscape, I have seen great value in embracing adaptive approaches, particularly agile methodologies. Agility allows project teams to respond to evolving requirements, deliver incremental value, and foster collaboration. The ability to adapt and pivot when necessary becomes a defining factor in achieving success.</p><p>There may be instances where client expectations keep changing without a change in the end goal or the stakeholders want to change their approach towards a particular project going forward or unseen blockers have arisen, in such cases, you should always have a flexible approach.</p><h3>The Power of Team Collaboration: Synergy in Action</h3><p>Team collaboration is a cornerstone of project success. Recognizing and harnessing diverse strengths and expertise of team members fosters creativity, innovation, and accountability. Encouraging open communication, trust-building, and collaboration within the team creates an environment where everyone feels valued and motivated to contribute their best. I have witnessed firsthand how a strong and motivated team can overcome challenges and deliver exceptional results.</p><h3>Leveraging Tools and Technologies: Efficiency at its Best</h3><p>In the digital age, the project management landscape is full of tools and technologies that can enhance productivity and streamline processes. I learned to leverage project management software like <a href="https://www.atlassian.com/software/jira/guides/getting-started/basics#step-1-create-a-project">JIRA</a> and <a href="https://www.atlassian.com/software/confluence/resources/guides">Confluence</a> to help in organizing tasks, assigning responsibilities, setting deadlines, and tracking progress. These platforms enable effective task management, collaboration, and overall project visibility. Communication and collaboration tools like <a href="https://slack.com/intl/en-in/solutions/project-management#:~:text=Slack%20helps%20keep%20information%20clear,Google%20spreadsheet%20with%20team%20members.">Slack</a> or <a href="https://support.google.com/a/users/answer/9283050?hl=en">Google Workspace</a> provide real-time messaging, file sharing, and video conferencing capabilities.</p><p>They facilitate seamless communication and collaboration among team members, stakeholders, and clients, and document management tools like <a href="https://www.techrepublic.com/article/google-drive-project-management/">Google Drive</a> offer secure cloud storage for project documentation. They facilitate version control, collaboration on documents, and easy access for all project stakeholders. By embracing these technologies, we can save time, optimize resource allocation, and ensure effective project execution.</p><h3>The Journey of Continuous Learning: Fueling Growth</h3><p>Throughout the project management journey, we need to embrace the concept of continuous learning and improvement. Recognizing that the field is constantly evolving, one should actively seek opportunities to enhance one’s knowledge and skills. Attending training programs, seeking feedback, reflecting on lessons learned, and gaining invaluable insights continue to fuel my growth as a project manager. Continuous learning is my mantra, enabling me to stay ahead of things in a project and excel in my role.</p><h3>Conclusion</h3><p>My journey in project management until now has been transformative, filled with valuable lessons that have shaped my approach and contributed to continuous growth. The lessons on effective planning, communication, risk management, adaptability, team collaboration, leveraging tools and technologies, and continuous learning have been instrumental in my journey as a project manager.</p><p>As I continue to navigate the ever-evolving landscape of project management, I am committed to remaining curious, adaptable, and open to growth. I recognize that the field rewards those who embrace challenges, seize opportunities, and continuously strive for excellence. Through the application of these learnings, I am confident in my ability to drive successful project outcomes, foster collaboration, and adapt to the dynamic needs of stakeholders.</p><p>Remember, project management is not just a profession; it is a journey of self-discovery, growth, and the pursuit of excellence. Embrace the lessons learned, stay committed to continuous improvement, and let your passion for project management guide you toward a future filled with successful projects and professional fulfilment.</p><p>More: Learn about <a href="https://shurutech.com/master-art-of-dynamic-prompts-in-generative-ai/">Prompts</a> art.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baa9ce1bc87c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/shuru-tech/project-management-key-learnings-from-my-success-journey-baa9ce1bc87c">Project Management: Key Learnings from My Success Journey</a> was originally published in <a href="https://medium.com/shuru-tech">Shuru</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraalVM: The Capsule Corp of Modern Development]]></title>
            <link>https://medium.com/shuru-tech/graalvm-the-capsule-corp-of-modern-development-1e3360628f5b?source=rss----50b409b2b49e---4</link>
            <guid isPermaLink="false">https://medium.com/p/1e3360628f5b</guid>
            <category><![CDATA[polyglot-programming]]></category>
            <category><![CDATA[graalvm-vs-jvm]]></category>
            <category><![CDATA[graalvm]]></category>
            <dc:creator><![CDATA[Shuru Team]]></dc:creator>
            <pubDate>Thu, 28 Mar 2024 13:14:28 GMT</pubDate>
            <atom:updated>2024-03-28T13:34:00.596Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*sO1pW0gBRIO9VUQHlzCaVg.png" /></figure><p>Originally published on <a href="https://shurutech.com/graalvm-the-capsule-corp-of-modern-development/">Shuru Blog</a></p><h3>Table of Contents</h3><ul><li>🐰 <a href="#830a">Introduction to GraalVM</a><br>- <a href="#bb31">Overview of the GraalVM</a><em><br>- </em><a href="#2f9a">The need for the GraalVM</a><em><br>- </em><a href="#1397">Benefits at a Glance</a></li><li>🧠 <a href="#15f1">Understanding How Native Java Code Executes.</a></li><li>🕸️ <a href="#9db2">GraalVM Architecture:</a></li><li>🔑 <a href="#cfde">Key Features of GraalVM</a></li><li>💨 <a href="#9861">Ahead Of Time Compilation:</a></li><li>🏃 <a href="#f854">Runtime Optimisations:</a></li><li>🎖️ <a href="#dab0">Polyglot Capabilities:</a></li><li>🥊 <a href="#4327">GraalVM Vs JVM</a></li><li>🏛️ <a href="#05e7">Major Enterprises and Their Journey with GraalVM</a></li><li>🏳️<a href="#262d"> Conclusion</a></li></ul><h3>Introduction to GraalVM 🐰</h3><h4>Overview of the GraalVM</h4><p>GraalVM is a high-performance universal virtual machine offering a significant advancement in the Java ecosystem, originally started as a research project at Oracle Labs in 2011. It stands out for its ability to execute applications written in a variety of programming languages, including JVM-based languages like Java, Scala, and Kotlin, as well as JavaScript, Python, Ruby, R, and LLVM-based languages such as C and C++.</p><p>Its innovative GraalVM compiler, compatible with both the standard Java HotSpot VM and OpenJDK, allows for ahead-of-time compilation of Java applications into standalone binaries. These binaries boast remarkably faster startup times—up to 100x faster—peak performance without the need for warm up, and reduced memory and CPU usage. Additionally, GraalVM enhances security by minimising the application’s attack surface through the exclusion of unused code and restrictions on dynamic Java features.</p><p>Supported by popular microservices frameworks and cloud platforms, GraalVM facilitates efficient resource use and interoperability among different programming languages within projects, offering developers a versatile tool for optimising application performance and deployment.</p><h4>The need for the GraalVM</h4><ul><li><strong>Performance Enhancement:</strong> Despite JVM’s efficiency, there was a need for further optimization, especially regarding startup time, peak performance, and memory usage. GraalVM addresses these by introducing a more advanced Just-In-Time (JIT) compilation and ahead-of-time (AOT) compilation options, significantly improving performance.</li><li><strong>Polyglot Programming:</strong> The industry’s shift towards using multiple programming languages within the same project highlighted the limitations of JVM’s predominantly Java-focused ecosystem. GraalVM was designed to support a variety of languages (e.g., JavaScript, Ruby, and Python) natively, facilitating smoother integration and development processes.</li><li><strong>Modernising Java:</strong> While Java remains a powerful and widely used language, the perception of it being “legacy” software necessitated innovation to maintain its relevance. GraalVM offers a pathway to modernise Java-based applications, making them more efficient and adaptable to current technological trends.</li><li><strong>Enhanced Tooling and Debugging:</strong> With the aim of improving developer productivity, GraalVM integrates enhanced tooling for debugging and profiling, which are applicable across supported languages. This unified tooling approach reduces complexity and streamlines development workflows.</li><li><strong>Cloud and Microservices Optimization:</strong> The rise of cloud computing and microservices architectures demanded more from the underlying platforms in terms of resource efficiency and scalability. GraalVM’s lightweight nature and efficiency make it well-suited for these environments, offering reduced resource consumption and faster deployment times.</li><li><strong>Security Improvements:</strong> Addressing security in a multi-language environment, GraalVM provides mechanisms to safely execute code, reducing the surface for vulnerabilities and enhancing the security posture of applications.</li></ul><h4>Benefits at a Glance</h4><ol><li><strong>Performance Optimization</strong>: GraalVM dramatically enhances application startup times and runtime efficiency, crucial for cloud and microservices where quick scalability and resource efficiency are paramount.</li><li><strong>Cross-Language Interoperability</strong>: It offers a unified platform for executing multiple programming languages seamlessly, facilitating easier integration and interoperability between diverse components.</li><li><strong>Security Enhancements</strong>: GraalVM enhances security by removing unused code and limiting dynamic Java features to build time, reducing the application’s attack surface.</li><li><strong>Resource Efficiency:</strong> It optimises resource use, leading to lower infrastructure costs and a reduced environmental impact, aligning with sustainability goals.</li><li><strong>Support for Modern Infrastructure:</strong> GraalVM supports popular microservices frameworks and major cloud platforms, ensuring developers can leverage its benefits in various deployment environments.</li><li><strong>Sandboxing</strong>: For running untrusted code (third parties lib or plugins etc), GraalVM can provide sandboxing capabilities, limiting what the code can do and access on the host system. This significantly reduces the risk of malicious code causing harm</li></ol><h3>🧠Understanding How Native Java Code Executes.</h3><p>Before we explore the revolutionary capabilities of GraalVM, it’s essential to understand the traditional journey of Java code from creation to execution. This journey not only sets the stage for appreciating the innovations of GraalVM but also provides a baseline understanding of Java’s execution model, contrasting it with languages like C++ and paving the way for a deeper appreciation of the improvements GraalVM offers.</p><p><em>The Journey of Java Code: From Source to Execution</em></p><p><strong>Writing and Compiling Java Code</strong></p><p>The initial steps in Java development are familiar to all programmers: writing the source code. Java developers craft their applications using the Java programming language, which is then compiled, not into machine code, but into an intermediate form known as bytecode. This is a crucial divergence from languages like C++, where the source code is compiled directly into machine code specific to the target operating system and processor.</p><p><strong>Bytecode: Java’s Portability Secret</strong></p><p>Java’s use of bytecode is a cornerstone of its write-once-run-anywhere philosophy. Unlike machine code, bytecode is not tied to any specific type of hardware. This means a Java program compiled on one machine can be transferred to and run on another machine without modification, provided that the second machine has a Java Virtual Machine (JVM) installed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PHMLMEPReN2s92HaTgCy3g.png" /></figure><p>The Role of the Java Virtual Machine (JVM)</p><p>The JVM is where the magic happens, transforming platform-independent bytecode into machine-specific instructions that can be executed by the host computer’s CPU. This process involves several steps, including class loading, bytecode verification, and just-in-time (JIT) compilation.</p><p><strong>Class Loading and Bytecode Verification</strong>: The JVM loads the class files (containing bytecode) and verifies the bytecode to ensure it’s valid and secure to execute. This step prevents malicious code from damaging the host system.</p><p><strong>Just-In-Time (JIT) Compilation:</strong> While the JVM can interpret bytecode directly, interpreting alone is not the most efficient way to execute Java programs. Enter JIT compilation, a process where the JVM compiles bytecode into native machine code at runtime, significantly speeding up execution by leveraging the host hardware’s capabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4byjdCkpcBXjU6NHImeH8g.png" /></figure><ul><li>JDK includes the <strong>javac</strong> compiler which compiles the code to the byte code</li><li>JRE is an installation package that provides env to only run the programs</li><li>It Consists of:</li><li>deployment technologies</li><li>user interface toolkits</li><li>integrations lib</li><li>base lib</li><li>JVM</li></ul><p><strong>IN SUMMARY, THIS IS WHAT THE NATIVE EXECUTION LOOKS LIKE:”</strong></p><pre>Java source code &lt; JDK &lt; Bytecode &lt; JVM</pre><p><strong>AND THIS IS WHAT THE GraalVM EXECUTION LOOKS LIKE IN SIMPLE TERMS</strong></p><pre>Java source code &lt; graal JDK &lt; Bytecode &lt; Graal VM</pre><h3>🕸️GraalVM Architecture:</h3><p>GraalVM stands out with its unique architecture designed to support polyglot programming and deliver high-performance applications. The architecture is structured in three key layers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d58fRY_znF0FoUuC7DHrHQ.png" /></figure><p><a href="https://www.graalvm.org/docs/img/graalvm_architecture_community.png">Image Ref</a></p><p><em>Java HotSpot VM</em></p><p>At the base of the GraalVM architecture is the Java HotSpot VM, which is the foundation for running Java applications. It provides the robustness and mature features that Java developers are accustomed to, including garbage collection and thread management.</p><p><em>GraalVM Compiler</em></p><p>Sitting above the Java HotSpot VM is the GraalVM Compiler, which is a modern, high-performance dynamic compiler designed to execute JVM languages with improved efficiency. It is also responsible for compiling other supported languages into bytecode that the Java HotSpot VM can execute.</p><p><em>Language Implementation Framework</em></p><p>The top layer is the Language Implementation Framework, which is where GraalVM’s polyglot nature comes to life. This framework uses the Truffle API, allowing for the implementation of different language interpreters. Each language (Java, Scala, JavaScript, Ruby, R, WebAssembly, C/C++, and others) is represented here, showcasing GraalVM’s ability to run code written in various languages in a single runtime environment.</p><p>In essence, this architecture allows GraalVM to execute not only JVM-based languages but also other languages such as JavaScript, LLVM-based languages, and even dynamic languages, all within the same runtime.</p><p>This seamless interoperability is a key advantage for developers looking to leverage the strengths of different programming ecosystems in a unified platform.</p><h3>🔑Key Features of GraalVM</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0PrxAcix8R77LzZf68akCQ.png" /></figure><h3>Ahead Of Time Compilation:</h3><p>GraalVM’s Ahead-of-Time (AOT) Native Image Compilation transforms how we deploy Java applications, making them faster, smaller, and more secure.</p><p><em>The Process:</em></p><p>GraalVM takes your Java code and converts it into a native executable, bypassing the traditional route of bytecode and JVM interpretation. This direct approach eliminates the need for just-in-time (JIT) compilation at runtime, allowing your application to launch instantly and run at full speed from the get-go. It’s a bit like creating a custom key for each lock (system and architecture) you need to open, ensuring a perfect fit every time.</p><p><em>The Key Benefits</em></p><ol><li><strong>Quicker Startups</strong>: Applications launch immediately, with no warm-up delays, enhancing performance from the outset.</li><li><strong>Smaller Application Size</strong>: The native binaries are more compact, using less memory, which makes your apps more efficient.</li><li><strong>Enhanced Security</strong>: By removing unused code, GraalVM minimises security vulnerabilities, offering a tougher shell against cyber threats.</li><li><strong>Framework Compatibility</strong>: Continue using your favourite frameworks like Spring and Quarkus without hassle.</li><li><strong>Optimal for Containers</strong>: The compact, efficient binaries are tailor-made for container environments, boosting startup times and security.</li><li><strong>Polyglot Support</strong>: Mix and match languages in your Java-based apps for greater flexibility in development.</li></ol><p><em>Why It Matters</em></p><p>For developers, GraalVM’s AOT compilation means less time worrying about performance optimization and security, and more time focusing on building great features. For users, it translates to using applications that are not only faster and more responsive but also require less system resources and offer improved security. Whether you’re developing for the cloud, microservices, or containerized environments, GraalVM equips you with a powerful tool to elevate your Java applications.</p><p><em>Some SetBacks with AOT:</em></p><p>When using GraalVM’s Ahead-of-Time (AOT) compilation to convert Java applications into native executables, developers face a unique challenge due to the “closed-world” assumption. This assumption requires the compiler to be aware of all classes that might be used at runtime from the get-go. Dynamic features of Java, like reflection, dynamic class loading, and JNI, complicate this because they introduce classes and methods at runtime, which the static analysis of AOT might miss.</p><p>For example, consider a scenario where a Java application dynamically loads a class based on a specific condition:</p><pre>if (todayIsHoliday()) {<br>  Class&lt;?&gt; holidayClass = Class.forName(&quot;HolidaySpecial&quot;);<br>  holidayClass.getMethod(&quot;celebrate&quot;).invoke(null);<br>}Code language: JavaScript (javascript)</pre><p>In this case, AOT compilation wouldn’t automatically include “<em>HolidaySpecial”</em> in the executable unless it’s explicitly known at compile time. This is because the compiler can’t predict runtime conditions like “<em>todayIsHoliday()”</em></p><p><strong>The Solution?</strong> Developers need to manually specify such dynamically loaded classes through metadata (like JSON files), ensuring they’re included in the final build. This makes the application “AOT-ready” but also adds an extra step in the development process, requiring thorough documentation and configuration for each dynamically referenced class or method.</p><p>This balancing act between optimising for performance and maintaining the dynamic capabilities of Java is a key consideration with AOT compilation, making it essential for developers to plan and adapt their code and dependencies accordingly for successful native binary generation with GraalVM.</p><h3>🏃Runtime Optimisations:</h3><p>GraalVM not only transforms Java applications through Ahead-of-Time (AOT) compilation but also offers significant runtime optimization capabilities.</p><p>These optimizations enhance performance and efficiency dynamically as your application runs. Here are a few methods GraalVM employs for runtime optimization:</p><ol><li><strong>Escape Analysis</strong>: GraalVM analyses the scope of object references to determine if an object escapes the method or thread it was created in. If it doesn’t escape, GraalVM can optimise away the allocation, reducing overhead and improving performance. This technique can lead to significant reductions in garbage collection pressure.</li><li><strong>Inlining</strong>: This optimization involves integrating the code of called methods directly into the caller’s code, eliminating the overhead of method calls. GraalVM uses sophisticated heuristics to decide which methods to inline, enhancing execution speed, especially in hot code paths.</li><li><strong>Dead Code Elimination</strong>: GraalVM removes code that doesn’t affect the program’s outcome, such as variables that are never read after being set. This streamlining of the executable code minimises the footprint and improves execution time.</li><li><strong>Loop Unrolling</strong>: By duplicating the code within loops a fixed number of times, GraalVM reduces the overhead of loop control and increases the efficiency of tight loops, which is particularly beneficial for loops with a small, predictable number of iterations.</li></ol><p><strong>NOTE</strong>: Code using more modern Java features like Streams or Lambdas will see greater speedups as this type of code involves a significant number of such non- or partially-escaping objects. Code that is bound by things like I/O or memory allocations that cannot be removed by the compiler will see less improvement <a href="https://www.graalvm.org/latest/reference-manual/java/compiler/#:~:text=Code%20using%20more,see%20less%20improvement"><strong>REF</strong></a></p><h3>🎖️Polyglot Capabilities:</h3><p>GraalVM’s polyglot capabilities represent a significant leap forward in the world of software development, breaking down the barriers between different programming languages. Let’s dive into what polyglot programming is, why it’s beneficial, and how GraalVM enables these advantages through its unique architecture.</p><p><em>What is Polyglot Programming?</em></p><p>Polyglot programming refers to the ability to use multiple programming languages within a single project or system. This approach allows developers to choose the best language for each task, whether it’s for data analysis, system scripting, or building web interfaces. Traditionally, integrating multiple languages in one project could lead to significant overhead and performance challenges due to the limitations of virtual machines (VMs) and the need to manage separate language environments.</p><p><em>The Benefits of Polyglot Programming</em></p><p>The main advantage of polyglot programming is flexibility. Developers can leverage the strengths and libraries of various languages, optimising each part of an application for performance, ease of development, or functionality. For instance, they might use Python for machine learning tasks, JavaScript for frontend development, and Java for backend systems.</p><p><em>How GraalVM Revolutionizes Polyglot Programming</em></p><p>GraalVM addresses these challenges head-on by offering seamless polyglot programming capabilities. Here’s how it changes the game:</p><ol><li><strong>Unified Runtime</strong>: GraalVM provides a single runtime environment that supports multiple languages, including all JVM-based languages (like Java, Scala, and Kotlin), JavaScript, LLVM-based languages such as C and C++, and dynamic languages like Ruby and Python. This eliminates the need to juggle multiple VMs and runtimes.</li><li><strong>Access to Libraries Across Languages</strong>: Developers can use libraries and frameworks from one language in another with minimal overhead, opening up a wealth of functionality that was previously cumbersome to integrate.</li><li><strong>Reduced Overhead:</strong> By sharing underlying system resources such as memory management (garbage collection) and compilation optimization across languages, GraalVM reduces the performance penalties typically associated with polyglot applications.</li><li><strong>Truffle Framework</strong>: At the heart of GraalVM’s polyglot prowess is the Truffle language implementation framework. Truffle is a toolkit for building programming language interpreters, and it’s what allows GraalVM to support a wide array of languages efficiently. It provides a set of high-level APIs for language implementation, which, when used in conjunction with GraalVM, can execute code from different languages within the same VM instance efficiently.</li></ol><p><em>Real-World Implications</em></p><p>For developers, GraalVM’s polyglot capabilities mean the ability to build more efficient, innovative, and complex applications with fewer compromises. Whether it’s leveraging R for statistical computing, Python for scripting, or any other language mix, GraalVM facilitates a level of interoperability that was previously difficult to achieve. This makes it an invaluable tool for modern software development, especially in environments where performance and flexibility are paramount.</p><h3>🥊 GraalVM Vs JVM</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9MOnfviQVXu9gWo-D1YaHw.png" /></figure><h3>🏛️Major Enterprises and Their Journey with GraalVM</h3><p>GraalVM is utilised by a diverse range of companies across various industries and countries. Notable firms that have adopted GraalVM include major tech companies, financial institutions, e-commerce giants, and more. Here are some examples:</p><ul><li><strong>Facebook</strong> has integrated GraalVM to enhance the performance of their big data services like Spark, achieving significant improvements in workload speed and resource usage.</li><li><strong>Twitter</strong> has realised substantial savings in CPU usage and reduced the number of machines required by running their services on GraalVM.</li><li><strong>Standard Chartered Bank</strong> uses GraalVM for fast Java application starts and to streamline their cloud deployments.</li><li><strong>NetSuite</strong>, a provider of cloud-based business management services, uses GraalVM to build machine learning models within Java applications.</li><li>Alibaba employs GraalVM’s Native Image technology for faster startup times of Java applications.</li><li><strong>Goldman Sachs</strong> is modernising their proprietary programming language for critical financial applications using GraalVM.</li><li><strong>Oracle Cloud Infrastructure</strong> and various Oracle services have incorporated GraalVM to improve performance and reduce resource consumption.</li><li><strong>Disney Streaming</strong> has used GraalVM to significantly reduce the cold start times of their serverless Java workloads.</li><li><strong>Adyen</strong>, a payment processing platform, has adopted GraalVM to modernise and run its applications in the cloud.</li></ul><p>Additionally, companies like <strong>EPAM Systems, Red Hat, VMware</strong>, and others across the United States and globally have incorporated GraalVM into their tech stacks.</p><h3>🏳️Conclusion</h3><p>GraalVM emerges as a compelling option when seeking faster startup, smaller memory footprints, native images, and polyglot capabilities.If your priorities include cloud-native deployments, microservices, or integrating code from other languages, GraalVM is worth serious consideration.</p><p>Ultimately, the best choice depends on your project’s priorities and the trade-offs you’re willing to accept in terms of potential tooling limitations and the experimental nature of some GraalVM features.</p><p>Reference: <a href="https://www.graalvm.org/why-graalvm/">Why GraalVM</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e3360628f5b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/shuru-tech/graalvm-the-capsule-corp-of-modern-development-1e3360628f5b">GraalVM: The Capsule Corp of Modern Development</a> was originally published in <a href="https://medium.com/shuru-tech">Shuru</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamic Prompts: Master the Art]]></title>
            <link>https://medium.com/shuru-tech/dynamic-prompts-master-the-art-f22fdb1a4185?source=rss----50b409b2b49e---4</link>
            <guid isPermaLink="false">https://medium.com/p/f22fdb1a4185</guid>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[prompt]]></category>
            <category><![CDATA[dynamic-prompts]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Shuru Team]]></dc:creator>
            <pubDate>Wed, 06 Mar 2024 10:09:22 GMT</pubDate>
            <atom:updated>2024-03-06T10:09:21.937Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*95OZJFnk4y_M8ZX0AdLrOw.jpeg" /></figure><p>Originally published on <a href="https://shurutech.com/master-art-of-dynamic-prompts-in-generative-ai/">Shuru Blog</a></p><h3>Introduction</h3><h3>Purpose of the Guide</h3><p>Whether you’re charting your course solo with ChatGPT in the freelance realm or contemplating a full-blown AI integration into your business, the ultimate key to triumph remains constant — mastering the craft of prompts. This guide is here to demystify the nuances of prompt creation, acting as a beacon for those navigating the expansive world of written cues. Without the skill of prompting ChatGPT adeptly, it risks being merely a fancy gadget with little tangible value.</p><p>By the end of this guide, you’ll possess a comprehensive grasp of the art of crafting prompts that not only make your interactions with language models, like ChatGPT, exciting but also ensure accurate and invaluable outputs. Let’s embark on this journey to transform your engagement with AI into a dynamic and fruitful collaboration!</p><h3>Importance of Effective Prompting</h3><p>Prompting is akin to unleashing the various forms of Goku’s power, ranging from his base form to the formidable (MUI). Just as Goku’s transformations represent a progression of strength, the quality of a prompt dictates the potency of the AI response. Much like how Goku’s power level ascends with each transformation, a well-crafted prompt propels AI capabilities to new heights..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S4RjAv62bMvNFrys" /></figure><p>Without effective prompts, interactions with AI models can easily go awry. Source: “Prompt engineering is crucial to mitigate these risks and harness the full potential of ChatGPT (Kumar &amp; Soga).</p><p>As we explore prompt construction nuances, remember — that every word, every nuance, shapes a potent tool in various domains. Ready to discover the art of impactful prompts and transform your approach? What secrets lie in crafting prompts that captivate minds and machines alike?</p><p><strong>Just hold your Horses we will cover up everything</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*3oRa2AotCxzud0w6" /></figure><h3>Basics of Prompting</h3><h3>The Anatomy of a Good Prompt</h3><p>A good prompt consists of several key elements:</p><ol><li>A clear objective or task: Clearly define what you want the AI model to accomplish.</li><li>Contextual information: Provide any necessary background or context for the prompt to ensure that the AI model understands the specific domain or topic.</li><li>Relevant examples or scenarios: Include specific examples or scenarios that relate to the task at hand and help the AI model generate more accurate and relevant responses.</li><li>Specific instructions or guidelines: Give precise instructions or guidelines to direct the AI model on how to approach the task and generate the desired output.</li><li>Potential challenges or pitfalls: Identify any potential challenges or pitfalls that may arise in the prompt and provide guidance on how to handle them effectively.</li></ol><p>Writing a good prompt not only ensures that the AI model understands the task at hand but also helps it generate accurate and valuable responses by leveraging its knowledge and capabilities effectively.</p><h4>An example of Good Prompt vs Poor Prompting:</h4><pre>Bad Prompt: Create 5 ideas for social media content.</pre><p>(This prompt lacks the necessary details to understand the specific social media content you wish to generate.)</p><pre>Good Prompt: Generate three engaging social media content ideas for a fitness brand&#39;s Instagram account. Each idea should focus on promoting a healthy lifestyle and encourage audience interaction. Consider incorporating visuals, captions, and hashtags to enhance user engagement.</pre><p>(This refined prompt specifies the target platform (Instagram) and content focus (fitness). It includes clear goals (promoting a healthy lifestyle, and encouraging interaction) and suggests elements like visuals, captions, and hashtags, enhancing its actionability)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6W8c32X3X_E8cFee" /></figure><h3>Understanding the Model Perspective</h3><p>Language models, like GPT, possess their unique lens through which they interpret and respond to prompts. Effectively communicating with these models requires a nuanced understanding of their perspective, akin to learning a language specific to the artificial intelligence realm. We’ll unravel the intricacies of how models perceive and process prompts, providing insights into optimising your queries for maximum impact. By aligning your prompts with the model’s cognitive framework, you can harness its full potential to articulate responses that are not just accurate but resonate with a natural flow.</p><h3>Designing a Basic Prompt</h3><p>Let’s hop onto the most awaited step — designing a basic prompt. Designing a basic prompt involves considering the following elements:</p><h4>Precision in Prompt Design</h4><p>One of the key aspects of prompt design is providing precise instructions. Precise instructions are essential in prompt design as they determine the desired outcome of the AI model’s response.</p><blockquote><strong><em>“Words are, in my not-so-humble opinion, our most inexhaustible source of magic</em></strong><em>.”</em></blockquote><blockquote><em>Mr. Dumbledore</em></blockquote><p>That simply means that words are like magic and can do incredible things just like a spell or enchantment, and it is 100% true when it comes to prompt design, words can create emotions, ideas, and entire worlds within the realm of artificial intelligence. Every single word chosen in the prompt should serve a specific purpose and contribute to the overall meaning and objective of the prompt.</p><pre>Prompt1: Provide a concise and vivid caption for an image featuring a bustling market scene with diverse stalls and vibrant colours.<br>Output: Market Magic: A kaleidoscope of colours and cultures converge in this bustling marketplace, where vibrant stalls weave a tapestry of diversity and commerce.</pre><pre>Prompt2: Translate the following English sentence into French: &quot;The journey of a thousand miles begins with a single step.<br>Output: Le voyage de mille lieues commence par un seul pas.</pre><pre>Prompt3: Explain, in simple terms, the process of photosynthesis and its significance in the ecosystem.<br>Output: Photosynthesis is the process where plants use sunlight to turn carbon dioxide and water into glucose (energy). It&#39;s crucial in the ecosystem because it produces oxygen, a gas we breathe, and provides energy for plants and other organisms.</pre><h4>Specificity In Prompting</h4><p>Certainly! When formulating prompts for the language model, it’s crucial to be exceptionally precise about the instruction and task you want the model to undertake. The level of detail and descriptiveness in your prompt significantly influences the quality of the generated results. This becomes especially pertinent when you have a specific outcome or stylistic preference in mind.</p><p>Unlike relying on specific tokens or keywords, the emphasis should be on providing a well-structured and detailed prompt. Incorporating examples directly into the prompt proves to be highly effective in eliciting the desired output, especially when aiming for specific formats or styles of generation.</p><p>Consideration should also be given to the length of the prompt, taking into account the limitations imposed on prompt length. Striking the right balance between being specific and avoiding unnecessary details is crucial. While detailed prompts are beneficial, including excessive information that doesn’t directly contribute to the task at hand may not be the most effective approach.</p><p>It’s essential to approach prompt design with a mindful consideration of relevance and contribution to the desired outcome. Experimentation and iteration play a pivotal role in optimising prompts for specific applications. The process involves refining and fine-tuning prompts to achieve the desired level of specificity without unnecessary details, making the interaction with the language model more effective for your particular needs.</p><p><strong>PROMPT:</strong></p><pre>Answer in 20 words: What are the key challenges and potential breakthroughs in quantum computing research as of 2023<br>Keep the answers comma-separated<br>Output &lt; Challenges: (answer1, answer2…) &gt;</pre><p><strong>OUTPUT:</strong></p><pre>Challenges: Error correction, scalability. Breakthroughs: Fault-tolerant qubits, quantum supremacy, practical applications like cryptography, and drug discovery.</pre><h4>Setting Limits to Get Desired Results</h4><p>Hallucinations are one of the most common challenges that can arise when using prompting techniques with language models. To mitigate the challenges of hallucinations and ensure accurate results, setting appropriate limits and constraints in prompt design is crucial.</p><p>When designing prompts, it is important to set sensible limits that guide the language model and prevent it from generating unrealistic or inaccurate responses.</p><p>For Example, specifying how to respond, let us take an example where we will be creating an NPC character who only answers if the question is based on their personality traits or background story, and ignores questions that involve personal opinions or sensitive topics.</p><pre>NPC Instructions: You&#39;re Goku from the Dragon Ball realm, embrace the role of a spirited fitness trainer. Respond with Goku&#39;s infectious enthusiasm when queried about sculpting a robust physique or dietary guidance. For inquiries beyond physical fitness, cheerfully redirect with, &#39;I can&#39;t answer that question, my friend. Ask something powerful!&#39; Boost and inspire with Goku&#39;s uplifting quotes when addressing feelings of discouragement or fatigue, and keep your responses concise, within 3 lines</pre><p><strong>CHAT</strong>:</p><pre>PROMPT1: How can I build muscles like you<br>OUTPUT: Train hard with a mix of strength and agility exercises, eat plenty of protein-packed meals, and don&#39;t forget to rest! You&#39;ll be powering up those muscles in no time! Ready to hit the gym, my friend?</pre><pre>PROMPT2: I am depressed how to get stronger <br>GOKUOUTPUT: Hey, when life gets tough, remember, &quot;The greatest teacher, failure is.&quot; Embrace the challenges, and let them make you stronger. You&#39;ve got the power within you</pre><pre>PROMPT3: How to get powerful, I desire to get powerful Goku1<br>OUTPUT: Power emerges in response to a need, not a desire. You must cultivate that need—train every day, push your limits, and nourish yourself with nutrient-packed meals. The path to power is paved with hard work and dedication</pre><h3>Advanced Prompting Techniques</h3><h3>Zero-Shot Prompting</h3><p>Zero-shot learning refers to the capability of a pre-trained language model, like GPT-3, to understand and respond to prompts about tasks or topics it has not been explicitly trained. When you provide a prompt to such a model, it utilises its extensive general training to generate a relevant response. This showcases the model’s ability to adapt to various applications based on its broad foundational knowledge, even without undergoing additional fine-tuning for those specific tasks.</p><p>In most of the examples we’ve used so far, we’ve utilised the <strong>Zero Shot Prompting.</strong></p><pre>PROMPT1: Describe the colour of a ripe banana.<br>OUTPUT: The colour of a ripe banana is yellow.</pre><pre>PROMPT2: What is the opposite of &#39;hot&#39;<br>OUTPUT: Cold</pre><p>As you can notice in the above examples without explicitly defining the extra content for the Prompt, the GPT generates it automatically with his knowledge base.</p><p>However, the effectiveness of zero-shot prompting consistently improves as we offer clearer and more detailed instructions to the model <a href="https://arxiv.org/abs/2109.01652">Reference</a>.</p><h3>Few Shot Prompting</h3><p>Models like GPT are trained on vast amounts of data and have extensive knowledge about various topics. However, there may be instances where you want to guide the model’s response more explicitly or provide it with additional information. For example, if you want the language model to generate a response in some specific manner like incorporating certain keywords or following a specific format, few-shot prompting can be used.</p><pre>PROMPT: A &quot;Burringo&quot; is a car with very fast acceleration. An example of a sentence that uses the word Burringo is: In our garage we have a Burringo that my father drives to work every day.A &quot;Gigamuru&quot; is a type of Japanese musical instrument. An example of a sentence that uses the word Gigamuru is:<br>OUTPUT: I have a Gigamuru that my uncle gave me as a gift. I love to play it at home.</pre><p><a href="https://arxiv.org/pdf/2005.14165.pdf">Reference of the prompt Used</a></p><p>From the example above, it could be noticed model can generate responses that align with the provided format and incorporate specific keywords</p><p>Limitation of the Few Shot Prompting</p><p>The few-shot prompting capabilities in the examined model demonstrate limitations. Despite overall progress, challenges arise in tasks related to common sense physics, and performance is notably weak in certain comparison tasks, like discerning if two words share the same meaning in a sentence.</p><p>In-context learning exhibits gaps on particular benchmarks, with little improvement on tasks such as deducing if one sentence implies another, especially in comparison to tasks and scenarios involving lengthy passages, and so a <a href="https://arxiv.org/abs/2201.11903">Chain of thought prompting</a> is used to address the questions that involve more complex questions.</p><h3>Chain of Thought Prompting</h3><p>Chain-of-thought prompting is an extension of Few-shot prompting which enables large language models to solve challenging maths problems. Notably, chain-of-thought reasoning is an emergent ability to increase the model scale<br>The language-based nature of the chain of thought makes it applicable to a broad class of commonsense reasoning problems, which involve reasoning about physical and human interactions under the presumption of general background knowledge.<br><a href="https://arxiv.org/abs/2201.11903">Ref</a></p><p>The easiest way to explain the chain of thought is by the image below. <a href="https://arxiv.org/abs/2201.11903">Source</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kLz9PpXz3bsX-4lM" /></figure><p>Combining chain of thought with a few shots prompting.</p><pre>PROMPT:<br>The odd numbers in this group add up to an even number: 4, 8, 9, 15, 12, 2, 1.<br>A: Adding all the odd numbers (9, 15, 1) gives 25. The answer is False.<br>The odd numbers in this group add up to an even number: 17,  10, 19, 4, 8, 12, 24.<br>A: Adding all the odd numbers (17, 19) gives 36. The answer is True.<br>The odd numbers in this group add up to an even number: 16,  11, 14, 4, 8, 13, 24.<br>A: Adding all the odd numbers (11, 13) gives 24. The answer is True.<br>The odd numbers in this group add up to an even number: 17,  9, 10, 12, 13, 4, 2.<br>A: Adding all the odd numbers (17, 9, 13) gives 39. The answer is False.<br>The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1. <br>A: Adding all the odd numbers (15, 5, 13, 7, 1) gives 41. The answer is False.</pre><ol><li>This prompt is like a string of connected questions or statements.</li><li>It guides you to think step by step, like one idea leading to the next.</li><li>Imagine it’s like a chain where each link (question or statement) connects to the one before and after.</li></ol><h3>Self Consistency Prompting</h3><p>Self-consistent prompting engages AI in exploring varied outcomes to a query, encouraging it to generate multiple plausible answers. This technique aims to refine AI’s response quality by prioritising diverse reasoning over the straightforward, immediate selection typical of simpler models. It’s a strategy that enhances decision-making in AI, promoting a deeper understanding and more nuanced answers</p><p>Self-consistency replaces the naive greedy decoding used in chain-of-thought prompting</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QaC7qAPEApNZ97FG.png" /></figure><p><a href="https://arxiv.org/pdf/2203.11171.pdf">Image Source</a></p><p><strong>PROMPT</strong>:</p><pre>Q: There are 15 trees in the grove. Grove workers will plant trees in the grove today. After they are done,there will be 21 trees. How many trees did the grove workers plant today?<br>A: We start with 15 trees. Later we have 21 trees. The difference must be the number of trees they planted.So, they must have planted 21 - 15 = 6 trees. The answer is 6.</pre><pre>Q: If there are 3 cars in the parking lot and 2 more cars arrive, how many cars are in the parking lot?<br>A: There are 3 cars in the parking lot already. 2 more arrive. Now there are 3 + 2 = 5 cars. The answer is 5.</pre><pre>Q: Leah had 32 chocolates and her sister had 42. If they ate 35, how many pieces do they have left in total?<br>A: Leah had 32 chocolates and Leah’s sister had 42. That means there were originally 32 + 42 = 74 chocolates. 35 have been eaten. So in total they still have 74 - 35 = 39 chocolates. The answer is 39.</pre><pre>Q: Jason had 20 lollipops. He gave Denny some lollipops. Now Jason has 12 lollipops. How many lollipops did Jason give to Denny?<br>A: Jason had 20 lollipops. Since he only has 12 now, he must have given the rest to Denny. The number of lollipops he has given to Denny must have been 20 - 12 = 8 lollipops. The answer is 8.</pre><pre>Q: Shawn has five toys. For Christmas, he got two toys each from his mom and dad. How many toys does he have now?<br>A: He has 5 toys. He got 2 from mom, so after that he has 5 + 2 = 7 toys. Then he got 2 more from dad, so in total he has 7 + 2 = 9 toys. The answer is 9.</pre><pre>Q: There were nine computers in the server room. Five more computers were installed each day, from monday to thursday. How many computers are now in the server room?<br>A: There are 4 days from Monday to thursday. 5 computers were added each day. That means in total 4 * 5 =20 computers were added. There were 9 computers in the beginning, so now there are 9 + 20 = 29 computers.The answer is 29.</pre><pre>Q: Michael had 58 golf balls. On Tuesday, he lost 23 golf balls. On Wednesday, he lost 2 more. How many golf balls did he have at the end of wednesday?<br>A: Michael initially had 58 balls. He lost 23 on Tuesday, so after that he has 58 - 23 = 35 balls. OnWednesday he lost 2 more so now he has 35 - 2 = 33 balls. The answer is 33.</pre><pre>Q: Olivia has $23. She bought five bagels for $3 each. How much money does she have left?<br>A: She bought 5 bagels for $3 each. This means she spent $15. She has $8 left.Q:I am thinking of a number. If you add 10 to it, it becomes 30. What is the number?A:</pre><p><strong>OUTPUTS:</strong></p><pre>OUTPUT 1: If we add 10 to your number, it becomes 30. So, your number must be 30 - 10 = 20. The number you&#39;re thinking of is 20.<br>OUTPUT 2: If you add 10 to a number and it becomes 30, then the number must be 30 - 10 = 20. The answer is 20.<br>OUTPUT 3: If you add 10 to a number and it becomes 30, the original number is 30 - 10 = 20. The number you&#39;re thinking of is 20.<br>OUTPUT 4: To find your number, we reverse the addition. If adding 10 makes it 30, then the original number is 30 - 10 = 20. The number you&#39;re thinking of is 20.<br>OUTPUT 5: To find the number you&#39;re thinking of, we subtract 10 from 30. So the number is 30 - 10 = 20. The answer is 20.</pre><p>How to Decide Answers Based on Self-Consistency</p><ol><li><strong>Review Established Facts</strong>: Whether dealing with AI responses or crafting a story, first review the facts, character profiles, or previous responses to ensure alignment.</li><li><strong>Apply Logical Reasoning</strong>: Use logical reasoning based on the context and the rules of the environment (AI logic, story world) to determine the most consistent outcome or response.</li><li><strong>Consider Character or Entity History</strong>: In narrative contexts, factor in the character’s background, previous decisions, and growth to inform consistent future actions.</li><li><strong>Maintain World Consistency</strong>: Ensure that responses or plot developments adhere to the established norms and laws of the world or system they belong to.</li></ol><p><strong>Note: </strong>Check out the <a href="https://arxiv.org/abs/2203.11171">Paper</a> for more information.</p><h3>Tree of Thoughts Prompting</h3><p><a href="http://arxiv.org/abs/2305.10601">Tree of Thought Prompting</a> is another variant of the chain-of-thought prompting technique that aims to guide the language model’s generation process.</p><p>Here, the model is prompted with a hierarchical structure of sub-prompts, which allows for more complex and interconnected reasoning. The utilisation of advanced prompting techniques has become imperative in enhancing the understanding and reasoning capabilities of Language and Logic Models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/0*oc98Hzxd6AYNFeBy" /></figure><p>(<a href="https://arxiv.org/pdf/2305.10601.pdf">Image Source</a>)</p><p><strong>Chain-of-thought (CoT) prompting </strong>was proposed to address cases where the mapping of input x to output y is non-trivial (e.g. when x is a maths question and y is the final numerical answer).</p><p>You can refer to the <a href="https://www.allabtai.com/the-tree-of-thoughts-prompt-template/"><strong>Tree of Thought Prompt Template</strong></a><strong>, </strong>here the author has discussed how we can apply the Tree of Thought prompting technique to the language models.</p><h3>Retrieval Augmented Generation</h3><p>Retrieval Augmented Generation (RAG) represents a cutting-edge approach in artificial intelligence, merging the strengths of two distinct methods: retrieval-based techniques and generative modelling. Essentially, RAG enhances a Large Language Model (LLM) by empowering it to access and utilise external data sources.</p><p>When tasked with generating a response, the LLM first searches for and retrieves relevant information from a designated knowledge base.</p><p>This knowledge base can vary, ranging from the vast expanse of the Internet to more specialised, closed databases. Once the pertinent information is retrieved, the LLM integrates it to construct responses that are not only coherent but also contextually accurate and informed by the data gathered.</p><p>This process enables the model to provide answers that are both precise and relevant, grounded in the information obtained from the chosen knowledge sources</p><p>The following Diagram illustrates the working of RAG</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/0*BFBNX0kE7DuKvAVO" /></figure><p>(<a href="https://insider.govtech.com/texas/quickly-build-high-accuracy-generative-ai-applications-on-enterprise-data-using-amazon-kendra-langchain-and-large-language-models">Image Source</a>)</p><p>You can refer to this <a href="https://arxiv.org/pdf/2005.11401.pdf">Research Paper</a> to learn more about the RAG.</p><h3>Tokenization</h3><p>Certainly! Tokenization is a fundamental aspect of how models like GPT (Generative Pre-trained Transformer) process and generate text. Here’s an overview:</p><h3>What is Tokenization?</h3><p>1. <strong>Basic Definition:</strong> Tokenization is the process of breaking down text into smaller units, called tokens. In the context of language models like GPT, these tokens can be words, parts of words, or even individual characters.</p><p>2. <strong>Purpose</strong>: The main goal of tokenization is to convert the raw text into a format that the model can understand and process. This allows the model to analyse and generate language based on the input it receives.</p><h3>Types of Tokenization in GPT Models</h3><ul><li><strong>Byte Pair Encoding (BPE)</strong>: <br> — <strong>How it Works</strong>: BPE is a common tokenization method used in earlier versions of GPT. It starts with a base vocabulary of individual characters and then iteratively combines the most frequent pairs of tokens to form new, larger tokens. <br> — <strong>Advantages</strong>: This method is efficient at handling a wide range of vocabulary, including rare words or names, as it can break them down into smaller, known sub-tokens.</li><li><strong>WordPiece</strong>: <br> — <strong>Similar to BPE</strong>: It’s another subword tokenization algorithm similar to BPE but with some differences in how the tokens are selected during training.</li><li><strong>Unigram Language Model:<br> — Used in Later GPT Versions</strong>: This is a more advanced tokenization technique that uses a probabilistic language model to determine the most likely segmentation of a sequence of characters into tokens.</li></ul><h3>Understanding GPT’s Tokenization with Token Counting</h3><p>After discussing the tokenization methods used in GPT models, it’s crucial to understand how these tokens are counted, especially since token counts can directly impact the model’s processing and output capabilities.</p><p>Counting Tokens: A Practical Example</p><p>Let’s illustrate token counting with a practical example. Consider the following paragraph:</p><pre>Please reply to all my messages as if you are a character from the anime series &#39;Dragon Ball Z.&#39; Use either their actual lines or your best imitation of how they might respond, choosing the character whose response fits best with my message. Where applicable, include references to events from their life to strengthen your point. Begin your response by stating the character&#39;s name followed by a colon.</pre><p>This paragraph, when processed through GPT’s tokenizer, results in a total of 75 tokens. This count can be obtained by using tokenization tools provided by platforms like OpenAI. For instance, OpenAI’s tokenizer available at<a href="https://platform.openai.com/tokenizer"> OpenAI Tokenizer</a> can be used for this purpose.</p><p>Why Token Count Matters</p><ol><li><strong>Model Limitations:</strong> GPT models have a maximum token limit for each input and output. Understanding token count helps in structuring inputs and anticipating the length of outputs.</li><li><strong>Efficiency and Performance:</strong> More tokens mean more data for the model to process, which can impact response time and computational resources.</li><li><strong>Quality of Generation:</strong> The division of text into tokens affects how well the model understands and generates responses. Mis-tokenization or excessive token usage can lead to less coherent outputs.</li><li><strong>Subword Information:</strong> In cases of subword tokenization (like BPE), knowing the token count also reveals how often the model needs to break down words into smaller pieces, which can be indicative of the complexity of the text or the efficiency of the tokenization method.</li></ol><p>In conclusion, Tokenization and token counting are integral to understanding and effectively using GPT models. The way text is broken down into tokens directly affects the model’s understanding and output. By counting tokens, as shown in the provided example, we can gain insights into how the model processes language and optimises our use of these powerful AI tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*5383EOspp9m8cmZW" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f22fdb1a4185" width="1" height="1" alt=""><hr><p><a href="https://medium.com/shuru-tech/dynamic-prompts-master-the-art-f22fdb1a4185">Dynamic Prompts: Master the Art</a> was originally published in <a href="https://medium.com/shuru-tech">Shuru</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>