<?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: Alexandre Bento Freire</title>
    <description>The latest articles on DEV Community by Alexandre Bento Freire (@a-bentofreire).</description>
    <link>https://dev.to/a-bentofreire</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%2F1919708%2Fc28726f5-e98d-4363-9e27-c181fcb72a31.jpg</url>
      <title>DEV Community: Alexandre Bento Freire</title>
      <link>https://dev.to/a-bentofreire</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/a-bentofreire"/>
    <language>en</language>
    <item>
      <title>Why is PHP losing popularity?</title>
      <dc:creator>Alexandre Bento Freire</dc:creator>
      <pubDate>Tue, 21 Jan 2025 21:28:41 +0000</pubDate>
      <link>https://dev.to/a-bentofreire/why-is-php-losing-popularity-26nj</link>
      <guid>https://dev.to/a-bentofreire/why-is-php-losing-popularity-26nj</guid>
      <description>&lt;p&gt;If you compare the user base of PHP with languages like Python or JavaScript on platforms like LinkedIn or Reddit, the difference is striking. PHP's position on the TIOBE Index has dropped from 7th to 13th.&lt;/p&gt;

&lt;p&gt;Is PHP dead? No, but its trajectory is concerning. While languages like Python and JavaScript continue to attract developers, PHP struggles to shake off its limitations and old perceptions.&lt;/p&gt;

&lt;p&gt;For years, PHP was closely associated with WordPress, which many developers dismissed as "not real programming." Those days are largely over. PHP has evolved with new versions, and frameworks like Laravel and Symfony have made the language more elegant and powerful. Yet, developers continue to migrate elsewhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PHP’s core design still suffers from early decisions made to solve simple backend tasks. Unlike JavaScript, which learned from its past and grew substantially, PHP retains significant inconsistencies, acting as a drag on its growth. &lt;/p&gt;

&lt;p&gt;Examples:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PHP's function names and argument orders are notoriously inconsistent.
&lt;/li&gt;
&lt;li&gt;Arrays default to hash keys, introducing inconsistencies in functions like &lt;code&gt;array_merge&lt;/code&gt;. Workarounds like &lt;code&gt;SplFixedArray&lt;/code&gt; exist, but shouldn’t be necessary.
&lt;/li&gt;
&lt;li&gt;Even something as simple as using &lt;code&gt;preg_replace&lt;/code&gt; with a regex often fails in PHP, while the same works flawlessly in Python.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These issues are compounded by PHP’s reliance on frameworks to mask its flaws, whereas Python and JavaScript focus on core language improvements.&lt;/p&gt;

&lt;p&gt;Even Facebook, now Meta, created Hack to address PHP’s shortcomings. However, it never gained mainstream traction.&lt;/p&gt;

&lt;p&gt;I’ve worked with PHP since its early days and still maintain Laravel projects today. However, many of us stay with PHP out of necessity rather than choice—it’s often too costly to migrate existing codebases.&lt;/p&gt;

&lt;p&gt;If PHP wants to remain relevant, it must listen to its users, assess its shortcomings, and evolve. Otherwise, it risks becoming another COBOL: alive but primarily for maintaining legacy systems.&lt;/p&gt;

&lt;p&gt;What are your thoughts on PHP’s future?&lt;/p&gt;

</description>
      <category>php</category>
      <category>programming</category>
    </item>
    <item>
      <title>Linux Mint 22.1</title>
      <dc:creator>Alexandre Bento Freire</dc:creator>
      <pubDate>Fri, 17 Jan 2025 21:20:03 +0000</pubDate>
      <link>https://dev.to/a-bentofreire/linux-mint-221-3a8h</link>
      <guid>https://dev.to/a-bentofreire/linux-mint-221-3a8h</guid>
      <description>&lt;p&gt;The Linux Mint team has recently released version 22.1, initially as an ISO and now also available via the Update Manager.  &lt;/p&gt;

&lt;p&gt;I'm a die-hard fan of Linux Mint Cinnamon and have no plans to switch to another distro or OS.&lt;/p&gt;

&lt;p&gt;While many changes in this release are under the hood, the team has made significant progress toward fully supporting Wayland. This version also transitioned to Aptkit and Captain, replacing outdated packages.  &lt;/p&gt;

&lt;p&gt;Visually, you’ll notice rounder dialogs and a new Night Light applet to reduce screen temperature and ease eyestrain. Another highlight is the addition of shortcuts to Nemo actions, a feature I’ve been anticipating for years, as I frequently use these actions to transform images and documents.  &lt;/p&gt;

&lt;p&gt;Finally, Bulky now supports removing accents from filenames. While I don’t use Bulky, I rely on my own bulk file renaming tool, RenameToIX, which will also include this feature in the near future.  &lt;/p&gt;

&lt;p&gt;What do you think of the latest Linux Mint update?&lt;/p&gt;

</description>
      <category>linux</category>
      <category>linuxmint</category>
    </item>
    <item>
      <title>What does it mean to be sentient, conscious, or self-aware?</title>
      <dc:creator>Alexandre Bento Freire</dc:creator>
      <pubDate>Mon, 13 Jan 2025 17:11:05 +0000</pubDate>
      <link>https://dev.to/a-bentofreire/what-does-it-mean-to-be-sentient-conscious-or-self-aware-5fle</link>
      <guid>https://dev.to/a-bentofreire/what-does-it-mean-to-be-sentient-conscious-or-self-aware-5fle</guid>
      <description>&lt;p&gt;In the "Terminator" franchise, Skynet becomes self-aware at 2:14 a.m., EDT, on August 29, 1997. This has been a recurring theme in pop culture, where these three distinct concepts are often used interchangeably. With the rise of generative AI and the hype surrounding AGI (Artificial General Intelligence), these ideas have become central in discussions about artificial intelligence.&lt;/p&gt;

&lt;p&gt;Sentience refers to the capacity to perceive or feel sensations, such as pain or pleasure. Being sentient does not necessarily mean being conscious of these sensations; it simply implies the ability to experience them. Consciousness, on the other hand, is the state of being aware of and able to think about one’s existence, surroundings, and mental states. Humans and some advanced animals share this capability. A step further is self-awareness, where an entity not only recognizes its existence but also identifies itself as distinct from others—like recognizing oneself in a mirror.&lt;/p&gt;

&lt;p&gt;Many philosophers and scientists have shaped our understanding of these concepts. René Descartes, John Locke, and the Portuguese neuroscientist Antonio Damasio have made significant contributions to this field. Damasio, in particular, has advanced the neuroscientific exploration of how consciousness arises from the interaction between the brain and body.&lt;/p&gt;

&lt;p&gt;The question of whether AGI can become sentient remains a topic of intense debate. While current AI systems simulate aspects of cognition, whether they can genuinely feel, be aware, or recognize themselves as distinct entities is a profound and unresolved challenge.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Do you know what RISC is, what about CISC, and why does it matter?</title>
      <dc:creator>Alexandre Bento Freire</dc:creator>
      <pubDate>Sun, 05 Jan 2025 12:35:45 +0000</pubDate>
      <link>https://dev.to/a-bentofreire/do-you-know-what-risc-is-what-about-cisc-and-why-does-it-matter-4de7</link>
      <guid>https://dev.to/a-bentofreire/do-you-know-what-risc-is-what-about-cisc-and-why-does-it-matter-4de7</guid>
      <description>&lt;h3&gt;
  
  
  Do you know what RISC is, what about CISC, and why does it matter?
&lt;/h3&gt;

&lt;p&gt;The battle between &lt;strong&gt;RISC&lt;/strong&gt; (Reduced Instruction Set Computing) and &lt;strong&gt;CISC&lt;/strong&gt; (Complex Instruction Set Computing) has shaped the history of computing, yet many may not fully grasp their significance in modern technology. Let’s look the evolution of these architectures, their differences, and why this distinction still matters.&lt;/p&gt;

&lt;p&gt;The origins of &lt;strong&gt;RISC&lt;/strong&gt; date back to the early 1980s, yet for decades, &lt;strong&gt;CISC&lt;/strong&gt; processors dominated the market. &lt;strong&gt;CISC&lt;/strong&gt; processors, such as those used in the first &lt;strong&gt;IBM PCs&lt;/strong&gt;, were designed with a broad set of instructions, making them capable of performing complex tasks in fewer lines of code. However, as &lt;strong&gt;computing power&lt;/strong&gt; increased, the inefficiencies of &lt;strong&gt;CISC&lt;/strong&gt; processors became apparent.&lt;/p&gt;

&lt;p&gt;In contrast, &lt;strong&gt;RISC&lt;/strong&gt; processors, designed with a smaller set of simple instructions, allowed for &lt;strong&gt;faster execution&lt;/strong&gt; and &lt;strong&gt;lower power consumption&lt;/strong&gt;. Because their instruction sets are smaller, the internal circuitry of &lt;strong&gt;RISC CPUs&lt;/strong&gt; is simpler, meaning instructions can be executed more quickly and efficiently.&lt;/p&gt;

&lt;p&gt;The story begins in the &lt;strong&gt;1960s&lt;/strong&gt;, when computers were slower and memory was limited. At that time, it made sense for CPUs to have complex instructions to reduce the number of lines of code, a necessity for efficient programming with limited resources. However, as &lt;strong&gt;computing power&lt;/strong&gt; and &lt;strong&gt;memory capacity&lt;/strong&gt; increased in the following decades, the need for these complex instructions began to diminish.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;1974&lt;/strong&gt;, &lt;strong&gt;Intel&lt;/strong&gt; introduced the &lt;strong&gt;Intel 8080&lt;/strong&gt; processor, which later became the foundation for the &lt;strong&gt;Intel 8088&lt;/strong&gt; used in the &lt;strong&gt;IBM PC&lt;/strong&gt;. This marked the beginning of the &lt;strong&gt;consumer desktop PC revolution&lt;/strong&gt;. At the same time, the &lt;strong&gt;CISC architecture&lt;/strong&gt; continued to dominate, with its emphasis on rich instruction sets, which helped simplify programming.&lt;/p&gt;

&lt;p&gt;In the early &lt;strong&gt;1980s&lt;/strong&gt;, &lt;strong&gt;UC Berkeley&lt;/strong&gt;, funded by &lt;strong&gt;DARPA&lt;/strong&gt; (the agency that also funded the development of the &lt;strong&gt;Internet&lt;/strong&gt;), developed the first &lt;strong&gt;RISC processor&lt;/strong&gt;, a design that was simpler, faster, and more efficient than anything before it. The &lt;strong&gt;RISC&lt;/strong&gt; approach gained traction in academic and research circles, but its adoption in consumer computing was slower due to the vast amount of existing code written for &lt;strong&gt;CISC processors&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;By the 1990s, as computers became faster and memory became more abundant, the appeal of &lt;strong&gt;RISC&lt;/strong&gt; grew. However, transitioning existing systems to &lt;strong&gt;RISC&lt;/strong&gt; meant rewriting massive amounts of software, making the change cost-prohibitive. It wasn’t until the rise of &lt;strong&gt;smartphones&lt;/strong&gt; in the &lt;strong&gt;2000s&lt;/strong&gt; that &lt;strong&gt;RISC&lt;/strong&gt; processors, particularly the &lt;strong&gt;ARM architecture&lt;/strong&gt;, became widespread. Companies like &lt;strong&gt;Qualcomm&lt;/strong&gt; and &lt;strong&gt;Samsung&lt;/strong&gt; popularized &lt;strong&gt;ARM processors&lt;/strong&gt;, making them the foundation of mobile computing.&lt;/p&gt;

&lt;p&gt;Apple’s journey through &lt;strong&gt;RISC&lt;/strong&gt; and &lt;strong&gt;CISC&lt;/strong&gt; architectures has been an interesting one. From &lt;strong&gt;1994 to 2006&lt;/strong&gt;, Apple used &lt;strong&gt;PowerPC processors&lt;/strong&gt;, which were based on &lt;strong&gt;RISC&lt;/strong&gt;. This was a period when Steve Jobs and Apple embraced &lt;strong&gt;RISC&lt;/strong&gt; for its performance benefits and efficiency. However, in &lt;strong&gt;2006&lt;/strong&gt;, Apple transitioned to &lt;strong&gt;Intel-based CISC processors&lt;/strong&gt;, which enabled better compatibility with software and improved performance. The shift helped Apple grow into the dominant force it is today.&lt;/p&gt;

&lt;p&gt;But Apple’s story doesn’t end there. With the advent of its &lt;strong&gt;M-series chips&lt;/strong&gt;, starting with the &lt;strong&gt;M1&lt;/strong&gt; in &lt;strong&gt;2020&lt;/strong&gt;, Apple returned to &lt;strong&gt;RISC&lt;/strong&gt;, this time leveraging &lt;strong&gt;ARM-based&lt;/strong&gt; architecture for its &lt;strong&gt;MacBook&lt;/strong&gt;, &lt;strong&gt;iMac&lt;/strong&gt;, and &lt;strong&gt;Mac mini&lt;/strong&gt;. The transition allowed Apple to further improve performance while maximizing &lt;strong&gt;battery life&lt;/strong&gt;—a key advantage in mobile devices that has now extended to laptops.&lt;/p&gt;

&lt;p&gt;In conclusion, while &lt;strong&gt;CISC&lt;/strong&gt; processors once dominated, the advent of &lt;strong&gt;RISC&lt;/strong&gt; has proven to be essential in the evolution of &lt;strong&gt;mobile&lt;/strong&gt; and &lt;strong&gt;laptop computing&lt;/strong&gt;. Today, we continue to see the benefits of &lt;strong&gt;RISC architecture&lt;/strong&gt;, particularly in &lt;strong&gt;power efficiency&lt;/strong&gt; and &lt;strong&gt;performance&lt;/strong&gt; for devices like smartphones and laptops. The choice between &lt;strong&gt;RISC&lt;/strong&gt; and &lt;strong&gt;CISC&lt;/strong&gt; is not just a technical debate but one that defines the usability, efficiency, and longevity of modern computing devices.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Ternary Conditional Operators</title>
      <dc:creator>Alexandre Bento Freire</dc:creator>
      <pubDate>Tue, 26 Nov 2024 11:31:39 +0000</pubDate>
      <link>https://dev.to/a-bentofreire/ternary-conditional-operators-o12</link>
      <guid>https://dev.to/a-bentofreire/ternary-conditional-operators-o12</guid>
      <description>&lt;p&gt;Python is one of the few popular modern languages that doesn't follow the traditional C-style syntax for ternary conditional operators. Instead of the standard format where the condition is followed by the true expression and then the false expression, Python places the true expression first, followed by the condition and the false expression.&lt;/p&gt;

&lt;p&gt;However, not every language supports ternary conditional operators. For example, Go, a rapidly growing language in popularity, does not have a ternary operator. This absence reflects Go's design philosophy, which prefers simplicity and avoids operators that might reduce code readability.&lt;/p&gt;

&lt;p&gt;The table below summarizes how different programming languages and language-like systems (such as SQL and Excel) handle ternary conditional operators or their equivalents.&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>go</category>
      <category>learning</category>
    </item>
    <item>
      <title>In the age of AI, sharpen your skills</title>
      <dc:creator>Alexandre Bento Freire</dc:creator>
      <pubDate>Tue, 19 Nov 2024 13:12:00 +0000</pubDate>
      <link>https://dev.to/a-bentofreire/in-the-age-of-ai-sharpen-your-skills-1oj5</link>
      <guid>https://dev.to/a-bentofreire/in-the-age-of-ai-sharpen-your-skills-1oj5</guid>
      <description>&lt;p&gt;I've noticed many people who are deeply afraid of AI taking their jobs and rendering them obsolete. Meanwhile, others use tools like ChatGPT for content creation, relying solely on copy and paste.  &lt;/p&gt;

&lt;p&gt;Remember these key points:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The world is always evolving—AI is not the first challenge.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Consider how the COVID-19 pandemic forced people around the globe to stay home. Yet, we adapted, rebuilt, and continued forward. Change is constant, and resilience ensures we remain standing.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hard times make us stronger.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Prosperity may bring comfort, but it’s the challenges that push us to grow. In those moments of struggle, we adapt, overcome, and come out better on the other side.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Master technology—don’t let it master you.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Tools like ChatGPT, navigation apps, and social media can enhance your life and work, but they should not define you. Learn to thrive without them.&lt;br&gt;&lt;br&gt;
Learn to code like an expert, navigate without maps, and communicate effectively. The habit of continuous learning is your greatest strength.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Learn to Speak.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Beyond technical skills, the ability to articulate your ideas clearly is vital. In job interviews or professional settings, how you deliver your message matters just as much as what you know. Avoid abbreviations, slang, or hesitation. Speak with clarity and confidence.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Promotions favor team players.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Technical expertise is essential, but promotions often go to those who collaborate effectively and understand company goals. Learn to socialize, build trust, and work as part of a team. Being approachable and cooperative can open doors that technical skills alone cannot.  &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This message was written by Alexandre Bento Freire and fine-tuned with the help of ChatGPT.&lt;/p&gt;

</description>
      <category>motivation</category>
      <category>teambuilding</category>
      <category>leadershipdevelopment</category>
      <category>businessstrategy</category>
    </item>
    <item>
      <title>ABeamer - Frame-by-Frame Web Animation Framework</title>
      <dc:creator>Alexandre Bento Freire</dc:creator>
      <pubDate>Wed, 30 Oct 2024 13:30:15 +0000</pubDate>
      <link>https://dev.to/a-bentofreire/abeamer-frame-by-frame-web-animation-framework-fid</link>
      <guid>https://dev.to/a-bentofreire/abeamer-frame-by-frame-web-animation-framework-fid</guid>
      <description>&lt;p&gt;For web developers and animators seeking an alternative to traditional CSS animations, ABeamer offers a distinct approach with its frame-by-frame animation capabilities. Unlike CSS animations that typically respond to user interactions, ABeamer harnesses web technology with a unique frame-based engine, designed to operate independently of user actions. With ABeamer, each frame is rendered precisely at a defined frames-per-second rate, enabling seamless server-side rendering of animations into animated GIFs or video clips.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Github: &lt;a href="https://github.com/a-bentofreire/abeamer" rel="noopener noreferrer"&gt;https://github.com/a-bentofreire/abeamer&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Website: &lt;a href="https://abeamer.devtoix.com/" rel="noopener noreferrer"&gt;https://abeamer.devtoix.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;In Action: &lt;a href="https://codepen.io/a-bentofreire" rel="noopener noreferrer"&gt;https://codepen.io/a-bentofreire&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Animated Charts Example: &lt;a href="https://codepen.io/a-bentofreire/pen/mKjQXR" rel="noopener noreferrer"&gt;https://codepen.io/a-bentofreire/pen/mKjQXR&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Gallery: &lt;a href="https://abeamer.devtoix.com/#gallery" rel="noopener noreferrer"&gt;https://abeamer.devtoix.com/#gallery&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;ABeamer Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Built in TypeScript&lt;/strong&gt;: ABeamer’s core is developed in TypeScript, providing both structure and flexibility for TypeScript and JavaScript developers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extensibility and Plugins&lt;/strong&gt;: ABeamer is engineered with extensibility in mind and comes equipped with several plugins, including options for charting, transitions and oscillation effects. These tools allow developers to integrate a wide array of visual elements with customizability at each step.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easing Functions&lt;/strong&gt;: Supporting various easing options, ABeamer provides smooth transitions and complex movement patterns, adding a refined, professional touch to animations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive Documentation&lt;/strong&gt;: Detailed documentation ensures that developers can navigate ABeamer’s capabilities with ease, from the basics to advanced configurations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gallery of Examples&lt;/strong&gt;: ABeamer includes a broad selection of examples, showcasing its versatility and range for anyone exploring its potential.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For developers who need precise control and media-ready outputs, ABeamer is a flexible and capable solution, setting itself apart by allowing frame-by-frame generation. This level of control supports a wide range of animation needs, from web-based sequences to professionally exported clips. With a solid TypeScript foundation, rich extensibility, and an extensive gallery of examples, ABeamer is a powerful tool for creating dynamic animations that meet both web and multimedia requirements.&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%2Fntdelov10e64pquwesy7.gif" 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%2Fntdelov10e64pquwesy7.gif" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>PyTraceToIX - How to debug Jinja2 templates, Flask web apps without breaking the design or code changes</title>
      <dc:creator>Alexandre Bento Freire</dc:creator>
      <pubDate>Thu, 17 Oct 2024 22:29:54 +0000</pubDate>
      <link>https://dev.to/a-bentofreire/pytracetoix-how-to-debug-jinja2-templates-flask-web-apps-without-breaking-the-design-or-code-changes-3imf</link>
      <guid>https://dev.to/a-bentofreire/pytracetoix-how-to-debug-jinja2-templates-flask-web-apps-without-breaking-the-design-or-code-changes-3imf</guid>
      <description>&lt;p&gt;&lt;a href="https://www.devtoix.com/en/projects/pytracetoix" rel="noopener noreferrer"&gt;PyTraceToIX&lt;/a&gt; is an expression tracer designed for debugging Jinja2 templates, Flask web apps, lambdas, list comprehensions, method chaining, and expressions in general.&lt;/p&gt;

&lt;p&gt;Code editors often cannot set breakpoints within these kinds of expressions, which requires significant code modifications to debug effectively.&lt;/p&gt;

&lt;p&gt;For Jinja2 templates, the debug extension can be used, but it typically dumps the entire context, making it difficult to isolate specific issues. PyTraceToIX solves this by allowing developers to trace and write specific data directly to sys.stdout or a stream without altering the design or making any changes to the web application.&lt;/p&gt;

&lt;p&gt;Additionally, PyTraceToIX can capture multiple inputs and their results, displaying them all in a single line, making it easier to view aggregated data and trace the flow of values.&lt;/p&gt;

&lt;p&gt;PyTraceToIX offers a straightforward solution to these challenges, simplifying debugging while preserving the integrity of the original codebase.&lt;/p&gt;

&lt;p&gt;It was designed to be simple, with easily identifiable functions that can be removed once the bug is found.&lt;/p&gt;

&lt;p&gt;PyTraceToIX has 2 major functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;c__&lt;/code&gt; capture the input of an expression input. ex: &lt;code&gt;c__(x)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;d__&lt;/code&gt; display the result of an expression and all the captured inputs. ex: &lt;code&gt;d__(c__(x) + c__(y))&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And 2 optional functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;init__&lt;/code&gt; initializes display format, output stream and multithreading.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;t__&lt;/code&gt; defines a name for the current thread.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;pytracetoix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Jinja2 templates Usage
&lt;/h2&gt;

&lt;p&gt;In this example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A flask web app uses a Jinja2 template&lt;/li&gt;
&lt;li&gt;It generates a shopping card html table with product, quantity and final price&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Product&lt;/th&gt;
&lt;th&gt;Qty&lt;/th&gt;
&lt;th&gt;Final Price&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Smartphone&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;2500&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wireless B&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;49960&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Smartphone&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;1990&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;The product name is only the first 11 characters, but we need to know the full name.&lt;/li&gt;
&lt;li&gt;It only shows the final price which is Price * Qty - discount.&lt;/li&gt;
&lt;li&gt;The discount is dependent of the quantity.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;c__&lt;/code&gt; captures the complete name but doesn't change the design.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;c__&lt;/code&gt; captures the qty and labels it as Qty.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;c__&lt;/code&gt; captures the discount value.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;d__&lt;/code&gt; outputs to sys.stdout all the captured inputs and the final price.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The stdout will display these lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;i0:`Smartphone 128GB` | qty:`5` | i2:`500` | discount:`0` | _:`2500`
i0:`Wireless Bluetooth Headphones` | qty:`50` | i2:`1000` | discount:`40` | _:`49960`
i0:`Smartphone 64GB Black` | qty:`20` | i2:`100` | discount:`10` | _:`1990`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Jinja2 template:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css"&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container mt-5"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Shopping Cart&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;table&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"table table-striped"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;&lt;/span&gt;Product&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;&lt;/span&gt;Qty&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;&lt;/span&gt;Final Price&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
            {% for item in purchases %}
            {% set product = products[item['product']] %}
            &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;td&amp;gt;&lt;/span&gt;{{ c__(product['name'])[0:10] }}&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;td&amp;gt;&lt;/span&gt;{{ c__(item['qty'], name='qty') }}&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;td&amp;gt;&lt;/span&gt;{{ d__(c__(product['price']) * item['qty']
                    - c__(discount(item['qty']), name='discount')) }}&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
            {% endfor %}
        &lt;span class="nt"&gt;&amp;lt;/table&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;app.py:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;render_template&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pytracetoix&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;c__&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d__&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Jinja2_env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;globals&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;d__&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d__&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Jinja2_env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;globals&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;c__&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;c__&lt;/span&gt;

&lt;span class="n"&gt;DISCOUNTS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;PRODUCTS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;WB50CC&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Wireless Bluetooth Headphones&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;price&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;PH20XX&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Smartphone 128GB&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;price&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;PH50YY&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Smartphone 64GB Black&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;price&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;PURCHASES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;product&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;PH20XX&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;qty&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;product&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;WB50CC&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;qty&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;product&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;PH50YY&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;qty&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;discount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;DISCOUNTS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;


&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;methods&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;GET&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;PRODUCTS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;purchases&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;PURCHASES&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;discount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;discount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;debug&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the previous example, we add c__ to the discount function on app.py:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;discount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;c__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;DISCOUNTS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;))[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It will add richer discount information to the output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;i0:`Smartphone 128GB` | qty:`5` | i2:`500` | i3:`(0, 0)` | discount:`0` | _:`2500`
i0:`Wireless Bluetooth Headphones` | qty:`50` | i2:`1000` | i3:`(50, 40)` | discount:`40` | _:`49960`
i0:`Smartphone 64GB Black` | qty:`20` | i2:`100` | i3:`(20, 10)` | discount:`10` | _:`1990`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>webdev</category>
      <category>flask</category>
      <category>jinja</category>
    </item>
    <item>
      <title>JsTraceToIX - Debugging React, Vue, and Node.js just got easier! – no need to clutter your codebase with `console.log`!</title>
      <dc:creator>Alexandre Bento Freire</dc:creator>
      <pubDate>Wed, 16 Oct 2024 18:49:00 +0000</pubDate>
      <link>https://dev.to/a-bentofreire/jstracetoix-debugging-react-vue-and-nodejs-just-got-easier-no-need-to-clutter-your-codebase-with-consolelog-2h2b</link>
      <guid>https://dev.to/a-bentofreire/jstracetoix-debugging-react-vue-and-nodejs-just-got-easier-no-need-to-clutter-your-codebase-with-consolelog-2h2b</guid>
      <description>&lt;p&gt;If you've ever had to debug React or Vue components, arrow functions, or complex expressions on Node or the Web Browser, you know the pain of adding multiple &lt;code&gt;console.log&lt;/code&gt; statements and making unnecessary code changes. That's where &lt;strong&gt;JsTraceToIX&lt;/strong&gt; comes in!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.devtoix.com/en/projects/jstracetoix" rel="noopener noreferrer"&gt;Project Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simplifies debugging with &lt;strong&gt;minimal code changes&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Supports debugging of &lt;strong&gt;React, Vue, and Node.js&lt;/strong&gt; environments, as well as regular browsers.&lt;/li&gt;
&lt;li&gt;Handles &lt;strong&gt;single-line expressions&lt;/strong&gt; and &lt;strong&gt;arrow functions&lt;/strong&gt; with ease.&lt;/li&gt;
&lt;li&gt;Easily &lt;strong&gt;define names, filter results, and override inputs and outputs&lt;/strong&gt; for better traceability.&lt;/li&gt;
&lt;li&gt;Simple function names, like &lt;code&gt;c__&lt;/code&gt; and &lt;code&gt;d__&lt;/code&gt;, make it easy to spot and remove traces after catching the bug.&lt;/li&gt;
&lt;li&gt;Works seamlessly with &lt;strong&gt;multithreaded&lt;/strong&gt; environments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Bonus&lt;/strong&gt;: If you're working with Python, check out &lt;strong&gt;PyTraceToIX&lt;/strong&gt;, which offers the same powerful debugging tools for your Python projects.&lt;/p&gt;

&lt;p&gt;Say goodbye to complex and messy debugging – with JsTraceToIX, you can capture inputs and display results all in one step, making debugging cleaner and faster!&lt;/p&gt;

&lt;p&gt;Check out JsTraceToIX and see how it can simplify your debugging process. &lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Environment&lt;/th&gt;
&lt;th&gt;Require Installation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Browser&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Node.js&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;React&lt;/td&gt;
&lt;td&gt;Optional&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vue&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;jstracetoix &lt;span class="nt"&gt;--save-dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  React Usage
&lt;/h2&gt;

&lt;p&gt;In this example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cityTax&lt;/code&gt; arrow function captures the input price and names it 'Price'.&lt;/li&gt;
&lt;li&gt;On &lt;code&gt;ShoppingList&lt;/code&gt; function:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;c__&lt;/code&gt; captures the title in the first &lt;code&gt;&amp;lt;td&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;c__&lt;/code&gt; captures the output of the cityTax and names it &lt;code&gt;CityTax&lt;/code&gt; in the 2nd &lt;code&gt;&amp;lt;td&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;d__&lt;/code&gt; displays the aggregated information in a single line: title, price, cityTax, total Price.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;d__&lt;/code&gt; will generate this output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;i0:`Rice` | Price:`10` | CityTax:`5` | _:`15`
i0:`Coffee` | Price:`30` | CityTax:`15` | _:`45`
i0:`Shoes` | Price:`100` | CityTax:`15` | _:`115`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Without local installation&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;c__&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;d__&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://cdn.jsdelivr.net/gh/a-bentofreire/jstracetoix@1.1.0/component/jstracetoix.mjs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// If it's installed locally via "npm install jstracetoix --save-dev"&lt;/span&gt;
&lt;span class="c1"&gt;// import { c__, d__ } from 'jstracetoix/component/jstracetoix.mjs';&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cityTax&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;c__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Price&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Rice&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Coffee&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Shoes&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ShoppingList&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;listItems&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;products&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;tr&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;td&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;c__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/td&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;td&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;d__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;c__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;cityTax&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;CityTax&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}))}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/td&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/tr&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;table&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;tbody&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;listItems&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/tbody&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;table&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;header&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ShoppingList&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/header&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Node.js Usage
&lt;/h2&gt;

&lt;p&gt;In this example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;c__&lt;/code&gt;.&lt;code&gt;allow()&lt;/code&gt; - overrides the input value being debugged when value &amp;gt; 40.00,
for other values it doesn't captures the input.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;d__&lt;/code&gt;.&lt;code&gt;allow()&lt;/code&gt; - overrides the result value being debugged.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;d__&lt;/code&gt;.&lt;code&gt;after()&lt;/code&gt; - stops the program after displaying the result and the captured fields.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;c__&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;d__&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;jstracetoix&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Smartphone 128GB&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;price&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;699.00&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Coffee Maker&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;price&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;49.99&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Electric Toothbrush&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;price&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;39.95&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;4K Ultra HD TV&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;price&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;999.99&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Gaming Laptop&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;price&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1299.00&lt;/span&gt; &lt;span class="p"&gt;}];&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;factor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mf"&gt;1.10&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prices&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;d__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;products&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;c__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;40.00&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt;
            &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;factor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;substring&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;})),&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="na"&gt;after&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// exits after displaying the results&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="c1"&gt;// Smartphone:`768` | Coffee Mak:`54` | 4K Ultra H:`1099` | Gaming Lap:`1299` | _:`["0:699","1:49.99","2:39.95","3:999.99","4:1299"]`&lt;/span&gt;

&lt;span class="c1"&gt;// this code is unreachable&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Environment&lt;/th&gt;
&lt;th&gt;Default Output Function&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Browser&lt;/td&gt;
&lt;td&gt;console.debug&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Node.js&lt;/td&gt;
&lt;td&gt;process.stdout&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;React&lt;/td&gt;
&lt;td&gt;console.debug&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vue&lt;/td&gt;
&lt;td&gt;console.debug&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Except for Node.js environment, the output is displayed in the browser's developer tools under the "Console Tab".&lt;br&gt;
Since the output is generated using &lt;code&gt;console.debug&lt;/code&gt;, it can easily be filtered out from regular &lt;code&gt;console.log&lt;/code&gt; messages.&lt;br&gt;&lt;br&gt;
The default output function can be override using &lt;code&gt;init__({'stream': new_stream.log })&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Metadata
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;d__&lt;/code&gt; function callbacks &lt;code&gt;allow&lt;/code&gt;, &lt;code&gt;before&lt;/code&gt; and &lt;code&gt;after&lt;/code&gt; will receive a parameter &lt;code&gt;data&lt;/code&gt; with the allowed inputs plus the following &lt;code&gt;meta&lt;/code&gt; items:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;meta__&lt;/code&gt;: list of meta keys including the name key.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;thread_id__&lt;/code&gt;: thread_id being executed&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;allow_input_count__&lt;/code&gt;: total number of inputs that are allowed.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;input_count__&lt;/code&gt;: total number of inputs being captured.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;allow__&lt;/code&gt;: If false it was allowed. Use this for &lt;code&gt;after&lt;/code&gt; callback.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;output__&lt;/code&gt;: Text passed to &lt;code&gt;before&lt;/code&gt; without &lt;code&gt;new_line&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;name: name parameter&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Documentation
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.devtoix.com/docs/jstracetoix/en/" rel="noopener noreferrer"&gt;Package Documentation&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
      <category>node</category>
    </item>
    <item>
      <title>How to start python or ipython with packages pre-imported.</title>
      <dc:creator>Alexandre Bento Freire</dc:creator>
      <pubDate>Wed, 21 Aug 2024 20:36:48 +0000</pubDate>
      <link>https://dev.to/a-bentofreire/how-to-start-python-or-ipython-with-packages-pre-imported-17h4</link>
      <guid>https://dev.to/a-bentofreire/how-to-start-python-or-ipython-with-packages-pre-imported-17h4</guid>
      <description>&lt;p&gt;Instead of every time you execute python or ipython, have to write "import os" or other common packages, this script will start python with these packages imported&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/usr/bin/env bash
# -------------------------------------------------------------
#  Calls ipython or python3 with multiple packages imported
# -------------------------------------------------------------

if [[ -z "$1" ]] || [[ -f "$1" ]]; then
    [[ -n "$(command -v ipython3)" ]] &amp;amp;&amp;amp; EXEC="ipython3" || EXEC=python3
    TMP_PY=/$TMPDIR/$EXEC.py
    printf "import os, re, sys, math, datetime, yaml\n" &amp;gt;$TMP_PY
    $EXEC -i $TMP_PY "$@"
else
    python3 "$@"
fi

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

&lt;/div&gt;



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

</description>
      <category>python</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
