<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Elxpro</title>
    <description>The latest articles on DEV Community by Elxpro (@theguuholi).</description>
    <link>https://dev.to/theguuholi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F324015%2Fc2f20c59-99f1-48c6-9e8f-81b7a749e80b.jpeg</url>
      <title>DEV Community: Elxpro</title>
      <link>https://dev.to/theguuholi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/theguuholi"/>
    <language>en</language>
    <item>
      <title>Lessons from Law 1 of "The 48 Laws of Power"</title>
      <dc:creator>Elxpro</dc:creator>
      <pubDate>Mon, 06 Jan 2025 10:17:27 +0000</pubDate>
      <link>https://dev.to/theguuholi/lessons-from-law-1-of-the-48-laws-of-power-n8</link>
      <guid>https://dev.to/theguuholi/lessons-from-law-1-of-the-48-laws-of-power-n8</guid>
      <description>&lt;h3&gt;
  
  
  Strategy, Respect, and Prudence: Lessons from Law 1 of "The 48 Laws of Power"
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Law 1: Never outshine the master.&lt;/strong&gt; This idea resonates deeply, not just in the context of bosses and leaders but in any relationship where we depend on or learn from someone. Below, we explore the book's teachings and practical reflections to apply them intelligently and respectfully in your life.&lt;/p&gt;




&lt;h3&gt;
  
  
  Submission with Purpose: Strategy and Proactivity
&lt;/h3&gt;

&lt;p&gt;Submitting strategically is not a sign of weakness but a way to achieve greater objectives. It's about knowing when to yield to move forward.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; An employee accepts challenging or unpleasant tasks at work, demonstrating commitment and reliability. This positions the professional as indispensable, potentially leading to promotions or future opportunities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Practical application in daily life:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you feel the urge to retaliate, take a deep breath. Use phrases that defuse tense situations, such as: “I understand your point; can you explain more about how I can improve?” This demonstrates maturity and builds stronger relationships.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Respect the Trajectory of Those Above
&lt;/h3&gt;

&lt;p&gt;Respecting the journey of those above you is essential to building healthy relationships and avoiding unnecessary confrontations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to practice this?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Listen more:&lt;/strong&gt; Ask about the person's experiences and stories. For example: “How did you start in this field?” or “What motivated you to get where you are?”&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Acknowledge efforts:&lt;/strong&gt; Make positive comments, such as: “I find it impressive how you managed that complex project.”&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Avoid comparisons:&lt;/strong&gt; Focus on the person's merits instead of criticizing or thinking about what you would have done differently.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Dynamics of Autonomy and Control
&lt;/h3&gt;

&lt;p&gt;To effectively support a superior, it is crucial to observe their preferences and adapt your behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Autonomy vs. Control:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Autonomy:&lt;/strong&gt; Some leaders prefer the team to make decisions independently. If this is the case, present ready solutions before seeking approval.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Control:&lt;/strong&gt; Others like to be involved in the details. In this scenario, share each step of the progress and request constant feedback.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Quick Results vs. Planned Outcomes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Leaders who prioritize &lt;strong&gt;quick results&lt;/strong&gt; value practical and immediate solutions.&lt;/li&gt;
&lt;li&gt;Leaders who prefer &lt;strong&gt;planning&lt;/strong&gt; focus on detailed strategies and long-term forecasts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Where to note patterns:&lt;/strong&gt; Use tools like Notion, Evernote, or a simple notebook to record:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Communication preferences.&lt;/li&gt;
&lt;li&gt;Typical reactions under pressure.&lt;/li&gt;
&lt;li&gt;Things the leader values, such as punctuality or creativity.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Aligning Priorities and Solving Problems in Advance
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;How to align priorities?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ask directly: “What points are most important to you in this project?”&lt;/li&gt;
&lt;li&gt;Show interest: “I can help ensure this goal is achieved. Is there any area that needs special attention?”&lt;/li&gt;
&lt;li&gt;Review your actions to ensure they meet the leader’s expectations.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Solving problems in advance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Observe recurring failures:&lt;/strong&gt; Identify and avoid errors that have occurred in previous projects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anticipate obstacles:&lt;/strong&gt; Propose solutions before problems are noticed. For example: “I noticed the presentation needs clearer charts. I prepared something to improve this.”&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Be proactive:&lt;/strong&gt; Act before being asked. This demonstrates initiative and commitment.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Reflection on Career Goals
&lt;/h3&gt;

&lt;p&gt;Your current goals—earning money, taking care of your family, and building passive income—are legitimate and respectable. However, having clarity about the path forward can help you achieve these goals more efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Questions for reflection:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What do you want to accomplish in the next 5 or 10 years?&lt;/li&gt;
&lt;li&gt;What skills do you need to develop to grow in your field or create new sources of income?&lt;/li&gt;
&lt;li&gt;How can you build passive income sustainably? Consider investments, creating digital products, or other sources that don’t demand much of your time.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Final Considerations
&lt;/h3&gt;

&lt;p&gt;Applying Law 1 in practice requires observation, respect, and prudence. Be strategic in submission, value the trajectory of those above, and align priorities clearly and efficiently. Additionally, take time to reflect on your long-term goals, ensuring your actions align with what truly matters to you.&lt;/p&gt;

</description>
      <category>development</category>
      <category>productivity</category>
      <category>leadership</category>
      <category>learning</category>
    </item>
    <item>
      <title>How to Build an Effective Software Engineer CV</title>
      <dc:creator>Elxpro</dc:creator>
      <pubDate>Thu, 02 Jan 2025 19:16:57 +0000</pubDate>
      <link>https://dev.to/theguuholi/how-to-build-a-good-developer-cv-407h</link>
      <guid>https://dev.to/theguuholi/how-to-build-a-good-developer-cv-407h</guid>
      <description>&lt;h1&gt;
  
  
  How to Build a Good Developer CV
&lt;/h1&gt;

&lt;p&gt;Creating a strong CV is essential for standing out in the competitive tech industry. This guide will walk you through the process of building a solid resume, including tips from top resources like &lt;a href="https://www.resumemaker.online" rel="noopener noreferrer"&gt;ResumeMaker&lt;/a&gt;, &lt;a href="https://www.jobscan.co" rel="noopener noreferrer"&gt;JobScan&lt;/a&gt;, &lt;a href="https://stackoverflow.blog/2020/11/25/how-to-write-an-effective-developer-resume-advice-from-a-hiring-manager/" rel="noopener noreferrer"&gt;StackOverflow Blog&lt;/a&gt;, and &lt;a href="https://www.cake.me/Engineering-resume-samples" rel="noopener noreferrer"&gt;Cake&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Points for a Strong Resume
&lt;/h2&gt;




&lt;h3&gt;
  
  
  1. &lt;strong&gt;Keep it One Page&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Employers typically spend only a few seconds scanning your resume. A concise, one-page resume helps you highlight your best qualities without overwhelming the reader.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Include Relevant Skills&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Only list skills that are relevant to the job you are applying for. Tailor your technical knowledge section to the job description to improve your chances of getting noticed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Personalize Your Resume&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Customize your resume to match the specific role you are applying for. This includes adjusting your experience descriptions and technical skills to reflect what the employer values.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Include Online Links&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Include links to your LinkedIn, GitHub, or portfolio. These links can showcase your work in a more dynamic way than a static resume.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step-by-Step Guide to Building a Developer CV
&lt;/h2&gt;




&lt;h3&gt;
  
  
  Step 1: &lt;strong&gt;Choose a Pre-Designed Resume Template&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use pre-designed resume templates to make the process easier. Templates help ensure your CV looks professional and is well-organized.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 2: &lt;strong&gt;Use Action Words&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Begin bullet points with action verbs such as "designed," "developed," "led," or "implemented." This demonstrates your active involvement in past projects.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 3: &lt;strong&gt;Measure Impact, Not Just Responsibilities&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Instead of simply listing tasks, explain the impact of your work. Use metrics when possible (e.g., "Reduced load time by 30%," "Improved performance, resulting in 40% higher efficiency").&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 4: &lt;strong&gt;Tailor Your CV to the Job&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Match the keywords and technologies mentioned in the job description. This not only ensures that your resume aligns with the company's needs, but also increases the chance of passing Applicant Tracking Systems (ATS).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 5: &lt;strong&gt;Highlight Relevant Experience&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Focus on showcasing experience that directly aligns with the position. For instance, emphasize projects that use the technologies or skills the company is looking for.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 6: &lt;strong&gt;List Education and Certifications&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Include your relevant degrees, certifications, or courses you've completed, especially if they’re relevant to the job you're applying for.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 7: &lt;strong&gt;Focus on Technical Knowledge&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Your technical skills section should showcase the languages, tools, frameworks, and platforms you’re proficient in. Avoid listing too many tools that you’re not experienced with.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 8: &lt;strong&gt;Remove the Word “I”&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Your CV should be written in the third person. Avoid using personal pronouns like "I" to keep the tone professional and objective.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 9: &lt;strong&gt;Avoid Buzzwords&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Instead of generic buzzwords (e.g., "team player," "hardworking"), focus on specific skills, experiences, and accomplishments that demonstrate your abilities.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 10: &lt;strong&gt;Proofread for Typos and Grammar Mistakes&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A CV with typos and grammar mistakes can easily harm your chances. Make sure to proofread your resume carefully or have someone else review it for you.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Resume Cheat Sheet
&lt;/h2&gt;

&lt;p&gt;Check these off as you finalize your CV:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Use a pre-designed resume template&lt;/li&gt;
&lt;li&gt;[ ] Ensure your resume fits on 1 page&lt;/li&gt;
&lt;li&gt;[ ] Tailor your CV by including keywords from the job description&lt;/li&gt;
&lt;li&gt;[ ] Mention the company name you're applying to&lt;/li&gt;
&lt;li&gt;[ ] Make sure your first item aligns with the company's needs&lt;/li&gt;
&lt;li&gt;[ ] Experience titles demonstrate value&lt;/li&gt;
&lt;li&gt;[ ] Include online links (LinkedIn, GitHub, etc.)&lt;/li&gt;
&lt;li&gt;[ ] Remove personal pronouns ("I")&lt;/li&gt;
&lt;li&gt;[ ] Avoid buzzwords, focus on specifics&lt;/li&gt;
&lt;li&gt;[ ] Use action words in descriptions&lt;/li&gt;
&lt;li&gt;[ ] Quantify impact with numbers when possible&lt;/li&gt;
&lt;li&gt;[ ] Only include sections that are impressive: Experience, Projects, Education, and Technical Skills&lt;/li&gt;
&lt;li&gt;[ ] Double-check for typos and bad grammar&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;




&lt;p&gt;A good CV is a powerful tool to showcase your skills and experience. By focusing on relevant skills, measurable impact, and aligning your CV with the job you're applying for, you increase your chances of standing out to employers. Use the steps and tips in this guide to build a resume that truly represents your expertise as a developer.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>If you want to understand how Elixir Apps work, this is the way</title>
      <dc:creator>Elxpro</dc:creator>
      <pubDate>Thu, 25 Aug 2022 19:15:00 +0000</pubDate>
      <link>https://dev.to/theguuholi/if-you-want-to-understand-how-elixir-apps-work-this-is-the-way-h89</link>
      <guid>https://dev.to/theguuholi/if-you-want-to-understand-how-elixir-apps-work-this-is-the-way-h89</guid>
      <description>&lt;p&gt;Before you read this Article, I highly recommend you read the article about GenServer:&lt;br&gt;
&lt;a href="https://dev.to/postelxpro/read-this-article-if-you-want-to-learn-genserver-1l24"&gt;https://dev.to/postelxpro/read-this-article-if-you-want-to-learn-genserver-1l24&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you want to learn Elixir in three months? &lt;a href="https://elxpro.com/sell" rel="noopener noreferrer"&gt;https://elxpro.com/sell&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Greeting
&lt;/h1&gt;

&lt;p&gt;Hello #devElixir!!! Welcome to #FullStackElxpro&lt;/p&gt;

&lt;p&gt;Here, we discuss strategies and tips for your Elixir learning journey from zero to an expert in 3 months.&lt;/p&gt;

&lt;p&gt;I am Gustavo, and today&amp;amp;#39;s theme is **Setup your local machine to use Elixir**.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ps: You can follow the Article with &lt;strong&gt;a VIDEO&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Want to learn more about Elixir on a Telegram channel?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://elxpro.com/subscribe-elxcrew" rel="noopener noreferrer"&gt;https://elxpro.com/subscribe-elxcrew&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  What is the difference between Supervisor and DynamicSupervisor?
&lt;/h1&gt;

&lt;p&gt;Before understanding the difference between Supervisor and DynamicSupervisor. Let`s read and understand both. &lt;/p&gt;
&lt;h2&gt;
  
  
  Supervisor
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://elixir-lang.org/getting-started/mix-otp/supervisor-and-application.html" rel="noopener noreferrer"&gt;https://elixir-lang.org/getting-started/mix-otp/supervisor-and-application.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://elixir-lang.org/getting-started/mix-otp/supervisor-and-application.html" rel="noopener noreferrer"&gt;https://elixir-lang.org/getting-started/mix-otp/supervisor-and-application.html&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A supervisor is a process that supervises other processes, which we refer to as child processes. Supervisors are used to building a hierarchical process structure called a supervision tree. Supervision trees provide fault tolerance and encapsulate how our applications start and shut down.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In my experience as a Developer in general, Supervisor is a way to keep the lifecycle of my Elixir Web Applications and a way to start and manage the essential dependencies you will have in your App. E.g., Ecto, Phoenix, Oban, Broadway.&lt;/p&gt;

&lt;p&gt;Suppose you understand how Supervisor Works. It will be much easier to create dependencies of processes and how to start them quickly. Building Elixir applications and understanding core frameworks will be more straightforward in that case. &lt;/p&gt;
&lt;h2&gt;
  
  
  DynamicSupervisor
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A DynamicSupervisor starts with no children. Instead, children are started on demand via start_child/2. When a dynamic supervisor terminates, all children are shut down at the same time, with no guarantee of ordering.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://hexdocs.pm/elixir/1.13/DynamicSupervisor.html" rel="noopener noreferrer"&gt;https://hexdocs.pm/elixir/1.13/DynamicSupervisor.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://elixir-lang.org/getting-started/mix-otp/dynamic-supervisor.html" rel="noopener noreferrer"&gt;https://elixir-lang.org/getting-started/mix-otp/dynamic-supervisor.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DynamicSupervisor starts the process when is necessary, and you can see it easily when you have a Browser opened or a query execution using Ecto. I like creating associations during our typical day as an Elixir Developer because most of the time you will not use DynamycSupervisor/Supervisor. But they are there, you are using them, and you probably will need to debug or understand a piece of code in our core frameworks like ECTO/Phoenix or others. That is why understanding the difference between them and maybe in a day use them. &lt;/p&gt;
&lt;h1&gt;
  
  
  What's worth more? Use Supervisor or DynamicSupervisor
&lt;/h1&gt;

&lt;p&gt;I think you will use both but in a different context&lt;/p&gt;


&lt;h1&gt;
  
  
  Do you remember any stories where this was important to you?
&lt;/h1&gt;

&lt;p&gt;Yes, I do. I remember when I knew only to use Phoenix and Ecto barely, and I had some problems with those frameworks and lifecycles. And also, I was encouraging myself to learn deeply about how Phoenix, Ecto, and Elixir work. &lt;/p&gt;

&lt;p&gt;I had no idea why the application.ex was in my phoenix applications, no idea how the process and supervisors tree works, no idea how a phoenix app works. And I lost a lot of productivity in my day as an Elixir developer because I did not know why/how they worked and why they were there. When I decided to study how they worked and research both, my life as an Elixir developer changed. Elixir's level of skill and productivity was raised 10x more because I only understood how they work.&lt;/p&gt;


&lt;h1&gt;
  
  
  Where do you see people get it wrong the most?
&lt;/h1&gt;

&lt;p&gt;The main problem is you feel comfortable using only libs like Phoenix and Ecto for more than 10 months. Because if you don`t understand how your elixir application works, you will face problems scaling apps using dependencies like Oban, Broadway, or frameworks to use Cache, MongoDb, and even simple GenServer. &lt;/p&gt;

&lt;p&gt;The best way in my experience is:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Am I okay to create standard Phoenix Apps?&lt;/li&gt;
&lt;li&gt;Now I am going to study how Process works.&lt;/li&gt;
&lt;li&gt;Do I know how to make a GenServer/Agents and Tasks? I am going to look at it. &lt;/li&gt;
&lt;li&gt;Do I understand how Supervisor and DynamicSupervisor work? I am good at learning it. &lt;/li&gt;
&lt;/ul&gt;


&lt;h1&gt;
  
  
  Where to start?
&lt;/h1&gt;
&lt;h2&gt;
  
  
  Level 1
&lt;/h2&gt;

&lt;p&gt;Start a standard Elixir app&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ mix new practice                                       

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and create a GenServer&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defmodule StocksV1 do
  use GenServer

  def start_link(name: name, valuation: valuation) do
    GenServer.start_link(__MODULE__, valuation, name: name)
  end

  def init(state) do
    {:ok, state}
  end

  def handle_cast({:add, value}, state) do
    state = state + value
    {:noreply, state}
  end

  def add(stock, value) do
    GenServer.cast(stock, {:add, value})
  end
end

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lets Play around with our Genserver.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;iex(4)&amp;gt; StocksV1.start_link name: :etsy, valuation: 10

iex(5)&amp;gt; :sys.get_state :etsy

iex(6)&amp;gt; GenServer.cast :etsy, {:add, 30} 

iex(7)&amp;gt; :sys.get_state :etsy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How about we want to start our stock within our App?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this case, we can use Supervisor but how to start it? &lt;/p&gt;

&lt;p&gt;It is simple, but we need to use the application because we are learning the whole process we need to use the application. And Application is essential for our Libs and Elixir application.&lt;/p&gt;

&lt;p&gt;Read more: &lt;a href="https://hexdocs.pm/elixir/1.13/Application.html" rel="noopener noreferrer"&gt;https://hexdocs.pm/elixir/1.13/Application.html&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Applications are the idiomatic way to package software in Erlang/OTP. To get the idea, they are similar to the "library" concept common in other programming languages, but with some additional characteristics.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;straightforward to use it, you only need to add in your &lt;strong&gt;mix.exs&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  def application do
    [
      extra_applications: [:logger],
      mod: {Practice.Application, []}
    ]
  end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;create &lt;strong&gt;application.ex&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defmodule Practice.Application do
  use Application

  def start(_, _) do
    children = []
    Supervisor.start_link(children, strategy: :one_for_one, name: __MODULE__)
  end
end

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every time that you create an Application you must create an :erlang.link and in this case our link is our Supervisor. After starting the Supervisor you can only add your process to run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defmodule Practice.Application do
  use Application

  def start(_, _) do
    children = [
      {StocksV1, name: :etsy, valuation: 10},
      # {StocksV1, name: :appl, valuation: 10}
    ]
    Supervisor.start_link(children, strategy: :one_for_one, name: __MODULE__)
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But you will notice that one of them is commented because you need IDS, and we can`t start it when we want but when we start the application, which makes us move to the next step. Start using DynamicSupervisors.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
defmodule Practice.Application do&lt;br&gt;
  use Application&lt;/p&gt;

&lt;p&gt;def start(_, _) do&lt;br&gt;
    children = [&lt;br&gt;
      {Registry, keys: :unique, name: Stocks},&lt;br&gt;
      {DynamicSupervisor, strategy: :one_for_one, name: Stocks.DynamicSupervisor}&lt;br&gt;
    ]&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Supervisor.start_link(children, strategy: :one_for_one, name: __MODULE__)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;end&lt;br&gt;
end&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
defmodule Stocks do&lt;br&gt;
  use GenServer&lt;/p&gt;

&lt;p&gt;def start_link(name: name, valuation: valuation) do&lt;br&gt;
    name = stock_name(name)&lt;br&gt;
    GenServer.start_link(&lt;strong&gt;MODULE&lt;/strong&gt;, valuation, name: name)&lt;br&gt;
  end&lt;/p&gt;

&lt;p&gt;def stock_name(name) do&lt;br&gt;
    {:via, Registry, {&lt;strong&gt;MODULE&lt;/strong&gt;, name}}&lt;br&gt;
  end&lt;/p&gt;

&lt;p&gt;def init(state) do&lt;br&gt;
    {:ok, state}&lt;br&gt;
  end&lt;/p&gt;

&lt;p&gt;def handle_cast({:add, value}, state) do&lt;br&gt;
    state = state + value&lt;br&gt;
    {:noreply, state}&lt;br&gt;
  end&lt;/p&gt;

&lt;p&gt;def create_stock(name, valuation \ 20) do&lt;br&gt;
    DynamicSupervisor.start_child(&lt;br&gt;
      Stocks.DynamicSupervisor,&lt;br&gt;
      {Stocks, [name: name, valuation: valuation]}&lt;br&gt;
    )&lt;br&gt;
  end&lt;/p&gt;

&lt;p&gt;def add(stock, value) do&lt;br&gt;
    stock = stock_name(stock)&lt;br&gt;
    GenServer.cast(stock, {:add, value})&lt;br&gt;
  end&lt;br&gt;
end&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When you call create_stock, different of a GenServer, you will create a child for your DynamicSupervisor and then. Create a process_id linking to your Parent's process.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
iex(1)&amp;gt; Stocks.create_stock "apple", 100&lt;br&gt;
{:ok, #PID&amp;lt;0.175.0&amp;gt;}&lt;/p&gt;

&lt;p&gt;iex(2)&amp;gt; Stocks.create_stock "alphabet", 300&lt;br&gt;
{:ok, #PID&amp;lt;0.177.0&amp;gt;}&lt;/p&gt;

&lt;p&gt;iex(3)&amp;gt; :sys.get_state pid("0.175.0")&lt;br&gt;
100&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Because we are using Registry, the way that we are creating processes is different. that is why we have the function stock_name, creating the unique ID to our process and then change the state.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
iex(4)&amp;gt; Stocks.add "apple", 300&lt;br&gt;
:ok&lt;br&gt;
iex(5)&amp;gt; :sys.get_state pid("0.175.0")&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Wrap up
&lt;/h1&gt;

&lt;p&gt;If you followed this article, you will notice how simple is to use both of the services when you understand how the process works.&lt;/p&gt;

&lt;p&gt;Social networks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gustavo Oliveira - &lt;a href="https://www.linkedin.com/in/gustavo-oliveira-642b23aa/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/gustavo-oliveira-642b23aa/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro Linkedin - &lt;a href="https://www.linkedin.com/company/36977430" rel="noopener noreferrer"&gt;https://www.linkedin.com/company/36977430&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Twitter - &lt;a href="https://twitter.com/elx_pro" rel="noopener noreferrer"&gt;https://twitter.com/elx_pro&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro - &lt;a href="https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>elixir</category>
      <category>beam</category>
      <category>phoenix</category>
      <category>liveview</category>
    </item>
    <item>
      <title>The most effective way to Setup your machine to use Elixir</title>
      <dc:creator>Elxpro</dc:creator>
      <pubDate>Fri, 19 Aug 2022 12:52:00 +0000</pubDate>
      <link>https://dev.to/theguuholi/the-most-effective-way-to-setup-your-machine-to-use-elixir-2f78</link>
      <guid>https://dev.to/theguuholi/the-most-effective-way-to-setup-your-machine-to-use-elixir-2f78</guid>
      <description>&lt;h1&gt;
  
  
  Greeting
&lt;/h1&gt;

&lt;p&gt;Hello #devElixir!!! Welcome to #FullStackElxpro&lt;/p&gt;

&lt;p&gt;Here we discuss strategies and tips for your Elixir learning journey, from scratch to a hero Elixir developer.&lt;/p&gt;

&lt;p&gt;I am Gustavo, and today&amp;amp;#39;s theme is **Setup your local machine to use Elixir**.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you want to learn Elixir in three months? &lt;a href="https://elxpro.com/sell" rel="noopener noreferrer"&gt;https://elxpro.com/sell&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ps: You can follow the Article with &lt;strong&gt;a VIDEO&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Want to learn more about Elixir on a Telegram channel?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://elxpro.com/subscribe-elxcrew" rel="noopener noreferrer"&gt;https://elxpro.com/subscribe-elxcrew&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Why is it essential to set up your machine to use Elixir?
&lt;/h1&gt;

&lt;p&gt;Having the tools on time will help you be more productive and performant.&lt;/p&gt;

&lt;p&gt;And in addition to letting you perform faster, it will be simple and fast when you have everything you need to develop with Elixir.&lt;/p&gt;

&lt;h1&gt;
  
  
  Do you remember when it was necessary for your career?
&lt;/h1&gt;

&lt;p&gt;For most of the projects I worked on, I noticed how arduous it was to set up my local machine to work with the right tools. When I decided to work with Elixir, I mapped all essential tools to work in multiple scenarios. I got lucky because this setup was always a success. Why do I want to share it with you?  To make your life as an Elixir engineer easier.&lt;/p&gt;

&lt;h1&gt;
  
  
  Let`s start
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Tools
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Zsh&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Zsh is a nice tool to use in your terminal&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;brew install zsh zsh-completions&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://formulae.brew.sh/formula/curl" rel="noopener noreferrer"&gt;Curl&lt;/a&gt;&lt;/strong&gt;: Sometimes to, test HTTP requests is very usefull&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/tonsky/FiraCode/wiki/Installing" rel="noopener noreferrer"&gt;Firacode&lt;/a&gt;&lt;/strong&gt;: This font is easier to read for a developer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After installing, I highly recommend setting up your terminal with this font.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://ohmyz.sh/" rel="noopener noreferrer"&gt;OhMyZsh&lt;/a&gt;&lt;/strong&gt;: Nice tool to make your terminal awesome for a developer&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://elixir-lang.org/install.html" rel="noopener noreferrer"&gt;Elixir&lt;/a&gt;&lt;/strong&gt;: The most important tool. Elixir lang &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://hexdocs.pm/phoenix/installation.html" rel="noopener noreferrer"&gt;Phoenix&lt;/a&gt;&lt;/strong&gt;: The most important framework. Phoenix to create Web Elixir projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://git-scm.com/download/mac" rel="noopener noreferrer"&gt;GIT&lt;/a&gt;&lt;/strong&gt;: Essential to control version code&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;&lt;a href="https://docs.docker.com/engine/install/ubuntu/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt;&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;This is one of the most essential tools for a new-age developer. Docker makes our life easier to simulate environments, build our own image projects, and install databases and tools for the developers without dirtying our computers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redis&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When I need to use Redis in a project, I install it using docker.&lt;br&gt;
&lt;strong&gt;Mongo&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When I need to use Mongo in a project, I install it using docker.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Kafka&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When I need to use Kafka in a project, I install it using docker. I always use the script below, and it work really well &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://gist.github.com/theguuholi/f33b000d6aa1ee83b4d403574969e4a2" rel="noopener noreferrer"&gt;https://gist.github.com/theguuholi/f33b000d6aa1ee83b4d403574969e4a2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Postgres&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Postgres is an essential Database for those who work with Elixir. And The script below that I provided for you is a way to install the Postgres database easily and fast to start without your need to make any extra configurations in your local machine.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;docker network create pg --driver bridge&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;docker run --name pg --network=pg -e "POSTGRES_PASSWORD=postgres" -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data -d postgres:13.4&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://gigalixir.readthedocs.io/en/latest/getting-started-guide.html#install-the-command-line-interface" rel="noopener noreferrer"&gt;Gigalixir&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A very nice tool to deploy Elixir application and cheap. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Docker-compose&lt;/strong&gt;:  Most of the time, when you install Docker, the tool gives you docker-compose&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://kubernetes.io/docs/setup/production-environment/container-runtimes/" rel="noopener noreferrer"&gt;Kubernetes&lt;/a&gt;&lt;/strong&gt;:  Most of the time, when you install Docker, the tool gives you kubernetes&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://k9scli.io/topics/install/" rel="noopener noreferrer"&gt;K9s&lt;/a&gt;&lt;/strong&gt;: Kubernetes CLI To Manage Your Clusters In Style!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://formulae.brew.sh/formula/kubectx" rel="noopener noreferrer"&gt;kubectx&lt;/a&gt;&lt;/strong&gt;: Tool to change kubernetes clusters easily&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/#install-with-homebrew-on-macos" rel="noopener noreferrer"&gt;kubernetes-cli&lt;/a&gt;&lt;/strong&gt;: Tool to execute commands in kubernetes. &lt;/p&gt;

&lt;p&gt;...kubectl..... get, apply... pods, deployments....  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://helm.sh/docs/intro/install/" rel="noopener noreferrer"&gt;Helm&lt;/a&gt;&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
Helm helps you manage Kubernetes applications — Helm Charts help you define, install, and upgrade even the most complex Kubernetes application&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://formulae.brew.sh/cask/dbeaver-community" rel="noopener noreferrer"&gt;DBeaver&lt;/a&gt;&lt;/strong&gt;: Access SQL databases &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.conduktor.io/" rel="noopener noreferrer"&gt;Conduktor&lt;/a&gt;&lt;/strong&gt;:&lt;br&gt;
We take the complexity out of Kafka. We give you the tools you need to troubleshoot, develop, test, and collaborate with confidence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://docs.insomnia.rest/insomnia/install" rel="noopener noreferrer"&gt;Insomnia&lt;/a&gt;&lt;/strong&gt;: For me, is one the best HTTP tool, also easier to create a good APIs with REST/GraphQL documentation.&lt;/p&gt;
&lt;h2&gt;
  
  
  Cloud SDKs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Most of companies use one of them. I prefer google cloud :D &lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Google Cloud
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://formulae.brew.sh/cask/google-cloud-sdk" rel="noopener noreferrer"&gt;Google Cloud SDK&lt;/a&gt;&lt;/strong&gt;: Tool to access Google Cloud Services&lt;/p&gt;
&lt;h3&gt;
  
  
  Aws
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://formulae.brew.sh/formula/awscli" rel="noopener noreferrer"&gt;Aws-Cli&lt;/a&gt;&lt;/strong&gt;: Tool to access Aws Services&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://formulae.brew.sh/formula/eksctl" rel="noopener noreferrer"&gt;Eks-ctl&lt;/a&gt;&lt;/strong&gt;: Tool to manage Aws kubernetes&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;a href="https://code.visualstudio.com/download" rel="noopener noreferrer"&gt;VSCode&lt;/a&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Beautify&lt;/li&gt;
&lt;li&gt;Color Highlight&lt;/li&gt;
&lt;li&gt;ElixirLS&lt;/li&gt;
&lt;li&gt;ENV&lt;/li&gt;
&lt;li&gt;Git Graph&lt;/li&gt;
&lt;li&gt;Live Share&lt;/li&gt;
&lt;li&gt;Markdown All in One&lt;/li&gt;
&lt;li&gt;Material Icon Theme&lt;/li&gt;
&lt;li&gt;Phoenix Framework &lt;/li&gt;
&lt;li&gt;PostCSS Language Support&lt;/li&gt;
&lt;li&gt;Tailwind CSS IntelliSense&lt;/li&gt;
&lt;li&gt;Tools for Apache Kafka &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My &lt;strong&gt;settings.json&lt;/strong&gt; to VSCode: &lt;a href="https://gist.github.com/theguuholi/0a8d3c8ca651f0fe737e10d53415eb20" rel="noopener noreferrer"&gt;https://gist.github.com/theguuholi/0a8d3c8ca651f0fe737e10d53415eb20&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;`&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "editor.fontFamily": "Fira Code",
    "editor.fontLigatures": true,
    "emmet.includeLanguages": {
        "html-eex": "html"
    },
    "bracketPairColorizer.consecutivePairColors": [
        [
            "&amp;lt;",
            "&amp;lt;/"
        ],
        [
            "&amp;lt;",
            "/&amp;gt;"
        ],
        [
            "Gold",
            "Orchid",
            "LightSkyBlue"
        ],
        "Red"
    ],
    "files.associations": {
        "*.eex": "html-eex",
        "*.leex": "html-eex",
        "*.heex": "html-eex"
    },
    "beautify.language": {
        "js": {
            "type": [
                "javascript",
                "json",
                "jsonc"
            ],
            "filename": [
                ".jshintrc",
                ".jsbeautifyrc"
            ]
        },
        "css": [
            "css",
            "less",
            "scss"
        ],
        "html": [
            "htm",
            "html",
            "html-eex"
        ]
    },
    "[javascript]": {
        "editor.defaultFormatter": "HookyQR.beautify"
    },
    "[html-eex]": {
        "editor.defaultFormatter": "HookyQR.beautify"
    },
    "workbench.iconTheme": "material-icon-theme",
    "explorer.confirmDelete": false,
    "[json]": {
        "editor.defaultFormatter": "HookyQR.beautify"
    },
    "security.workspace.trust.untrustedFiles": "open",
    "explorer.confirmDragAndDrop": false,
    "diffEditor.ignoreTrimWhitespace": false,
    "terminal.integrated.enableMultiLinePasteWarning": false,
    "editor.bracketPairColorization.enabled": true,
    "editor.guides.bracketPairs": "active",
    "editor.codeActionsOnSave": {

    },
    "[css]": {
        "editor.defaultFormatter": "HookyQR.beautify"
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ShortCuts and Zsh
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/zdharma-continuum/zinit" rel="noopener noreferrer"&gt;Install Z-init:&lt;br&gt;
&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Plugins Zinit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;zinit light zdharma/fast-syntax-highlighting
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-completions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;zdharma/fast-syntax-highlighting: recognize commands&lt;br&gt;
zsh-users/zsh-autosuggestions: suggest commands.&lt;br&gt;
zsh-users/zsh-completion: add commands&lt;/p&gt;

&lt;p&gt;My Zshrc config: &lt;br&gt;
&lt;a href="https://gist.github.com/theguuholi/d5da8b11d100f04290f8ba203f991767" rel="noopener noreferrer"&gt;https://gist.github.com/theguuholi/d5da8b11d100f04290f8ba203f991767&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Social networks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gustavo Oliveira - &lt;a href="https://www.linkedin.com/in/gustavo-oliveira-642b23aa/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/gustavo-oliveira-642b23aa/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro Linkedin - &lt;a href="https://www.linkedin.com/company/36977430" rel="noopener noreferrer"&gt;https://www.linkedin.com/company/36977430&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Twitter - &lt;a href="https://twitter.com/elx_pro" rel="noopener noreferrer"&gt;https://twitter.com/elx_pro&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;ElxproBr - &lt;a href="https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro - &lt;a href="https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>elixir</category>
      <category>programing</category>
      <category>beam</category>
      <category>phoenix</category>
    </item>
    <item>
      <title>If you already created LiveView pages without this, read this article.</title>
      <dc:creator>Elxpro</dc:creator>
      <pubDate>Wed, 03 Aug 2022 19:14:00 +0000</pubDate>
      <link>https://dev.to/theguuholi/if-you-already-created-liveview-pages-without-this-read-this-article-3l87</link>
      <guid>https://dev.to/theguuholi/if-you-already-created-liveview-pages-without-this-read-this-article-3l87</guid>
      <description>&lt;h1&gt;
  
  
  Greeting
&lt;/h1&gt;

&lt;p&gt;Hello #devElixir!!! Welcome to #FullStackElxpro&lt;/p&gt;

&lt;p&gt;Here we discuss strategies and tips for your Elixir learning journey. This is from scratch until your first wave as an elixir developer.&lt;/p&gt;

&lt;p&gt;I am Gustavo, and today&amp;amp;#39;s theme is **LiveView Pages**.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you want to learn Elixir in three months? &lt;a href="https://elxpro.com/sell" rel="noopener noreferrer"&gt;https://elxpro.com/sell&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ps: You can follow the Article with &lt;strong&gt;&lt;a href="https://www.youtube.com/watch?v=MEQbfw9OItE" rel="noopener noreferrer"&gt;a VIDEO&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Want to learn more about Elixir on a Telegram channel?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://elxpro.com/subscribe-elxcrew" rel="noopener noreferrer"&gt;https://elxpro.com/subscribe-elxcrew&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is temporary_assign?
&lt;/h2&gt;

&lt;p&gt;You can read &lt;strong&gt;temporary_assign&lt;/strong&gt; on &lt;a href="https://hexdocs.pm/phoenix_live_view/dom-patching.html#temporary-assigns" rel="noopener noreferrer"&gt;Elixir Documentation&lt;/a&gt;, but for me, it was really hard to understand. I will explain it to you using what is temporary_assign for me, and you can get your conclusion.&lt;/p&gt;

&lt;p&gt;For me, &lt;strong&gt;temporary_assign&lt;/strong&gt; with &lt;strong&gt;phx-update&lt;/strong&gt; is a simpler way to prevent bugs in your LiveView pages when you have lists and possible real-time interactions with your pages, defining the best behavior with your team, product owners, and UX.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do I figure that out?
&lt;/h2&gt;

&lt;p&gt;When you are building LiveView pages, you probably just care about getting things done or getting the expected behavior; when you load/reload pages, your list will work normally, and the default behavior is a prepend on the list. But some bugs appear when necessary to update a list, and the elements are the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is temporary_assign so important?
&lt;/h2&gt;

&lt;p&gt;It is so straightforward to use and can avoid many future problems. With a couple of lines implemented, you only need to define what is important in your list and what is a possible expected behavior when you update that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why temporary_assign can get consistent LiveView pages.
&lt;/h2&gt;

&lt;p&gt;Because you can only define the expected behavior when new elements come, and if you don`t have this feature, for now, you can prevent kind of a bug in the future with only a few ways to think in your elements when you use &lt;strong&gt;temporary_assign&lt;/strong&gt; and &lt;strong&gt;phx-updates&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use temporary_assign to get consistent LiveView Pages.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Without temporary_assigns example
&lt;/h3&gt;

&lt;p&gt;If you use temporary_assigns and add new elements to your screen, the default behavior will be prepended and does not matter the ID.&lt;/p&gt;

&lt;p&gt;...Live do&lt;br&gt;
&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
  def mount(_, _, socket) do&lt;br&gt;
    messages = Enum.map(1..3, &amp;amp;%{id: &amp;amp;1, username: "gus #{&amp;amp;1}", text: "pumpkin  #{&amp;amp;1}"})&lt;br&gt;
    socket = assign(socket, messages: messages)&lt;br&gt;
    {:ok, socket}&lt;br&gt;
  end&lt;/p&gt;

&lt;p&gt;def handle_info({:u_msg, message}, socket) do&lt;br&gt;
    {:noreply, update(socket, :messages, fn messages -&amp;gt; [message | messages] end)}&lt;br&gt;
  end&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;...html.heex&lt;br&gt;
&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
    &amp;lt;%= self |&amp;gt; :erlang.pid_to_list %&amp;gt;&lt;br&gt;
    &amp;lt;ul&amp;gt;&lt;br&gt;
        &amp;lt;%= for message &amp;lt;- @messages do %&amp;gt;&lt;br&gt;
        &amp;lt;li&amp;gt;&lt;br&gt;
            &amp;lt;p&amp;gt;&amp;lt;span&amp;gt;&amp;lt;%= message.username %&amp;gt;:&amp;lt;/span&amp;gt; &amp;lt;%= message.text %&amp;gt;&amp;lt;/p&amp;gt;&lt;br&gt;
        &amp;lt;/li&amp;gt;&lt;br&gt;
        &amp;lt;% end %&amp;gt;&lt;br&gt;
    &amp;lt;/ul&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
iex(4)&amp;gt; pid = pid("0.698.0")&lt;/p&gt;

&lt;h1&gt;
  
  
  PID&amp;lt;0.698.0&amp;gt;
&lt;/h1&gt;

&lt;p&gt;iex(5)&amp;gt;  msg = %{username: "gus 234234", text: "pumpkin 1", id: :rand.uniform(10_000)}&lt;br&gt;
%{id: 870, text: "pumpkin 1", username: "gus 234234"}&lt;br&gt;
iex(6)&amp;gt; send pid, {:u_msg, msg}&lt;br&gt;&lt;br&gt;
{:u_msg, %{id: 870, text: "pumpkin 1", username: "gus 234234"}}&lt;br&gt;
iex(7)&amp;gt; send pid, {:u_msg, msg}&lt;br&gt;&lt;br&gt;
{:u_msg, %{id: 870, text: "pumpkin 1", username: "gus 234234"}}&lt;br&gt;
iex(8)&amp;gt; &lt;/p&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Only temporary_assigns example
&lt;/h3&gt;

&lt;p&gt;After defining what property element is temporary_assign and what will happen after receiving a new element, LiveView will delete every element and include the new one happening because now we have started using the default behavior &lt;code&gt;replace.&lt;/code&gt; Now, define what you expect when a new element is added to your list using the useful article LiveView documentation provides us on the link below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://hexdocs.pm/phoenix_live_view/dom-patching.html" rel="noopener noreferrer"&gt;https://hexdocs.pm/phoenix_live_view/dom-patching.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
  def mount(_, _, socket) do&lt;br&gt;
    messages = Enum.map(1..3, &amp;amp;%{id: &amp;amp;1, username: "gus #{&amp;amp;1}", text: "pumpkin  #{&amp;amp;1}"})&lt;br&gt;
    socket = assign(socket, messages: messages)&lt;br&gt;
    {:ok, socket, temporary_assigns: [messages: []]}&lt;br&gt;
  end&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
 msg = %{username: "gus #{:rand.uniform(10_000)}", text: "pumpkin #{:rand.uniform(10_000)}", id: :rand.uniform(10_000)}&lt;br&gt;
%{id: 9282, text: "pumpkin 7151", username: "gus 5213"}&lt;br&gt;
iex(35)&amp;gt; send pid, {:u_msg, msg}                                                                {:u_msg, %{id: 9282, text: "pumpkin 7151", username: "gus 5213"}}&lt;br&gt;
iex(36)&amp;gt; &lt;/p&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The power of temporary_assigns and DOM patching.
&lt;/h3&gt;

&lt;p&gt;When you use &lt;code&gt;phx-update&lt;/code&gt; with &lt;code&gt;temporary_assign,&lt;/code&gt; magic happens. You can define how to order your elements, not repeat the same element on your screen and define the best behavior for your user by simply adding phx-update. &lt;/p&gt;

&lt;p&gt;Of course, you need to include an ID attribute in your &lt;code&gt;phx-update,&lt;/code&gt; and every element in your list must also have an ID attribute.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
    &lt;/p&gt;
&lt;ul id="msgs"&gt;

        &amp;lt;%= for message &amp;lt;- @messages do %&amp;gt;
        &lt;li id="{Integer.to_string(message.id)}"&gt;

            &lt;p&gt;&lt;span&gt;&amp;lt;%= message.username %&amp;gt;:&lt;/span&gt; &amp;lt;%= message.text %&amp;gt;&lt;/p&gt;


&lt;/li&gt;


        &amp;lt;% end %&amp;gt;
    &lt;/ul&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Take a look an try by your self :D&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;/p&gt;

&lt;p&gt;iex(33)&amp;gt; send pid, {:u_msg, msg}&lt;br&gt;&lt;br&gt;
{:u_msg, %{id: 6719, text: "pumpkin 2150", username: "gus 8319"}}&lt;br&gt;
iex(34)&amp;gt;  msg = %{username: "gus #{:rand.uniform(10_000)}", text: "pumpkin #{:rand.uniform(10_000)}", id: :rand.uniform(10_000)}&lt;br&gt;
%{id: 9282, text: "pumpkin 7151", username: "gus 5213"}&lt;br&gt;
iex(35)&amp;gt; send pid, {:u_msg, msg}                                                                {:u_msg, %{id: 9282, text: "pumpkin 7151", username: "gus 5213"}}&lt;br&gt;
iex(36)&amp;gt; &lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  THE END.
&lt;/h1&gt;

&lt;p&gt;After this article, I hope you understand how important it is to use temporary_assigns and phx-update. See you next time BYE!!!&lt;/p&gt;

&lt;p&gt;Social networks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gustavo Oliveira - &lt;a href="https://www.linkedin.com/in/gustavo-oliveira-642b23aa/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/gustavo-oliveira-642b23aa/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro Linkedin - &lt;a href="https://www.linkedin.com/company/36977430" rel="noopener noreferrer"&gt;https://www.linkedin.com/company/36977430&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Twitter - &lt;a href="https://twitter.com/elx_pro" rel="noopener noreferrer"&gt;https://twitter.com/elx_pro&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;ElxproBr - &lt;a href="https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro - &lt;a href="https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>liveview</category>
      <category>elixir</category>
      <category>programming</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Read this Article if you want to learn Elixir with GenServer.</title>
      <dc:creator>Elxpro</dc:creator>
      <pubDate>Tue, 02 Aug 2022 17:37:00 +0000</pubDate>
      <link>https://dev.to/theguuholi/read-this-article-if-you-want-to-learn-genserver-1l24</link>
      <guid>https://dev.to/theguuholi/read-this-article-if-you-want-to-learn-genserver-1l24</guid>
      <description>&lt;h1&gt;
  
  
  Greeting
&lt;/h1&gt;

&lt;p&gt;Hello #devElixir!!! Welcome to #FullStackElxpro&lt;/p&gt;

&lt;p&gt;Here we discuss strategies and tips for your Elixir learning journey, from scratch to a hero Elixir developer.&lt;/p&gt;

&lt;p&gt;I am Gustavo, and today's theme is &lt;strong&gt;GenServer&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ps: You can follow the Article with &lt;strong&gt;a &lt;a href="https://youtu.be/uBBPdfvHLZ0" rel="noopener noreferrer"&gt;VIDEO&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you want to learn Elixir in three months? &lt;a href="https://elxpro.com/sell" rel="noopener noreferrer"&gt;https://elxpro.com/sell&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Want to learn more about Elixir on a Telegram channel?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://elxpro.com/subscribe-elxcrew" rel="noopener noreferrer"&gt;https://elxpro.com/subscribe-elxcrew&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  What is a GenServer?
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://hexdocs.pm/elixir/GenServer.html" rel="noopener noreferrer"&gt;GenServer&lt;/a&gt; is a process like any other Elixir process (&lt;em&gt;Tasks, Spawn, Agents&lt;/em&gt;). It can be used to manage state and execute code asynchronously and includes some handy functionality around tracing and error reporting.&lt;/p&gt;

&lt;p&gt;And for me, as a Liveview evangelist is one of the best ways to learn what you have behind the LiveView Apps, providing a better way to organize, think and isolate pieces of code.&lt;/p&gt;

&lt;p&gt;Before we move forward, I think it is essential to read &lt;a href="https://hexdocs.pm/elixir/GenServer.html#module-when-not-to-use-a-genserver" rel="noopener noreferrer"&gt;When Not Use GenServer&lt;/a&gt;. Because one of the biggest mistakes you can make is using GenServer for Everything, which is unnecessary.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is the difference between GenServer, Tasks, and Agents?
&lt;/h1&gt;

&lt;p&gt;Before you keep reading this article, I highly recommend watching the video about Elixir's processes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/em4QECkQx4s" rel="noopener noreferrer"&gt;https://youtu.be/em4QECkQx4s&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GenServer&lt;/strong&gt; : The GenServer behaviour abstracts the common client-server interaction. Developers are only required to implement the callbacks and functionality they are interested in.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://hexdocs.pm/elixir/Task.html" rel="noopener noreferrer"&gt;&lt;strong&gt;Tasks&lt;/strong&gt;&lt;/a&gt;: Tasks are processes meant to execute one particular action throughout their lifetime, often with little or no communication with other processes. The most common use case for tasks is to convert sequential code into concurrent code by computing a value asynchronously.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://hexdocs.pm/elixir/Agent.html" rel="noopener noreferrer"&gt;&lt;strong&gt;Agents&lt;/strong&gt;&lt;/a&gt;: Agents are a simple abstraction around state.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why is GenServer Important?
&lt;/h1&gt;

&lt;p&gt;I have seen developers who start their career as Elixir developers but don't understand the basic concepts of how Elixir works.&lt;/p&gt;

&lt;p&gt;Elixir is not a normal programming language. I mean that because Frontend Developers usually come to Elixir from React, Angular, and Vue, all of which use JavaScript and oriented programming languages. And daily, they face difficulties understanding what is behind LiveView, how to split components, and thinking in &lt;strong&gt;single responsibilities principles.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;They don't understand it because of two simple things. Behind Elixir, there are processes, and LiveView is very similar to a GenServer.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is the best moment to use GenServer?
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Handle Sync and Async Calls:&lt;/strong&gt; As we discussed, the main purpose of a GenServer is not to Code Organization but as a way to keep the state and manipulate it easily. Example &lt;strong&gt;Shopping Cart&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;System Messages:&lt;/strong&gt; You can see some examples when you create ways to use &lt;em&gt;spawn, send and receive&lt;/em&gt;_ &lt;strong&gt;. As&lt;/strong&gt; _ I mentioned, I recorded a video explaining how the process works, and one of the examples is a simulation of how to access the database and execute a query.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monitoring Events:&lt;/strong&gt; Imagine that you have a company monitoring company stocks every second. The stocks' assets rise and fall every second.&lt;/p&gt;

&lt;h1&gt;
  
  
  Where to start?
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Callbacks
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;init/1 (required) - invoked when the server is started and sets the initial state&lt;/li&gt;
&lt;li&gt;handle_cast/2 - invoked when GenServer.cast/2 is called to handle messages asynchronously&lt;/li&gt;
&lt;li&gt;handle_call/3 - invoked when GenServer.call/3 is called to handle messages synchronously

&lt;ul&gt;
&lt;li&gt;call/3 will block until a reply is received (unless the call times out or nodes are disconnected)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;handle_info/2 - invoked to handle all other messages (i.e., outside of those triggered by GenServer.call/3 and GenServer.cast/2, and &lt;a href="https://erlang.org/doc/design_principles/spec_proc.html#msg" rel="noopener noreferrer"&gt;"system" messages&lt;/a&gt;)

&lt;ul&gt;
&lt;li&gt;g., messages/events handled internally within the GenServer&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;terminate/2 - invoked when the GenServer is about to exit&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Init
&lt;/h2&gt;

&lt;p&gt;Before we talk about Init, we must talk about &lt;strong&gt;start_link &lt;/strong&gt;together.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;start_link&lt;/strong&gt;: when it is called, the new process created will call &lt;strong&gt;init&lt;/strong&gt;, and &lt;strong&gt;init&lt;/strong&gt; will start the state, which is an empty map, and the parent of &lt;strong&gt;ShoppingCart &lt;/strong&gt;is the IEX terminal.&lt;/p&gt;

&lt;p&gt;Take a look at the code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defmodule ShoppingCart do
  use GenServer

  def start_link([name, state]) do
    IO.inspect(state, label: "start_link")
    GenServer.start_link(__MODULE__, state, name: name)
  end

  def init(state) do
    IO.inspect state, label: "init"
    {:ok, state}
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;iex(1)&amp;gt; ShoppingCart.start_link [:elxpro_cart, []]
start_link: []
init: []
{:ok, #PID&amp;lt;0.161.0&amp;gt;}
iex(2)&amp;gt; Process.whereis :elxpro_cart
#PID&amp;lt;0.161.0&amp;gt;
iex(3)&amp;gt; self   
#PID&amp;lt;0.159.0&amp;gt;
iex(4)&amp;gt; :observer.start

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h2&gt;
  
  
  HandleCast
&lt;/h2&gt;




&lt;p&gt;Invoked when GenServer.cast/2 is called to handle messages asynchronously&lt;/p&gt;

&lt;p&gt;In our example, imagine that you need to add a new product to your cart but don't care how many products you have there. You only want to add it is a perfect example of how to call &lt;strong&gt;handle_cast.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  def handle_cast({:add, product}, state) do
    state = state ++ [product]
    {:noreply, state}
  end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;iex(1)&amp;gt; ShoppingCart.start_link [:cart_1, []]
start_link: []
init: []
{:ok, #PID&amp;lt;0.151.0&amp;gt;}

iex(2)&amp;gt; GenServer.cast :cart_1, {:add, %{name: "Pumpkin", price: 10}}

iex(3)&amp;gt; "0.151.0" |&amp;gt; pid |&amp;gt; :sys.get_state
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  HandleCall
&lt;/h2&gt;




&lt;p&gt;The &lt;strong&gt;handle_call&lt;/strong&gt;/3 callback is invoked when GenServer.call/3 is called to handle synchronous messages. The main params are &lt;strong&gt;function_pattern_mathing&lt;/strong&gt;, &lt;strong&gt;_from,&lt;/strong&gt; &lt;strong&gt;state&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;function_pattern_mathing: &lt;/strong&gt;a Way to identify how to call the function&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;_from: &lt;/strong&gt;most of the time is the process_id that calls the function, and most of the time is useful &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;state: &lt;/strong&gt;actual component state.&lt;/p&gt;

&lt;p&gt;And the most common return is*&lt;em&gt; {:reply, response, state}&lt;/em&gt;*&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reply: &lt;/strong&gt;indicates that those who called the process will receive a message result.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Response:&lt;/strong&gt; message to return for who called the process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;State: &lt;/strong&gt;update process state.&lt;/p&gt;

&lt;p&gt;Check the example, Bellow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  def handle_call(:apply_discount, _from, state) do
    state = Enum.map(state, &amp;amp;%{&amp;amp;1 | price: &amp;amp;1.price - 1})
    products = Enum.map(state, &amp;amp;(&amp;amp;1.name &amp;lt;&amp;gt; " "))
    {:reply, "Discount applied to: #{products}", state}
  end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;iex(1)&amp;gt; ShoppingCart.start_link [:cart_1, []]
start_link: []
init: []
{:ok, #PID&amp;lt;0.161.0&amp;gt;}


iex(2)&amp;gt;  GenServer.cast :cart_1, {:add, %{name: "Pumpkin", price: 10}}

iex(3)&amp;gt;   GenServer.cast :cart_1, {:add, %{name: "Gatorade", price: 20}}


iex(6)&amp;gt;  GenServer.call :cart_1, :apply_discount            
Result: "Discount applied to: Pumpkin Gatorade "

State: 
iex(7)&amp;gt;   pid = "0.161.0" |&amp;gt; pid |&amp;gt; :sys.get_state
[%{name: "Pumpkin", price: 8}, %{name: "Gatorade", price: 18}]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  HandleInfo
&lt;/h2&gt;

&lt;p&gt;The handle_info/2 callback is invoked to handle all other messages (i.e., outside of those triggered by GenServer.call/3 and GenServer.cast/2)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  def handle_info(:increase_price, state) do
    state = Enum.map(state, &amp;amp;%{&amp;amp;1 | price: &amp;amp;1.price + 1})
    {:noreply, state}
  end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;iex(1)&amp;gt;  ShoppingCart.start_link [:cart_1, []]
iex(2)&amp;gt; GenServer.cast :cart_1, {:add, %{name: "Pumpkin", price: 10}}
iex(3)&amp;gt; pid = pid("0.161.0")                

iex(4)&amp;gt; :sys.get_state(pid)
[%{name: "Pumpkin", price: 10}]

iex(5)&amp;gt; send pid, :increase_price
iex(6)&amp;gt; :sys.get_state(pid)      
[%{name: "Pumpkin", price: 11}]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defmodule ShoppingCart do
  use GenServer

  def start_link([name, state]) do
    IO.inspect(state, label: "start_link")
    GenServer.start_link(__MODULE__, state, name: name)
  end

  def init(state) do
    IO.inspect(state, label: "init")
    {:ok, state}
  end

  def handle_cast({:add, product}, state) do
    state = state ++ [product]
    {:noreply, state}
  end

  def handle_call(:apply_discount, _from, state) do
    state = Enum.map(state, &amp;amp;%{&amp;amp;1 | price: &amp;amp;1.price - 1})
    products = Enum.map(state, &amp;amp;(&amp;amp;1.name &amp;lt;&amp;gt; " "))
    {:reply, "Discount applied to: #{products}", state}
  end

  def handle_info(:increase_price, state) do
    state = Enum.map(state, &amp;amp;%{&amp;amp;1 | price: &amp;amp;1.price + 1})
    {:noreply, state}
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  THE END.
&lt;/h1&gt;

&lt;p&gt;The main goal of this Article is to help you understand how easy it is GenServer and after couple examples, you can possibly create simpler LiveView Pages and Elixir Codes&lt;/p&gt;

&lt;p&gt;Social networks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gustavo Oliveira - &lt;a href="https://www.linkedin.com/in/gustavo-oliveira-642b23aa/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/gustavo-oliveira-642b23aa/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro Linkedin - &lt;a href="https://www.linkedin.com/company/36977430" rel="noopener noreferrer"&gt;https://www.linkedin.com/company/36977430&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Twitter - &lt;a href="https://twitter.com/elx_pro" rel="noopener noreferrer"&gt;https://twitter.com/elx_pro&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;ElxproBr - &lt;a href="https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro - &lt;a href="https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>elixir</category>
      <category>liveview</category>
      <category>phoenix</category>
      <category>programming</category>
    </item>
    <item>
      <title>Understand why LibCluster is essential for your Phoenix Liveview applications</title>
      <dc:creator>Elxpro</dc:creator>
      <pubDate>Tue, 12 Jul 2022 17:35:42 +0000</pubDate>
      <link>https://dev.to/theguuholi/understand-why-libcluster-is-essential-for-your-phoenix-liveview-applications-4c5a</link>
      <guid>https://dev.to/theguuholi/understand-why-libcluster-is-essential-for-your-phoenix-liveview-applications-4c5a</guid>
      <description>&lt;h1&gt;
  
  
  Greeting
&lt;/h1&gt;

&lt;p&gt;Hello #devElixir!!! Welcome to #FullStackElxpro&lt;/p&gt;

&lt;p&gt;Here we discuss strategies and tips for your Elixir learning journey. This is from scratch until your first wave as an elixir developer&lt;/p&gt;

&lt;p&gt;I am Gustavo and today's theme is: &lt;strong&gt;Understand why LibCluster is essential for your Phoenix Liveview applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you want to learn Elixir in three months? &lt;a href="https://elxpro.com/sell" rel="noopener noreferrer"&gt;https://elxpro.com/sell&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;_ps: You can follow the article with &lt;strong&gt;VIDEO&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Want to learn more about elixir on a Telegram channel?&lt;/em&gt;&lt;br&gt;
&lt;a href="https://elxpro.com/subscribe-elxcrew" rel="noopener noreferrer"&gt;https://elxpro.com/subscribe-elxcrew&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Which is?
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;LibCluster&lt;/strong&gt; is a library that proves a simple way of connecting between &lt;strong&gt;ERLANG NODES&lt;/strong&gt; that facilitates cluster communication.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why is &lt;strong&gt;LibCluster&lt;/strong&gt; important?
&lt;/h1&gt;

&lt;p&gt;It becomes important from the moment you have distributed systems and you create communication in a simple way between them, where there is a huge difficulty in creating &lt;em&gt;listeners&lt;/em&gt; when a need is running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you read the &lt;a href="https://www.youtube.com/watch?v=Yo5w6E8QxeU" rel="noopener noreferrer"&gt;article/video&lt;/a&gt; about &lt;em&gt;Nodes&lt;/em&gt; you probably know how to connect two applications in Elixir in a simple way, however, how do you get this environment in production? how are you going to detect these nodes in a Kubernetes cluster?, like this communication between different IPs in a simple way? create code for it?&lt;/p&gt;

&lt;p&gt;The best way to create it is through LibCluster (the article about nodes teaches you what's under the hood)&lt;/p&gt;

&lt;h1&gt;
  
  
  How did you find this out?
&lt;/h1&gt;

&lt;p&gt;One of the first libraries I learned about has more than 4 years of journey as an Elixir developer, there was always talk about the benefits of Elixir, it was the agent that had the advantage of distributed systems that were little or not used. But in a project using &lt;strong&gt;LiveView&lt;/strong&gt; the &lt;strong&gt;LibCluster&lt;/strong&gt; becomes more than mandatory and it was the case of a project that I can work on.&lt;/p&gt;

&lt;h1&gt;
  
  
  What are the advantages of using &lt;strong&gt;LibCluster&lt;/strong&gt;?
&lt;/h1&gt;

&lt;p&gt;The main advantage is to create connections between applications quickly, without having to connect nodes, generators, and OTP. LibCluster will abstract all these rules into a simple configuration.&lt;/p&gt;

&lt;h1&gt;
  
  
  When is the best time to implement &lt;strong&gt;LibCluster&lt;/strong&gt;?
&lt;/h1&gt;

&lt;p&gt;At the beginning of my career, I noticed essential things like implementation in Elixir, and I believe that today LibCluster is one of them. &lt;strong&gt;especially if you use live preview&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can start implementing LibCluster in Dev using the strategy of &lt;a href="https://hexdocs.pm/libcluster/Cluster.Strategy.Gossip.html" rel="noopener noreferrer"&gt;&lt;em&gt;Gossip&lt;/em&gt;&lt;/a&gt; as it is one of the simplest and easiest to understand LibCluster, and when for production will depend on whether you are going to use Kubernetes, ECS, or any other environment. I work with clusters in Kubernetes and implement DNS.&lt;/p&gt;

&lt;h1&gt;
  
  
  THE END.
&lt;/h1&gt;

&lt;p&gt;I hope the article helped you understand the need and urgency of how to use LibCluster in your applications. :D&lt;/p&gt;

&lt;p&gt;Social networks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gustavo Oliveira - &lt;a href="https://www.linkedin.com/in/gustavo-oliveira-642b23aa/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/gustavo-oliveira-642b23aa/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro Linkedin - &lt;a href="https://www.linkedin.com/company/36977430" rel="noopener noreferrer"&gt;https://www.linkedin.com/company/36977430&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Twitter - &lt;a href="https://twitter.com/elx_pro" rel="noopener noreferrer"&gt;https://twitter.com/elx_pro&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;ElxproBr - &lt;a href="https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro - &lt;a href="https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>liveview</category>
      <category>phoenix</category>
      <category>elixir</category>
      <category>programming</category>
    </item>
    <item>
      <title>The worst way to handle sessions using Phoenix LiveView.</title>
      <dc:creator>Elxpro</dc:creator>
      <pubDate>Tue, 12 Jul 2022 17:23:27 +0000</pubDate>
      <link>https://dev.to/theguuholi/the-worst-way-to-handle-sessions-using-phoenix-liveview-4kld</link>
      <guid>https://dev.to/theguuholi/the-worst-way-to-handle-sessions-using-phoenix-liveview-4kld</guid>
      <description>&lt;h1&gt;
  
  
  Greeting
&lt;/h1&gt;

&lt;p&gt;Hello #devElixir!!! Welcome to #FullStackElxpro&lt;/p&gt;

&lt;p&gt;Here we discuss strategies and tips for your Elixir learning journey. This is from scratch until your first wave as an elixir developer&lt;/p&gt;

&lt;p&gt;I am Gustavo and today's theme is: &lt;strong&gt;The worst way to handle sessions using Phoenix LiveView.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;_ps: You can follow the article with &lt;strong&gt;&lt;a href="https://youtu.be/0_XNM-JvcT8" rel="noopener noreferrer"&gt;VIDEO&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you want to learn Elixir in three months? &lt;a href="https://elxpro.com/sell" rel="noopener noreferrer"&gt;https://elxpro.com/sell&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Want to learn more about elixir on a Telegram channel?&lt;/em&gt;&lt;br&gt;
&lt;a href="https://elxpro.com/subscribe-elxcrew" rel="noopener noreferrer"&gt;https://elxpro.com/subscribe-elxcrew&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Which is?
&lt;/h1&gt;

&lt;p&gt;The session is something temporary in an application. It is nothing more and nothing less than that.&lt;/p&gt;

&lt;p&gt;However, in Elixir, Phoenix, and Liveview (mainly the web part) there are several ways to work with the session.&lt;/p&gt;

&lt;p&gt;Can use:&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;a href="https://hexdocs.pm/phoenix/plug.html" rel="noopener noreferrer"&gt;Plugs&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Which is a connection middleware and through this middleware persists data and reads data in a session. And there are several plugs to deal with this middle of this one, but this is not the case in this article&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;a href="https://hexdocs.pm/phoenix/Phoenix.Token.html" rel="noopener noreferrer"&gt;Phoenix Token&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;And a way to use and save data that expires in a simple way&lt;/p&gt;
&lt;h2&gt;
  
  
  Live view
&lt;/h2&gt;

&lt;p&gt;There are several ways like session_storage, local_storage (as long as you use hooks), and live_session. And you can check out all kinds of approaches.&lt;/p&gt;

&lt;p&gt;What is your live_session and why use it, as several advantages and approaches are straightforward that will in this article make a difference in the maintenance and readability of the application.&lt;/p&gt;
&lt;h1&gt;
  
  
  What is the difference between &lt;strong&gt;sessions&lt;/strong&gt; and &lt;strong&gt;live_session&lt;/strong&gt;?
&lt;/h1&gt;

&lt;p&gt;The main difference is that the main focus of the session is on the connection, the persistent data traffic on the connection.&lt;/p&gt;

&lt;p&gt;Now in the live_session you can get the data from the &lt;em&gt;session&lt;/em&gt;, include it in the &lt;strong&gt;socket&lt;/strong&gt;, and also program generic events on your page, which is a lot not to replicate code, in short, it's a middleware with superpowers.&lt;/p&gt;
&lt;h1&gt;
  
  
  How did you find this out?
&lt;/h1&gt;

&lt;p&gt;The way I found out, was by reading the phoenix 1.5 to 1.6 update. And when the &lt;strong&gt;_session&lt;/strong&gt; appeared, I thought there was no need for live. But I had pagination in an app that was working on a shared header using a live view within a live view.&lt;/p&gt;

&lt;p&gt;If you understand processes, there was one process monitoring another an absurd complexity to create communication, it took a long time to understand how **OTP, Elixir, Processes under the hood and I even understand it all, and one solution (solution) was so verbose and complicated to handle.&lt;/p&gt;

&lt;p&gt;At this event I had already worked with &lt;strong&gt;live_session&lt;/strong&gt; on other projects (outside the Company), and I saw the power and amount of benefits that live_session brings to the new version of &lt;strong&gt;Phoenix Liveview&lt;/strong&gt; through a conversation about code decisions I presented the solution and everyone liked it and the implementation was very simple.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ps: (I won't show a solution developed in this article, however, in the end, you will be able to create solutions better than I implemented)&lt;/em&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Why is &lt;strong&gt;live_session&lt;/strong&gt; important?
&lt;/h1&gt;

&lt;p&gt;The great importance and question of superpowers that are easy to use. One of the game changers from version 1.5 to 1.6 was &lt;em&gt;live_session&lt;/em&gt; because you don't need to write a lot of code, with just a few lines you'll be able to interact with the socket and include implementations and events, and especially create user rules.&lt;/p&gt;
&lt;h1&gt;
  
  
  What is the biggest benefit of &lt;strong&gt;live_session&lt;/strong&gt;?
&lt;/h1&gt;

&lt;p&gt;The biggest benefit is the issue of handling a socket as a session.&lt;/p&gt;
&lt;h1&gt;
  
  
  Do you remember any stories where this was important to you?
&lt;/h1&gt;

&lt;p&gt;As I mentioned, the main one was your question about information generically designated in the socket, without having to replicate code something that the developers think and are.&lt;/p&gt;

&lt;p&gt;And the other one was when I needed to trigger events from &lt;strong&gt;handle_events, handle_infos, handle_params&lt;/strong&gt; without having to implement it on every page&lt;/p&gt;
&lt;h1&gt;
  
  
  How to create &lt;strong&gt;live_sessions&lt;/strong&gt;?
&lt;/h1&gt;

&lt;p&gt;You can start by understanding why. Some questions may help you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do I need to share this information on more than 1 page?&lt;/li&gt;
&lt;li&gt;Does this event need to be replicated on more than one page?&lt;/li&gt;
&lt;li&gt;Do I need to create any generalized trading rules?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the answer is yes, &lt;strong&gt;&lt;a href="https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.Router.html#live_session/3" rel="noopener noreferrer"&gt;live_session&lt;/a&gt;&lt;/strong&gt; is the best option.&lt;/p&gt;

&lt;p&gt;You can see in the image below that it was necessary to implement just a few lines of code and live_session starts to behave like a &lt;em&gt;middleware&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;Before starting any session what &lt;strong&gt;live_session&lt;/strong&gt; will do is call the permission module, check the scope (which is more than amazing pattern matching), and sign new information into the socket.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defmodule LiveSessions.Permissions do
  import Phoenix.LiveView
  alias FoodOrder.Accounts
  alias FoodOrderWeb.Router.Helpers, such as: Routes
  alias LiveSessions.CreateCart

  def on_mount(:user, _params, %{"user_token" =&amp;gt; user_token}, socket) do
    assign_user(socket, :user, user_token)
  The end

  def on_mount(:admin, _params, %{"user_token" =&amp;gt; user_token}, socket) do
    assign_user(socket, :admin, user_token)
  The end

  defp assign_user(socket, _,nil) do
    error_login(socket, "You must be logged in")
  The end

  defp assign_user(socket, :user, user_token) do
    current_user = Accounts.get_user_by_session_token(user_token)
    cart_id = get_connect_params(socket)["cart_id"]

    socket =
      socket
      |&amp;gt; assign_new(:current_user, fn -&amp;gt; current_user end)
      |&amp;gt; CreateCart.execute(cart_id)

    {:cont, socket}
  The end

  defp assign_user(socket, :admin, user_token) do
    user_token
    |&amp;gt; Accounts.get_user_by_session_token()
    |&amp;gt; return_socket(socket)
  The end

  defp return_socket(%{role: role}, socket) when role != :ADMIN,
    do: error_login(socket, "You do not have permission to access this page")

  defp return_socket(current_user, socket),
    do: {:cont, assign_new(socket, :current_user, fn -&amp;gt; current_user end)}

  defp error_login(socket, message) do
    socket =
      socket
      |&amp;gt; put_flash(:error, message)
      |&amp;gt; redirect(to: Routes.main_path(socket, :index))

    {:stop, socket}
  The end
The end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Wrap up
&lt;/h1&gt;

&lt;p&gt;I hope I helped you in your learning, I always recommend visiting youtube videos, it usually has more resources. A big hug!!&lt;/p&gt;

&lt;p&gt;Social networks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gustavo Oliveira - &lt;a href="https://www.linkedin.com/in/gustavo-oliveira-642b23aa/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/gustavo-oliveira-642b23aa/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro Linkedin - &lt;a href="https://www.linkedin.com/company/36977430" rel="noopener noreferrer"&gt;https://www.linkedin.com/company/36977430&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Twitter - &lt;a href="https://twitter.com/elx_pro" rel="noopener noreferrer"&gt;https://twitter.com/elx_pro&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;ElxproBr - &lt;a href="https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Elxpro - &lt;a href="https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>liveview</category>
      <category>phoenix</category>
      <category>elixir</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Entenda o porque o LibCluster e essencial para suas aplicacoes em Phoenix Liveview</title>
      <dc:creator>Elxpro</dc:creator>
      <pubDate>Mon, 11 Jul 2022 11:13:46 +0000</pubDate>
      <link>https://dev.to/theguuholi/entenda-o-porque-o-libcluster-e-essencial-para-suas-aplicacoes-em-phoenix-liveview-2h4</link>
      <guid>https://dev.to/theguuholi/entenda-o-porque-o-libcluster-e-essencial-para-suas-aplicacoes-em-phoenix-liveview-2h4</guid>
      <description>&lt;h1&gt;
  
  
  Saudacao
&lt;/h1&gt;

&lt;p&gt;Seja muito bem vindo, seja muito bem vinda ao #FullstackElxpro&lt;/p&gt;

&lt;p&gt;Aqui nós discutimos as estratégias e dicas de sua jornada de aprendizado em Elixir. Isso é do zero até a sua primeira vaga como desenvolvedor elixir&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you want to learn Elixir in three months? &lt;a href="https://elxpro.com/sell" rel="noopener noreferrer"&gt;https://elxpro.com/sell&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Eu sou o Gustavo e o tema de hoje é: &lt;strong&gt;A pior maneira de lidar com sessoes com Phoenix Liveview.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;_ps: Voce pode acompanhar o artigo com o &lt;a href="https://youtu.be/GBQ6zw3aXr4" rel="noopener noreferrer"&gt;video&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Quer aprender mais sobre elixir em um canal do Telegram?&lt;/em&gt;&lt;br&gt;
&lt;a href="https://elxpro.com/elxcrew-org-yt-descr" rel="noopener noreferrer"&gt;https://elxpro.com/elxcrew-org-yt-descr&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  O que é?
&lt;/h1&gt;

&lt;p&gt;O &lt;strong&gt;libcluster&lt;/strong&gt; e uma biblioteca que prove uma maneira simples de conexao entre &lt;strong&gt;ERLANG NODES&lt;/strong&gt; que facilita a comunicacao de clusters. &lt;/p&gt;

&lt;h1&gt;
  
  
  Por quê &lt;strong&gt;LibCluster&lt;/strong&gt; é importante?
&lt;/h1&gt;

&lt;p&gt;Passa a ser importante a partir do momento em que voce tem sistemas distribuidos e voce precisa de criar comunicacao de maneira simples entre eles, onde existe uma dificuldade enorme de criar &lt;em&gt;listeners&lt;/em&gt; quando uma aplicacao esta em execucao. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exemplo:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Se voce leu o &lt;a href="https://www.youtube.com/watch?v=Yo5w6E8QxeU" rel="noopener noreferrer"&gt;artigo/video&lt;/a&gt; sobre &lt;em&gt;Nodes&lt;/em&gt; voce provavelmente sabe como conectar duas aplicacoes em Elixir de maneira simples porem, como voce controla esse ambiente em producao? como voce vai detectar esses nodes em um cluster de kubernetes?, como criar essa comunicacao entre ips diferentes de maneira simples? criar codigos para isso?&lt;/p&gt;

&lt;p&gt;Na verdade a melhor maneira de criar essa conexao e atraves do libcluster (o artigo sobre nodes te ensina o que esta por debaixo dos panos) &lt;/p&gt;

&lt;h1&gt;
  
  
  Como foi que você descobriu isso?
&lt;/h1&gt;

&lt;p&gt;Foi uma das primeiras bibliotecas que aprendi ha mais de 4 anos de jornada como desenvolvedor Elixir, se falava de beneficios do Elixir mas sempre agente comentava que a vantagem de sistemas distribuidos era pouco ou nao utilizada. Mas em um projeto utilizando &lt;strong&gt;liveview&lt;/strong&gt; o &lt;strong&gt;libcluster&lt;/strong&gt; passa a ser mais que obrigatorio e foi o caso de um projeto que eu comecei a atuar. &lt;/p&gt;

&lt;h1&gt;
  
  
  Quais as vantagens de usar &lt;strong&gt;LibCluster&lt;/strong&gt;?
&lt;/h1&gt;

&lt;p&gt;A principal vantagem e criar conexao entre aplicacoes de maneira rapida e simples, sem ter que precisar criar conexao de nodes, genservers e otp. O libcluster vai abstrair todas essas regras para uma simples configuracao.&lt;/p&gt;

&lt;h1&gt;
  
  
  Qual o melhor momento para Implementar o &lt;strong&gt;LibCluster&lt;/strong&gt;?
&lt;/h1&gt;

&lt;p&gt;No comeco da minha carreira eu percebi coisas essenciais como implementacao em aplicacoes Elixir, e acredito que hoje o libcluster e uma delas. &lt;strong&gt;principalmente se voce utilizar liveview&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Voce pode comecar a implementacao do libcluster em Dev utilizando a estrategia de &lt;a href="https://hexdocs.pm/libcluster/Cluster.Strategy.Gossip.html" rel="noopener noreferrer"&gt;&lt;em&gt;Gossip&lt;/em&gt;&lt;/a&gt; por ser uma das mais simples e facil de entender o libcluster, e quando for para producao vai depender se voce vai utilizar Kubernetes, ECS, ou qualquer outro ambiente.  Geralmente eu trabalho com clusters em kubernetes e implemento DNS. &lt;/p&gt;

&lt;h1&gt;
  
  
  FIM.
&lt;/h1&gt;

&lt;p&gt;Eu espero que o artigo tenha te ajudado a entender a necessidade e a urgencia de comecar a utilizar o libcluster em suas aplicacoes. :D &lt;/p&gt;

&lt;p&gt;Redes Sociais: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gustavo Oliveira - &lt;a href="https://www.linkedin.com/in/gustavo-oliveira-642b23aa/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/gustavo-oliveira-642b23aa/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro Linkedin - &lt;a href="https://www.linkedin.com/company/36977430" rel="noopener noreferrer"&gt;https://www.linkedin.com/company/36977430&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Twiter - &lt;a href="https://twitter.com/elx_pro" rel="noopener noreferrer"&gt;https://twitter.com/elx_pro&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;ElxproBr - &lt;a href="https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Elxpro - &lt;a href="https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>elixir</category>
      <category>phoenix</category>
      <category>beam</category>
      <category>liveview</category>
    </item>
    <item>
      <title>A pior maneira de lidar com sessoes com Phoenix Liveview.</title>
      <dc:creator>Elxpro</dc:creator>
      <pubDate>Tue, 05 Jul 2022 21:53:07 +0000</pubDate>
      <link>https://dev.to/theguuholi/a-pior-maneira-de-lidar-com-sessoes-com-phoenix-liveview-55m3</link>
      <guid>https://dev.to/theguuholi/a-pior-maneira-de-lidar-com-sessoes-com-phoenix-liveview-55m3</guid>
      <description>&lt;h1&gt;
  
  
  Saudacao
&lt;/h1&gt;

&lt;p&gt;Seja muito bem vindo, seja muito bem vinda ao #FullstackElxpro&lt;/p&gt;

&lt;p&gt;Aqui nós discutimos as estratégias e dicas de sua jornada de aprendizado em Elixir. Isso é do zero até a sua primeira vaga como desenvolvedor elixir&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you want to learn Elixir in three months? &lt;a href="https://elxpro.com/sell" rel="noopener noreferrer"&gt;https://elxpro.com/sell&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Eu sou o Gustavo e o tema de hoje é: &lt;strong&gt;A pior maneira de lidar com sessoes com Phoenix Liveview.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;_ps: Voce pode acompanhar o artigo com o video&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Quer aprender mais sobre elixir em um canal do Telegram?&lt;/em&gt;&lt;br&gt;
&lt;a href="https://elxpro.com/elxcrew-org-yt-descr" rel="noopener noreferrer"&gt;https://elxpro.com/elxcrew-org-yt-descr&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  O que é?
&lt;/h1&gt;

&lt;p&gt;Sessao basicamente e algo temporareo em uma aplicacao. Nao e nada mais e nada menos que isso. &lt;/p&gt;

&lt;p&gt;Porem em Elixir, Phoenix e Liveview (principalmente a parte web) ha diversas maneiras de trabalhar com sessao.  &lt;/p&gt;

&lt;p&gt;Pode utilizar:&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;a href="https://hexdocs.pm/phoenix/plug.html" rel="noopener noreferrer"&gt;Plugs&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Que e um middleware de conexao e atravez deste middleware persistir dados e ler dados em uma sessao. E ha diversos plugs para lidar com este middle, mas nao e o caso deste artigo&lt;/p&gt;
&lt;h2&gt;
  
  
  [Phoenix Token
&lt;/h2&gt;

&lt;p&gt;](&lt;a href="https://hexdocs.pm/phoenix/Phoenix.Token.html" rel="noopener noreferrer"&gt;https://hexdocs.pm/phoenix/Phoenix.Token.html&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;E uma maneira de utilizar e guardar dados que expiram de maneira simples&lt;/p&gt;
&lt;h2&gt;
  
  
  Liveview
&lt;/h2&gt;

&lt;p&gt;Ha diversas maneiras como: session_storage, local_storage (desde que use hooks), live_session. E tu pode conferir todos os tipos de abordagem.&lt;/p&gt;

&lt;p&gt;O que voce vai ver neste artigo e live_session e o porque utiliza-lo, pois ha diversas vantagens e abordagens que sao extremamente simples que vai fazer toda a diferenca na manutencao e legibilidade da aplicacao.&lt;/p&gt;
&lt;h1&gt;
  
  
  Qual a Diferença entre &lt;strong&gt;sessoes&lt;/strong&gt; e &lt;strong&gt;live_session&lt;/strong&gt;?
&lt;/h1&gt;

&lt;p&gt;A principal diferenca e que a sessao o foco maior e na conexao, trafegar dados persistidos na conexao. &lt;/p&gt;

&lt;p&gt;Agora no live_session voce consegue pegar os dados da &lt;em&gt;sessao&lt;/em&gt;, incluir no &lt;strong&gt;socket&lt;/strong&gt; e tambem consegue programar eventos genericos em sua pagina o que facilita muito para nao replicar codigo, em resumo e um middleware com super poderes. &lt;/p&gt;
&lt;h1&gt;
  
  
  Como foi que você descobriu isso?
&lt;/h1&gt;

&lt;p&gt;A maneira como eu descobri, foi na leitura do upgrade do phoenix 1.5 para o 1.6. E quando apareceu &lt;strong&gt;live_session&lt;/strong&gt; achava que nao tinha necessidade alguma. Porem em uma aplicacao que venho trabalhando tinha um header compartilhado usando uma pagina liveview dentro de outra pagina liveview. &lt;/p&gt;

&lt;p&gt;Se voce entende de processos, tinha um processo monitorando outro uma complexidade absurda para criar comunicao, exigia muito do time entender como &lt;strong&gt;OTP, Elixir, Processos&lt;/strong&gt; funciona por debaixo dos panos e mesmo entendo tudo isso, e uma solucao (workaround) era tao verboso e complicado de manipular. &lt;/p&gt;

&lt;p&gt;Neste evento eu ja tinha trabalhado com &lt;strong&gt;live_session&lt;/strong&gt; em outros projetos (fora da Empresa), e vi o quao poderoso e a quantidade de beneficios que o live_session traz para a nova versao do &lt;strong&gt;Phoenix Liveview&lt;/strong&gt; atravez de uma conversa sobre decisoes de codigo eu apresentei a solucao e todos gostaram e a implementacao foi muito simples.  &lt;/p&gt;

&lt;p&gt;&lt;em&gt;ps: (eu nao vou mostrar a solucao desenvolvida neste artigo, porem, no final, voce sera capaz de criar solucoes melhores do que eu implementei)&lt;/em&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Por quê &lt;strong&gt;live_session&lt;/strong&gt; é importante?
&lt;/h1&gt;

&lt;p&gt;A grande importancia e a questao dos superpodeeres que sao faceis de utilizar. Um dos divisores de agua da versao 1.5 para a 1.6 foi o &lt;em&gt;live_session&lt;/em&gt; pois voce nao precisa escrever muito codigo, com poucas linhas voce vai conseguir interagir com o socket e incluir implementacoes e eventos, e principalmente criar regras de falhas. &lt;/p&gt;
&lt;h1&gt;
  
  
  Qual o maior benefício do &lt;strong&gt;live_session&lt;/strong&gt;?
&lt;/h1&gt;

&lt;p&gt;O maior beneficio e a questao de manipular um socket como uma sessao. &lt;/p&gt;
&lt;h1&gt;
  
  
  Você se lembra de alguma história em que isso foi importante pra você?
&lt;/h1&gt;

&lt;p&gt;Como eu mensionei, a principal historia foi a questao de assinar informacoes no socket de maneira generica, sem ter que replicar codigos algo que desenvolvedores acha chato e realmente e. &lt;/p&gt;

&lt;p&gt;E a outra foi quando precisei trigar eventos de &lt;strong&gt;handle_events, handle_infos, handle_params&lt;/strong&gt; sem precisar implementar em todas as paginas&lt;/p&gt;
&lt;h1&gt;
  
  
  Como criar &lt;strong&gt;live_sessions&lt;/strong&gt;?
&lt;/h1&gt;

&lt;p&gt;Voce pode comecar entendendo o motivo. Algumas perguntas pode te ajudar:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Eu preciso de compartilhar essa informacao com mais de 1 pagina?&lt;/li&gt;
&lt;li&gt;Esse evento precisa ser replicado em mais de uma pagina? &lt;/li&gt;
&lt;li&gt;Preciso de criar alguma regra de negocio generalizada? &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Se a resposa for sim, o &lt;strong&gt;&lt;a href="https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.Router.html#live_session/3" rel="noopener noreferrer"&gt;live_session&lt;/a&gt;&lt;/strong&gt; e a melhor opcao. &lt;/p&gt;

&lt;p&gt;Voce pode acomparnhar na imagem abaixo que foi preciso implementar somente algumas linhas de codigos e o livesession comeca a se comportar como um &lt;em&gt;middleware&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;Antes de comecar qualquer sessao o que o &lt;strong&gt;live_session&lt;/strong&gt; vai fazer e chamar o modulo de permissao, verficiando o escopo (o que e um pattern matching mais do que incrivel)  e assinar novas informacoes no socket.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defmodule LiveSessions.Permissions do
  import Phoenix.LiveView
  alias FoodOrder.Accounts
  alias FoodOrderWeb.Router.Helpers, as: Routes
  alias LiveSessions.CreateCart

  def on_mount(:user, _params, %{"user_token" =&amp;gt; user_token}, socket) do
    assign_user(socket, :user, user_token)
  end

  def on_mount(:admin, _params, %{"user_token" =&amp;gt; user_token}, socket) do
    assign_user(socket, :admin, user_token)
  end

  defp assign_user(socket, _, nil) do
    error_login(socket, "You must be logged in")
  end

  defp assign_user(socket, :user, user_token) do
    current_user = Accounts.get_user_by_session_token(user_token)
    cart_id = get_connect_params(socket)["cart_id"]

    socket =
      socket
      |&amp;gt; assign_new(:current_user, fn -&amp;gt; current_user end)
      |&amp;gt; CreateCart.execute(cart_id)

    {:cont, socket}
  end

  defp assign_user(socket, :admin, user_token) do
    user_token
    |&amp;gt; Accounts.get_user_by_session_token()
    |&amp;gt; return_socket(socket)
  end

  defp return_socket(%{role: role}, socket) when role != :ADMIN,
    do: error_login(socket, "You don`t have permissions to access this page")

  defp return_socket(current_user, socket),
    do: {:cont, assign_new(socket, :current_user, fn -&amp;gt; current_user end)}

  defp error_login(socket, message) do
    socket =
      socket
      |&amp;gt; put_flash(:error, message)
      |&amp;gt; redirect(to: Routes.main_path(socket, :index))

    {:halt, socket}
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Finalizacao
&lt;/h1&gt;

&lt;p&gt;Eu espero que eu tenha te ajudado no seu aprendizado, recomendo sempre visitar os videos do youtube, geralmente tem mais recursos. Um grande abraco!! &lt;/p&gt;

&lt;p&gt;Redes Sociais: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/gustavo-oliveira-642b23aa/" rel="noopener noreferrer"&gt;Gustavo Oliveira&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/company/36977430" rel="noopener noreferrer"&gt;Elxpro(linkedin)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/elx_pro" rel="noopener noreferrer"&gt;Twiter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA" rel="noopener noreferrer"&gt;ElxproBr&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ" rel="noopener noreferrer"&gt;Elxpro&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>elixir</category>
      <category>phoenix</category>
      <category>beam</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>Getting Started Using Hooks with Phoenix and Liveview</title>
      <dc:creator>Elxpro</dc:creator>
      <pubDate>Mon, 04 Jul 2022 12:58:05 +0000</pubDate>
      <link>https://dev.to/theguuholi/getting-started-using-hooks-with-phoenix-and-liveview-f18</link>
      <guid>https://dev.to/theguuholi/getting-started-using-hooks-with-phoenix-and-liveview-f18</guid>
      <description>&lt;h1&gt;
  
  
  Greeting
&lt;/h1&gt;

&lt;p&gt;Hello #devElixir!!! Welcome to #FullStackElxpro&lt;/p&gt;

&lt;p&gt;Here we discuss strategies and tips for your Elixir learning journey. This is from scratch until your first wave as an elixir developer&lt;/p&gt;

&lt;p&gt;I am Gustavo and today's theme is: &lt;strong&gt;Getting Started Using Hooks with Phoenix and Liveview&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you want to learn Elixir in three months? &lt;a href="https://elxpro.com/sell" rel="noopener noreferrer"&gt;https://elxpro.com/sell&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;_ps: You can follow the article with &lt;strong&gt;&lt;a href="https://youtu.be/HBPctPUDC3s" rel="noopener noreferrer"&gt;VIDEO&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Want to learn more about elixir on a Telegram channel?&lt;/em&gt;&lt;br&gt;
&lt;a href="https://elxpro.com/subscribe-elxcrew" rel="noopener noreferrer"&gt;https://elxpro.com/subscribe-elxcrew&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  What are Hooks with Liveview?
&lt;/h1&gt;

&lt;p&gt;The hook is nothing more than a "hook", where you can send events to the server and vice versa.&lt;/p&gt;
&lt;h1&gt;
  
  
  What is the Difference between Hooks and Liveview in everyday life?
&lt;/h1&gt;

&lt;p&gt;The main difference is that hooks are a way to send and receive data from the frontend/backend to the browser using a javascript syntax with Elixir, it looks a lot like a LiveView page or nothing new. But the biggest difference is that on a day-to-day basis Liveview takes care of almost all this work, the Hook is a way where you need to manipulate the DOM for something very specific that using LiveView would be almost impossible. The most common example is to listen to the page and wait that when you reach the end, load new elements, Javascript gives you this very easy resource, the hook will help you send it to your server. Another example would be manipulating a map, accessing geolocation resources, BlueTooth, wifi among others only with the browser, and hooks will help you in these processes. While Liveview will be responsible for everyday work like CRUD, real-time, tables, notifications, backend, and common frontend interaction.&lt;/p&gt;
&lt;h1&gt;
  
  
  Why is understanding Hooks important?
&lt;/h1&gt;

&lt;p&gt;As I mentioned above, some events and access to Browser resources so that it is possible through Javascript and understanding about Hooks gives you the flexibility to work with Liveview and Elixir without losing functionality.&lt;/p&gt;
&lt;h1&gt;
  
  
  What are the advantages of using Hooks?
&lt;/h1&gt;

&lt;p&gt;In my experience, the main advantage is access to computer resources such as Geolocation, Bluetooth, wifi... among others and you can check with the images below.&lt;/p&gt;
&lt;h2&gt;
  
  
  Geolocation
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.w3schools.com/html/html5_geolocation.asp" rel="noopener noreferrer"&gt;https://www.w3schools.com/html/html5_geolocation.asp&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(navigator)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h1&gt;
  
  
  Where to start?
&lt;/h1&gt;

&lt;p&gt;The first step is always to understand when there is a need for the hook, understanding the need and LiveView cannot supply, start with a hook &lt;a href="https://hexdocs.pm/phoenix_live_view/js-interop.html%20#client-%20hooks-via-phx-hook" rel="noopener noreferrer"&gt;see documentation&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Determine the main elements of a Hook
&lt;/h2&gt;

&lt;p&gt;The main elements of a hook are &lt;em&gt;id&lt;/em&gt; and &lt;em&gt;phx-hook="HookName"&lt;/em&gt; as shown in the image below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;input type="text" name="mirror[id]" id="mirror-id" phx-hook="MirrorValues" class="border " /&amp;gt;

&amp;lt;div id="mirror"&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the definition you will receive the first error in your browser as follows:&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Create a folder structure for hooks and Create your hook
&lt;/h2&gt;

&lt;p&gt;In &lt;em&gt;assets/js/app.js&lt;/em&gt; create a possibility to access hooks. The ideal is always separate hooks in dough as they can make a mess.&lt;/p&gt;

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

&lt;p&gt;After defining the hooks file call, and creating a file to always point the hooks as you can see the image, in the &lt;strong&gt;hooks folder&lt;/strong&gt; create hooks. See the image below.&lt;/p&gt;

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

&lt;p&gt;And now create the hook as defined in &lt;strong&gt;input&lt;/strong&gt; as &lt;strong&gt;MirrorValues&lt;/strong&gt; and now and call the Js class,&lt;/p&gt;

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

&lt;p&gt;What was created is simply a function with the name of the Hook, where &lt;strong&gt;mounted&lt;/strong&gt; was executed when our element was added to our screen.&lt;/p&gt;

&lt;p&gt;And what our hook does is nothing less than simply taking the input data and including it in a &lt;strong&gt;div.mirror&lt;/strong&gt; tag&lt;/p&gt;

&lt;h1&gt;
  
  
  Is there any exception where Hooks is not good?
&lt;/h1&gt;

&lt;p&gt;When starting to replace Liveview heavy lifting is not indicated.&lt;/p&gt;

&lt;h1&gt;
  
  
  Wrap up:
&lt;/h1&gt;

&lt;p&gt;I hope you enjoyed this article and it helped you to know when/not to use hooks :D&lt;/p&gt;

&lt;p&gt;Social networks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/gustavo-oliveira-642b23aa/" rel="noopener noreferrer"&gt;Gustavo Oliveira&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/company/36977430" rel="noopener noreferrer"&gt;Elxpro(linkedin)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/elx_pro" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ" rel="noopener noreferrer"&gt;Elxpro&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>tailwindcss</category>
      <category>elixir</category>
      <category>beam</category>
      <category>phoenix</category>
    </item>
    <item>
      <title>The minimum of Tailwind you need to know to work with Elixir/Phoenix</title>
      <dc:creator>Elxpro</dc:creator>
      <pubDate>Sat, 02 Jul 2022 11:00:12 +0000</pubDate>
      <link>https://dev.to/theguuholi/the-minimum-of-tailwind-you-need-to-know-to-work-with-elixirphoenix-40lk</link>
      <guid>https://dev.to/theguuholi/the-minimum-of-tailwind-you-need-to-know-to-work-with-elixirphoenix-40lk</guid>
      <description>&lt;h1&gt;
  
  
  Greeting
&lt;/h1&gt;

&lt;p&gt;Hello #devElixir!!! Welcome to #FullStackElxpro&lt;/p&gt;

&lt;p&gt;Here we discuss strategies and tips for your Elixir learning journey. This is from scratch until your first wave as an elixir developer&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you want to learn Elixir in three months? &lt;a href="https://elxpro.com/sell" rel="noopener noreferrer"&gt;https://elxpro.com/sell&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I am Gustavo and today's theme is: &lt;strong&gt;The minimum of Tailwind you need to know to work with Elixir/Phoenix&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;_ps: You can follow the article with &lt;strong&gt;&lt;a href="https://www.youtube.com/watch?v=6ZxtdayOe40" rel="noopener noreferrer"&gt;video&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Want to learn more about elixir on a Telegram channel?&lt;/em&gt;&lt;br&gt;
&lt;a href="https://elxpro.com/subscribe-elxcrew" rel="noopener noreferrer"&gt;https://elxpro.com/subscribe-elxcrew&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  What is Tailwind?
&lt;/h1&gt;

&lt;p&gt;Is a CSS framework that gives you the possibility to create layouts using a ready-made CSS framework. This allows you to optimize the time of creating a UI without having to do everything manually.&lt;/p&gt;
&lt;h1&gt;
  
  
  How did I discover &lt;a href="https://tailwindcss.com/" rel="noopener noreferrer"&gt;Tailwind&lt;/a&gt;?
&lt;/h1&gt;

&lt;p&gt;I discovered Tailwind when I needed to deliver my project first to a company using Elixir/Phoenix, I was I didn't want to provide the CSS as it would require a lot of time, &lt;a href="https://getbootstrap.com/" rel="noopener noreferrer"&gt;bootstrap&lt;/a&gt; was a great option but when I was looking for free dashboard themes on the internet it was tough to find a theme, look for other options. I even considered the possibility of using &lt;a href="https://materializecs.com/" rel="noopener noreferrer"&gt;MaterializeCss&lt;/a&gt; too. Still, I need a layout and paid, we discovered Tailwind and found the control panel layouts easy to use, and simple to install as I needed to import tailwind and copy and paste HTML from a website &lt;a href="https://tailwindcomponents.com/search?query=dashboard" rel="noopener noreferrer"&gt;TailwindComponents&lt;/a&gt;.&lt;/p&gt;
&lt;h1&gt;
  
  
  When was the first time you put it into production?
&lt;/h1&gt;

&lt;p&gt;That was about 4 years ago, the experience was interesting, because it was easy not to worry about creating layouts, and at the time, tailwind didn't have the number of resources that it does today.&lt;/p&gt;

&lt;p&gt;Today, you can enter tailwind component, and tailwindUI, among other sites, and find incredible content that is easy to adapt to what you need. Coming back to the feature, at that time excellent, mobile-friendly, including for a short period that had a lot of features for your customers to experience and would provide a great experience for my customers in a short time.&lt;/p&gt;

&lt;p&gt;The interesting thing that had doors to have projects was the one that this project took codes but what it was and the project opened the exterior for me because I care about projects, which made it easier for me to go outside Brazil using the famous PETAL stack (I don't like the alpine and people I've been working with also say the same but that's not the focus of this conversation) :D&lt;/p&gt;
&lt;h1&gt;
  
  
  Why is Tailwind important?
&lt;/h1&gt;

&lt;p&gt;I believe it opens doors today in many companies and even for you to simply copy and paste codes and sell websites (not the current discussion either), famous companies and even Edtechs are starting to use tutorials.&lt;/p&gt;
&lt;h1&gt;
  
  
  What are the advantages of using Tailwind?
&lt;/h1&gt;

&lt;p&gt;I always like to bring 3 points and there they go&lt;/p&gt;
&lt;h2&gt;
  
  
  Quick to create Layouts
&lt;/h2&gt;

&lt;p&gt;In Tailwind, you will find several resources that you can simply copy and paste (free of charge) and simply change the cores as needed, which facilitates the WEB development daily.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;a href="https://tailwindcss.com/docs/guides/phoenix" rel="noopener noreferrer"&gt;Simple Installation&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Even with Elixir/Phoenix something that I simply installed that was complicated and easy to follow the steps without much verbosity, and even the website itself has already provided a tutorial on how to follow in your projects.&lt;/p&gt;
&lt;h2&gt;
  
  
  Ease of use
&lt;/h2&gt;

&lt;p&gt;You have very good and didactic documentation. Documentation providing CSS classes and an explanation of how to use and what each CSS class contains.&lt;/p&gt;
&lt;h1&gt;
  
  
  Where to start?
&lt;/h1&gt;

&lt;p&gt;You can start by creating a Phoenix project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ mix phx.new first_tailwind       
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add a dependency to your project on &lt;em&gt;mix.exs&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defp deps do
  [
    {:tailwind, "~&amp;gt; 0.1", runtime: Mix.env() == :dev}
  ]
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Configure tailwind in &lt;em&gt;config.exs&lt;/em&gt;, where it will read, and where it will output the data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config :tailwind, version: "3.1.4", default: [
  args: ~w(
    --config=tailwind.config.js
    --input=css/app.css
    --output=../priv/static/assets/app.css
  ),
  cd: Path.expand("../assets", __DIR__)
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Include the Deploy Script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defp aliases do
  [
    "assets.deploy": ["tailwind default --minify", "esbuild default --minify", "phx.digest"]
  ]
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install Tailwind&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mix tailwind.install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Include the import modules in: &lt;em&gt;./assets/tailwind.config.js&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
  content: [
    './js/**/*.js',
    '../lib/*_web.ex',
    '../lib/*_web/**/*.*ex',
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Include Tailwind's &lt;strong&gt;Core&lt;/strong&gt; components in &lt;em&gt;app.css&lt;/em&gt;:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ps: I usually delete the phoenix.css and remove the import, to use only tailwind, something that's pretty cool to do, and remove all the default phoenix layout and CSS properties so you don't get lost during development&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@tailwind base;
@tailwind components;
@tailwind utilities;
import "../css/app.css" (REMOVER)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Testing the tailwind:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#your index
&amp;lt;h1 class="text-3xl font-bold underline"&amp;gt;
  Hello world!
&amp;lt;/h1&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And initialize your application.&lt;/p&gt;

&lt;h1&gt;
  
  
  How to organize your App with Tailwind?
&lt;/h1&gt;

&lt;p&gt;What is very important to know about Tailwind and make it easy to create your APP using two very advanced features&lt;/p&gt;

&lt;h2&gt;
  
  
  1 Apply
&lt;/h2&gt;

&lt;p&gt;You can apply tailwind to your HTML Tags using Apply and it's very simple, see the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body{
  @apply bg-zinc-900 text-zinc-100;
  --webkit-font-smoothing: antialiased;
}

form.crud {
  @apply bg-zinc-700 flex flex-col m-10 p-20
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above I applied a default color background. And in the cruds I do with Elixir I cried my easy style and I don't have to think about a lot of code for my forms.&lt;/p&gt;

&lt;h2&gt;
  
  
  2 Tailwind Settings
&lt;/h2&gt;

&lt;p&gt;When you need cores, background, and pading fonts with you use &lt;strong&gt;tend&lt;/strong&gt; setting properties and tailwind setting how to set as a remainder and easily to use with ease. See the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// See the Tailwind configuration guide for advanced usage
// https://tailwindcss.com/docs/configuration
module.exports = {
  content: [
    './js/**/*.js',
    '../lib/*_web.ex',
    '../lib/*_web/**/*.*ex'
  ],
  theme: {
    extend: {
      backgroundImage: {},
      fontFamily: {
        sans: 'Roboto, sans-sefif',
      },
      colors: {
        elxpro: {
          primary: "#274395",
          secondary: "#3dbfef",
          white: "#fff"
        },
      },
    },
  },
  plugins: [
    require('@tailwindcss/forms')
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And to use both &lt;strong&gt;border, background and text&lt;/strong&gt; I need to put PropertyType-DefinNameInConfigs-ConfigProperty&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;li class="border rounded border-elxpro-primary p-1 pl-3 pr-3 ml-1 hover:bg-elxpro-secondary text-sm"&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Social networks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gustavo Oliveira - &lt;a href="https://www.linkedin.com/in/gustavo-oliveira-642b23aa/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/gustavo-oliveira-642b23aa/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro -  &lt;a href="https://www.linkedin.com/company/36977430" rel="noopener noreferrer"&gt;https://www.linkedin.com/company/36977430&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Twitter - &lt;a href="https://twitter.com/elx_pro" rel="noopener noreferrer"&gt;https://twitter.com/elx_pro&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Elxpro - &lt;a href="https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ" rel="noopener noreferrer"&gt;https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>phoenix</category>
      <category>elixir</category>
      <category>beam</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
