<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Aeturnum - Medium]]></title>
        <description><![CDATA[Aeturnum is a software services organization based in Boston, USA - Medium]]></description>
        <link>https://medium.com/aeturnuminc?source=rss----13bbb68d98b0---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Aeturnum - Medium</title>
            <link>https://medium.com/aeturnuminc?source=rss----13bbb68d98b0---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 07:41:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/aeturnuminc" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Ponytail: The AI Coding Skill That Refuses to Over-Build]]></title>
            <link>https://medium.com/aeturnuminc/ponytail-the-ai-coding-skill-that-refuses-to-over-build-5f418644ff5c?source=rss----13bbb68d98b0---4</link>
            <guid isPermaLink="false">https://medium.com/p/5f418644ff5c</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Hansaanuradha]]></dc:creator>
            <pubDate>Fri, 09 Oct 2026 06:39:42 GMT</pubDate>
            <atom:updated>2026-10-09T06:35:14.825Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FAkJ52eiRogrvzi9FKRjpg.png" /></figure><h4>The lazy senior dev, as a skill</h4><p>You’re familiar with that kind of person: they have a long ponytail, wear oval glasses, and have been with the company longer than the version control system. If you show them fifty lines of code, they’ll look at them, say nothing, and then substitute them with just one. Ponytail transfers that instinct into an AI coding agent — a capability that causes it to consider whether the code actually needs to exist before it writes a single line.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*rEPkqvPDhhPQLXz10ocNuQ.png" /></figure><p>The mascot has oval glasses and has no patience when fifty lines are required when only one is needed. One request, two very different amounts of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hHfQJA5nkiydArozOl99tg.png" /></figure><p>It’s the same model and the same request — the only difference is whether it resorts to using what is already available before referring to a library.How it thinks: seven checks before any code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cxYq9RfSuEWqBlbyFwNXZw.png" /></figure><p>The first six steps usually arrive at a solution before the seventh step needs to construct anything new.</p><h3>Meet the competition</h3><p>Two further approaches are evaluated using Ponytail’s own benchmark. <strong>Caveman</strong> takes a different approach in that it leaves the code as it is and instead makes the agent’s responses more concise, along with introducing a local proxy which compresses the logs and the test output before the agent reads them again. A simpler baseline — simply instructing the model to <strong>follow YAGNI and to prefer one-liners</strong> in the prompt — is also tested, serving as a stand-in for the effect that a simple prompt adjustment can have without any installation.</p><p>Each of the three analyses involves the same twelve real coding tickets from the same repository, which means the comparison isn’t merely promotional material.</p><h3>Where it refuses to cut corners</h3><p>The ladder has no say in whether the code is safe — it only determines how much code is written.</p><p>Validation, error handling, security checks, and accessibility must be included at all times. The 120-line cache class must be insisted on, and it will then be built — slowly and correctly, while you are watching.</p><p>Lacking enthusiasm regarding the solution, but not lacking concern about the consequences. Getting it running</p><h3>Getting it running</h3><p>Same ladder, different install command depending on which agent you run:</p><p>Claude Code</p><pre>/plugin marketplace add DietrichGebert/ponytail<br><br>/plugin install ponytail@ponytail</pre><p>Codex</p><pre> codex plugin marketplace add DietrichGebert/ponytail &amp;&amp; codex plugin add ponytail@ponytail</pre><p>GitHub Copilot CLI</p><pre>copilot plugin marketplace add DietrichGebert/ponytail &amp;&amp; copilot plugin install ponytail@ponytail</pre><p>Gemini CLI</p><pre>gemini extensions install https://github.com/DietrichGebert/ponytail</pre><p>Cursor</p><pre> git clone https://github.com/DietrichGebert/ponytail then node ponytail/scripts/cursor-hooks.js install</pre><p>Grok Build</p><pre>grok plugin install DietrichGebert/ponytail --trust</pre><p>OpenClaw</p><pre>clawhub install ponytail</pre><p>Full install matrix, uninstall commands, and version notes live on the repo itself.</p><h3>What’s actually been measured on Caveman</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jTLDPdKOUnEKLIzQOt6TqA.png" /></figure><p>The 65% figure that is marketed is not a single validated figure; the nearest independently verified figure, from JetBrains, is 8.5% from real agentic coding sessions.</p><h3>The numbers: three approaches, same benchmark</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OjWAsfOyrXzh2PJxkyqGYQ.png" /></figure><p>The three figures are from Ponytail’s own benchmark repository; there is no independent third party involved in this comparison, so regard the exact percentages as a claim made by the vendor until you carry out the test yourself. It should be mentioned that the simple YAGNI prompt, although it was competitive in terms of cost and time, was the only one to fail the adversarial safety check (95% compared to 100% for the other two).</p><h3>Side by side</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E5c3HIpRzUlzvYMUoAgHSw.png" /></figure><h3>The takeaway</h3><p>Ponytail and Caveman aren’t in fact rivals; rather, they operate at different levels. Caveman deals with what the agent reads and states, while Ponytail cuts down the code itself, since it is the code that actually determines review time and defect rate, not just the number of tokens. A simple YAGNI prompt manages to go a long way without cost, but it is the only one of the three that showed signs of problems with safety.</p><p>When making your choice, the question comes down to what you’re trying to optimize for: for sessions that involve a lot of reading, Caveman’s proxy is the better option, while for those that involve a lot of coding, Ponytail’s ladder is preferable — yet both groups of maintainers state that the two stacks do not conflict, so there is seldom a good reason to select just one.</p><h3>References</h3><ul><li><a href="https://github.com/DietrichGebert/ponytail">Ponytail on GitHub</a> — the skill, install matrix, and benchmark source</li><li><a href="https://github.com/JuliusBrussee/caveman">Caveman on GitHub</a> — the skill, proxy, and the comparison tables this piece draws on</li><li><a href="https://github.com/DietrichGebert/ponytail/blob/main/benchmarks/results/2026-06-18-agentic.md">Ponytail’s agentic benchmark write-up</a> — the LOC, token, cost and time numbers</li></ul><p>JetBrains’ and Adobe Research’s figures are as reported inside Caveman’s README; neither was independently re-verified here.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f418644ff5c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aeturnuminc/ponytail-the-ai-coding-skill-that-refuses-to-over-build-5f418644ff5c">Ponytail: The AI Coding Skill That Refuses to Over-Build</a> was originally published in <a href="https://medium.com/aeturnuminc">Aeturnum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Automated My QA Workflow with Kiro — Without Replacing the Tester]]></title>
            <link>https://medium.com/aeturnuminc/how-i-automated-my-qa-workflow-with-kiro-without-replacing-the-tester-9c27de8102db?source=rss----13bbb68d98b0---4</link>
            <guid isPermaLink="false">https://medium.com/p/9c27de8102db</guid>
            <category><![CDATA[generative-ai]]></category>
            <category><![CDATA[ai-augmented-testing]]></category>
            <dc:creator><![CDATA[Ruchira Lakmali]]></dc:creator>
            <pubDate>Thu, 06 Aug 2026 06:08:44 GMT</pubDate>
            <atom:updated>2026-08-06T06:08:43.371Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kl4P2ZxQU64XjDpHynMxUg.png" /></figure><h3>From Jira Story to Playwright Automation: How I Built an AI-Augmented QA Workflow That Reduces Repetitive Work — Without Replacing the Tester</h3><p>Like many QA engineers working on projects, my workflow used to start the exact same way every sprint — with a multi-tab scavenger hunt.</p><p>When a new feature moved into testing, I would spend hours manually piecing together context:</p><ul><li><strong>Reading</strong> requirement documents in Confluence</li><li><strong>Cross-checking</strong> UI specs in Figma</li><li><strong>Writing</strong> and formatting manual test cases, creating JIRA tickets, and bugs reporting</li><li><strong>Setting up</strong> and maintaining Playwright test scripts</li></ul><p>None of these tasks were difficult on their own, but together, they consumed massive amounts of time before I could focus on real engineering work: <strong>risk analysis, deep exploratory testing, and driving software quality.</strong></p><p>The problem wasn’t testing itself — it was all the repetitive prep work surrounding it.</p><p>So I asked myself:</p><blockquote><strong><em>What if AI could handle the repetitive groundwork, fetching live project context automatically while I focus on the core testing decisions?</em></strong></blockquote><p>To solve this, I rebuilt my QA process around <strong>Kiro</strong>, utilizing its <strong>tool-augmented, agentic retrieval</strong> via the <strong>Model Context Protocol (MCP)</strong>. Instead of relying on static context windows or pasting text back and forth, Kiro calls live tools directly at request time to pull from Confluence, GitHub, and Figma.</p><p>Here is how the workflow operates — and why keeping the human engineer in the loop makes all the difference.</p><h3>1. Tool-Augmented Context &amp; “Implementation-Aware” Test Design</h3><p>I learned early on that bad inputs give bad outputs. Instead of asking Kiro to blindly <em>“write test cases,”</em> I set up a structured, step-by-step process that it follows for every feature.</p><p>Rather than reading static files, Kiro uses <strong>MCP integration</strong> to interact directly with live project systems:</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*5rxoQ3-JYoK9OO3y.png" /></figure><ul><li><strong>UI Verification:</strong> Inspects live Figma designs for target states and component layouts.</li><li><strong>Source Code Analysis:</strong> Reads the actual implementation in GitHub (read-only) to discover hidden business rules, validations, feature flags, and integrations.</li><li><strong>Mismatch Detection:</strong> Compares implementation against documentation to highlight inconsistencies <em>before</em> test design even begins.</li></ul><h3>Traceable &amp; Categorized Test Suites</h3><p>Every test scenario Kiro generates is fully traceable back to its origin — whether it came from a business requirement, a UI specification, or a code-level edge case.</p><p>To make reviews fast and clean, generated scenarios are grouped into distinct buckets:</p><ul><li><strong>Requirement-based</strong> vs. <strong>Implementation-based</strong></li><li><strong>Regression</strong> &amp; <strong>Boundary</strong> tests</li><li><strong>Negative</strong>, <strong>Security</strong>, and <strong>Accessibility</strong> checks</li><li><strong>Automation Candidates</strong></li></ul><blockquote><strong>No More Guesswork:</strong> If a requirement is vague or code behavior is undocumented, Kiro doesn’t make assumptions. It generates structured clarification questions for me to review with Product Owners or developers before writing final test cases.</blockquote><h3>2. Risk Checks &amp; Automated Documentation</h3><p>Before generating test suites, Kiro evaluates the risk profile of the story based on code complexity, business impact, data sensitivity, and module dependencies. High-risk features receive deep coverage, while minor tweaks remain appropriately light.</p><h3>Removing Administrative Friction</h3><p>Once the test design is approved and execution begins, Kiro automates the administrative overhead across your workflow:</p><ul><li><strong>Publishes</strong> structured test plans directly to Confluence under the correct page hierarchy.</li><li><strong>Creates</strong> matching sub-tasks in Jira for design and execution tracking.</li><li><strong>Logs Bugs Directly to Jira:</strong> When an issue is found during execution, simply prompting Kiro with Bug - &quot;Bug title&quot; triggers it to create a complete bug report in Jira, enriched with the relevant context while automatically adhering to the team&#39;s guideline.md.</li><li><strong>Generates</strong> a complete Requirement Traceability Matrix (RTM) linking requirements, source code, test cases, and logged defects.</li></ul><p>Instead of spending hours manually filling out defect forms, updating Jira, and copying text across platforms, you can log bugs in seconds and keep your testing momentum going.</p><p>Instead of spending hours copying text across platforms, I simply review and approve the generated artifacts.</p><h3>3. Playwright Automation: Code Reuse Over Regeneration</h3><p>When it’s time to automate, Kiro doesn’t generate generic, isolated scripts.</p><p>It starts by inspecting our existing Playwright test suite to understand our architecture — reusing Page Object classes, fixtures, API utilities, and framework conventions. including:</p><ul><li>Existing <strong>Page Object</strong> classes</li><li>Custom <strong>fixtures</strong> and helper methods</li><li>Shared <strong>API utilities</strong> and test data setups</li></ul><p>The goal is <strong>reuse, not regeneration</strong>.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*EFA6iWB04CR0IKx1.png" /></figure><p>By reading the actual application source code, Kiro identifies reliable locators based on DOM structure rather than guessing selectors from the rendered UI.</p><p>The generated scripts arrive ready for production, strictly following engineering standards:</p><ul><li>Clean <strong>Page Object Model (POM)</strong> pattern</li><li>Strict <strong>Arrange–Act–Assert</strong> structure</li><li>Resilient locator strategies (getByRole, getByLabel)</li><li><strong>Zero hard-coded credentials</strong>, arbitrary timeouts, or unnecessary waits</li></ul><h3>4. Keeping Humans in Control (And Measuring the Impact)</h3><p>While AI handles the heavy lifting of information gathering and boilerplate generation, critical quality decisions remain strictly human.</p><p>I still explicitly manage:</p><ul><li><strong>Evaluating</strong> clarification questions with product teams</li><li><strong>Validating</strong> total test coverage against real-world risk</li><li><strong>Investigating</strong> test failures and tuning locators</li><li><strong>Executing</strong> deep exploratory testing session</li><li><strong>Making</strong> final quality and release decisions</li></ul><h3>Data-Driven Effort Tracking</h3><p>To ensure transparency, every phase records <strong>AI execution time</strong>, <strong>estimated manual effort</strong>, and <strong>human review time</strong>.</p><p>Instead of vaguely saying <em>“AI makes testing faster,”</em> I now have clear sprint metrics showing where manual hours were saved — data that helps during team planning and retro discussions.</p><h3>What Actually Changed?</h3><p>The biggest win wasn’t that AI replaced testing skills — it eliminated the fatigue surrounding testing prep.</p><p>I spend significantly less time on:</p><ul><li>Switching tabs across Jira, Confluence, Figma, and GitHub</li><li>Writing repetitive test case templates</li><li>Copying tables across tools</li><li>Creating detailed bug reports manually, including reproduction steps, expected vs actual behavior, environment details, and supporting information.</li><li>Setting up Playwright boilerplate code</li></ul><p>Instead, I focus my time where QA expertise adds true value:</p><ul><li>Risk Analysis &amp; Exploratory Testing</li><li>Finding Complex Edge Cases</li><li>Improving Automation Architecture</li><li>Collaborating with developers and product owners</li><li>Bridging Gaps Between Requirements &amp; Code Implementation</li></ul><h3>Final Thoughts</h3><p>AI excels at structured, context-heavy, and repetitive tasks. Through tool-augmented retrieval via MCP, it can pull live context, detect gaps, update documentation, and build automation scaffolding in seconds.</p><p>However, AI lacks human judgment. It cannot evaluate real business risk, think creatively during exploratory testing, or decide if a feature truly delivers value to the end user.</p><blockquote><strong>The future of QA isn’t AI vs. Testers.</strong></blockquote><blockquote><strong>It’s testers empowered by AI.</strong></blockquote><p>By pairing AI’s speed for groundwork with human expertise for decision-making, testing becomes faster, clearer, and much more engineering-driven.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c27de8102db" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aeturnuminc/how-i-automated-my-qa-workflow-with-kiro-without-replacing-the-tester-9c27de8102db">How I Automated My QA Workflow with Kiro — Without Replacing the Tester</a> was originally published in <a href="https://medium.com/aeturnuminc">Aeturnum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Sanity CMS into an Existing Next.js 15 & TypeScript App]]></title>
            <link>https://medium.com/aeturnuminc/integrating-sanity-cms-into-an-existing-next-js-15-typescript-app-a5d3d054727e?source=rss----13bbb68d98b0---4</link>
            <guid isPermaLink="false">https://medium.com/p/a5d3d054727e</guid>
            <category><![CDATA[headless-cms]]></category>
            <category><![CDATA[sanity]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Dilani Jayawickrama]]></dc:creator>
            <pubDate>Tue, 07 Apr 2026 05:29:15 GMT</pubDate>
            <atom:updated>2026-04-07T05:50:37.988Z</atom:updated>
            <content:encoded><![CDATA[<p>When building modern web applications, we often need a way to manage content dynamically without hard-coding everything. A common use case is when non-technical team members want to update content on the website. For example, imagine the marketing team wants to:</p><ul><li>Add a new blog post</li><li>Update partner logos</li><li>Update customer testimonials</li></ul><p>Without a content management system (CMS), developers would need to update the code and redeploy the site for each small change. This slows down the process and makes collaboration harder.</p><p>That’s where Sanity CMS comes in. Sanity CMS provides structured content, a flexible API, and real-time collaboration. It allows developers to structure content while giving non-technical users a user-friendly editor interface to update the website without touching the code.</p><p>This post guides you through integrating Sanity CMS with an existing Next.js 15 and TypeScript application. You’ll be introduced to the basics of Sanity CMS, learn how to set up the integration step by step, and follow a practical workflow with a real-world example.</p><h3>What is Sanity CMS?</h3><p>Sanity is a headless CMS, which means it separates the backend (where content is stored and managed) from the frontend (your website or app’s presentation layer).</p><p>Unlike traditional CMS platforms (e.g., WordPress), Sanity doesn’t force you into a specific frontend design. Instead, it provides a flexible backend for managing structured content. The content is delivered via Sanity’s APIs, which can be queried using GROQ, REST, or GraphQL, allowing developers to build the frontend with any technology they choose, such as React, Next.js, or Vue.</p><p>Sanity provides:</p><ul><li><strong>Sanity Studio</strong> - a customizable content editor for non-technical users.</li><li><strong>Sanity Content Lake</strong> -<strong> </strong>a real-time datastore that stores all content in a structured and queryable format.</li><li><strong>GROQ</strong> - Sanity’s query language that lets developers fetch exactly the data they need.</li><li><strong>APIs</strong> - REST and GraphQL APIs to pull content into any frontend.</li></ul><p>Key concepts:</p><ul><li><strong>Schema - </strong>A schema in Sanity is a blueprint that defines the structure of your content. It specifies the types of documents you have, the fields contained in each document, and how those fields behave. Schemas are written in JavaScript or TypeScript and control how content is created, stored, and edited in Sanity Studio.</li><li><strong>Document</strong> - A document is a single piece of content created based on a schema. For example, a blog post, product, or testimonial is a document. Documents consist of multiple fields as defined in their schema and can be created, edited, published, and queried.</li><li><strong>Field</strong> - A field is an individual data point within a document, like a title, image, date, or reference to another document. Fields have types such as string, image, boolean, or array, and they store the actual content values.</li></ul><p>Together, schemas, documents, and fields form a flexible and powerful content model that allows you to structure your content exactly as needed for your project.</p><h3><strong>Setup Sanity CMS in your Next.js application.</strong></h3><p>Using npm:</p><pre>npm create sanity@latest</pre><p>Using yarn:</p><pre>yarn create sanity@latest</pre><p>(At the time of writing, the latest version is 3.99.0)</p><p>When you run above command, the CLI walks you through a series of prompts to configure your project. Here’s an example session:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yS72V43PnLX2SJsJZlV3IA.png" /></figure><p><strong>(1) CLI Initialization and Account Login<br></strong>When the CLI starts, it first asks you to log in or create a Sanity account. You can authenticate via a third-party provider like Google, GitHub, or email. If you don’t have an account, you can create one directly from the CLI. Once logged in, the CLI fetches any existing Sanity projects tied to your account.</p><p><strong>(2) Selecting or Creating a Project</strong></p><ul><li>If you have existing projects, the CLI prompts you to choose one or create a new project.</li><li>When creating a new project, enter a project name, which identifies your Sanity backend and workspace.</li></ul><p><strong>(3) Organization name<br></strong>An organization in Sanity is a group that holds projects together under one umbrella. It manages billing, team members, roles, and permissions, and is useful for agencies, companies, or teams collaborating on multiple projects.</p><p><strong>(4) Use the default dataset configuration<br></strong>Sanity stores content in datasets. The default option creates a public dataset named “production”, which is generally used unless you need a custom or private dataset.</p><p><strong>(5) Add configuration files for a Sanity project in this Next.js folder<br></strong>If you choose yes, this adds the necessary config files directly to your existing Next.js project, ensuring both apps (Next.js and Sanity Studio) are integrated and share settings.</p><p><strong>(6) TypeScript support<br></strong>Choose whether to generate all config and schema files in TypeScript or JavaScript.</p><p><strong>(7) Embedded Sanity Studio<br></strong>Choose yes to embed the Sanity Studio admin panel directly as a route in your Next.js application, making content editing accessible from your site’s interface.</p><p><strong>(8) Route for Sanity Studio<br></strong>Specify the path/URL segment in your Next.js app where Sanity Studio will be accessible, e.g., /studio.</p><p><strong>(9) Project template<br></strong>Choose a starter template. The “Clean project” template is ideal for creating custom schemas from scratch.</p><p><strong>(10) Add project ID/dataset to .env.local file<br></strong>Automatically writes your Sanity project settings to your environment file (.env.local), ensuring your Next.js app can access Sanity credentials securely.</p><p>This setup process ensures your Sanity project is fully integrated with your Next.js 15 application, including organizational management, dataset configuration, embedded studio access, and secure environment setup. Each prompt has a specific role in the config, making the integration streamlined and easy to maintain.</p><p>Once complete, your Studio will be accessible at /studio in your Next.js application (or at the custom route you specified in step 8)</p><h3>Folder structure</h3><p>The following screenshot displays the folder structure after integrating Sanity. The folders and files highlighted in green were added during the setup process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*c_UH4PsGPkAAomhUcl1pOQ.png" /></figure><p>(a) <strong>Embedded Sanity Studio in Next.js</strong></p><ul><li>src/app/studio/[[...tool]]/page.tsx - enables the embedded Sanity Studio. By routing /studio (or at the custom route you defined earlier when setting up Sanity CMS in your Next.js application) to this page, you can access Studio’s admin panel directly inside your Next.js app. This file handles loading the Studio React component and passing the configuration.</li></ul><p>(b)<strong>sanity/ – this is the main directory for all Sanity-related logic in your integrated Next.js project.</strong></p><ul><li>lib/- contains utility modules for working with Sanity in your app.<br>⇢client.ts- configures and exports the initialized Sanity client instance for making API requests (fetching, querying, mutating data).<br>⇢image.ts - provides image URL builder utilities (commonly using @sanity/image-url) for optimized image delivery.<br>⇢live.ts - manages live preview or subscription logic to enable real-time content previews in the frontend.</li><li>schemaTypes/- this is where all your schema (content model) definitions live.<br>⇢index.ts- Exports all schema types to be included in the overall Sanity configuration. Individual schema files (e.g., post.ts, testimonial.ts) are imported and combined here.<br>⇢ (You can add other schema files here for each content type.)</li><li>env.ts - centralizes and manages environment variables such as the Sanity project ID, dataset, or API version for use across your Sanity libraries.</li><li>structure.ts - defines structure configurations for customizing the layout, order, and grouping of documents and fields in Sanity Studio’s editing interface.</li></ul><p><strong>(c) Top-Level Sanity Configuration</strong></p><ul><li>sanity.cli.ts- configuration for Sanity CLI behavior (e.g., deployment, workspaces, or defaults).</li><li>sanity.config.ts- the main configuration file for Sanity Studio. Registers project ID, dataset, Studio route, loaded plugins, and imported schemas.</li></ul><p><strong>(d) Other Related Files</strong></p><ul><li>.env.local - stores sensitive environment variables for both Next.js and Sanity integration (project ID, dataset, API token).</li></ul><h3>Example: How Sanity CMS can help with managing customer testimonials on a website</h3><h4>The Problem</h4><p>Customer testimonials are essential for building trust and providing social proof. But managing them can be challenging when:</p><ul><li>Testimonials are collected from many customers over time.</li><li>Testimonials often include details such as customer names, photos, job titles, quotes, and dates.</li><li>Content editors want to add, update, or remove testimonials without needing developer involvement.</li><li>Websites often need to display testimonials dynamically across multiple sections or pages</li><li>Testimonials may be localized for different languages or tailored for different audiences.</li></ul><h4>How Sanity CMS Solves This</h4><p>Sanity CMS makes managing testimonials easy and flexible by offering:</p><ul><li>Custom Schema Definition: Define a schema with fields such as customer name, photo, job title, quote, and date.</li><li>User-Friendly Studio: Content editors can add or edit testimonials through the Sanity Studio UI without touching code.</li><li>Content as Data: Testimonials are stored as structured data, accessible via the API, for dynamic rendering on the website.</li><li>Real-Time Updates: Updates to testimonials are instantly reflected on the site when fresh data is fetched.</li><li>Multilingual Capability: Easily create variants for different languages if you run an international site.</li><li>Reusable Content Blocks: Use testimonials across multiple pages or components without duplication.</li></ul><h4>Example Schema for Testimonials</h4><p>Inside /schemaTypes folder create a file called testimonial.ts (Use descriptive, lowercase file names that align with the schema name for clarity)</p><pre>import { defineType } from &quot;sanity&quot;;<br><br>export default defineType({<br>  name: &#39;testimonial&#39;,<br>  title: &#39;Testimonial&#39;,<br>  type: &#39;document&#39;,<br>  fields: [<br>    {<br>      name: &#39;name&#39;,<br>      title: &#39;Customer Name&#39;,<br>      type: &#39;string&#39;,<br>      validation: Rule =&gt; Rule.required()<br>    },<br>    {<br>      name: &#39;photo&#39;,<br>      title: &#39;Photo&#39;,<br>      type: &#39;image&#39;,<br>      validation: (Rule) =&gt; Rule.required()<br>    },<br>    {<br>      name: &#39;position&#39;,<br>      title: &#39;Position / Title&#39;,<br>      type: &#39;string&#39;,<br>      validation: (Rule) =&gt; Rule.required()<br>    },<br>    {<br>      name: &#39;quote&#39;,<br>      title: &#39;Quote&#39;,<br>      type: &#39;text&#39;,<br>      validation: (Rule) =&gt; Rule.required()<br>    },<br>    {<br>      name: &#39;date&#39;,<br>      title: &#39;Date&#39;,<br>      type: &#39;date&#39;,<br>      validation: (Rule) =&gt; Rule.required()<br>    }<br>  ]<br>})</pre><p>Inside the /schemaTypes/index.ts file, organize schemas by importing each file and exporting them together in a single array.</p><pre>import { type SchemaTypeDefinition } from &#39;sanity&#39;<br>import testimonial from &quot;./testimonial&quot;;<br><br><br>export const schema: { types: SchemaTypeDefinition[] } = {<br>  types: [testimonial],<br>}</pre><h4>How to Add Testimonials with Sanity Studio</h4><p>Sanity Studio is a web-based editing environment for managing all site content.</p><p>After completing the steps above, you can access Sanity Studio at http://localhost:3000/studio (or at the custom route you defined earlier when setting up Sanity CMS in your Next.js application).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RNvBa41q5eYqpyGctr2QVw.png" /></figure><ol><li><strong>Left column (</strong><em>Structure menu</em><strong>)</strong></li></ol><ul><li><strong>Testimonial </strong>→<strong> </strong>A document type defined in your schema. Selecting it lists all testimonial documents in the middle panel.</li></ul><p>2. <strong>Middle column </strong>(<em>Document List</em>)</p><ul><li><strong>+ button </strong>→ Clicking the “<strong>+”</strong> button creates a new empty testimonial document.</li><li><strong>Three-dot menu (next to +)</strong> → Provides additional actions (like sorting, display settings).</li><li><strong>Search bar </strong>→ Lets you filter testimonial documents by text.</li><li>Below the search bar, you’ll see all existing testimonials.</li></ul><p>3. <strong>Right column <em>(</em></strong><em>Document Editor</em><strong><em>)</em></strong></p><ul><li>If you click the “<strong>+”</strong> button in the middle column, you’ll see a newly created empty testimonial document in the right column. Fill in the fields. Finally, click the “Publish” button in the bottom-right corner to add the testimonial.</li><li>If you click an existing testimonial in the middle column, the right column shows its details. You can edit the fields, then click the “Publish” button in the bottom-right corner to save your changes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ol2x3jI9_fB-3Np_khq6xQ.png" /></figure><h4>How to Retrieve Testimonials in Your Web App</h4><ul><li><strong>Step 1: Define a GROQ Query</strong><br>After creating testimonials in Studio, create a new file: queries.ts<strong> </strong>inside sanity/libfolder and write your GROQ query there, as shown below.</li></ul><pre>import { defineQuery } from &#39;next-sanity&#39;<br><br>export const GET_TESTIMONIALS_QUERY = defineQuery(`*[_type == &quot;testimonial&quot;]{<br>    _id,    <br>    name,<br>    photo,<br>    position,<br>    quote,<br>    date<br>  }`);</pre><ul><li><strong>Step 2: Generate Schema Snapshots &amp; Types</strong><br>Run the following commands from the root of your project whenever you add or update GROQ queries:</li></ul><pre>npx sanity@latest schema extract --enforce-required-fields</pre><p>This command creates an up-to-date snapshot of your schemas that your GROQ queries depend on.</p><pre>npx sanity@latest typegen generate</pre><p>This command generates TypeScript types based on both your schemas and GROQ queries. After running this command you’ll have sanity.types.tsfile. It contains type definitions for your Sanity schemas and GROQ query results. You can achieve type safety in your code by using this.</p><ul><li><strong>Step 3: Configure Next.js Image for Sanity</strong><br>To allow Next.js Image to load images from Sanity’s CDN, update next.config.tsfile as follows:</li></ul><pre>import type { NextConfig } from &quot;next&quot;;<br><br>const nextConfig: NextConfig = {<br>  images: {<br>    remotePatterns: [<br>      {<br>        protocol: &#39;https&#39;,<br>        hostname: &#39;cdn.sanity.io&#39;,<br>        pathname: &#39;/**&#39;,<br>      },<br>    ],<br>  },<br>};<br><br>export default nextConfig;</pre><p>(Remember to restart your dev server after this change.)</p><ul><li><strong>Step 4: Fetch and Display Testimonials</strong><br>Use the following example code to display testimonials.</li></ul><pre>import { GET_TESTIMONIALS_QUERYResult } from &quot;@/sanity.types&quot;;<br>import { client } from &quot;@/sanity/lib/client&quot;;<br>import { urlFor } from &quot;@/sanity/lib/image&quot;;<br>import { GET_TESTIMONIALS_QUERY } from &quot;@/sanity/lib/queries&quot;;<br>import Image from &quot;next/image&quot;;<br><br>export default async function Home() {<br><br>  const testimonials: GET_TESTIMONIALS_QUERYResult = await client.fetch(GET_TESTIMONIALS_QUERY, {}, { cache: &#39;no-store&#39; });<br><br>  return (<br>    &lt;div className=&quot;bg-blue-50 text-black min-h-screen p-5&quot;&gt;<br>      &lt;div className=&quot;flex py-6 font-bold text-2xl&quot;&gt;What Our Customers Say&lt;/div&gt;<br>      &lt;div className=&quot;flex gap-5 flex-wrap&quot;&gt;<br>        {testimonials.map(t =&gt; (<br>          &lt;div key={t._id} className=&quot;flex w-[400px] shrink-0 gap-5 flex-col p-5 rounded-md  bg-gradient-to-br from-gray-300 to-white shadow-md&quot;&gt;<br>            &lt;div className=&quot;flex gap-5&quot;&gt;<br>              &lt;div className=&quot;relative size-12 rounded-full overflow-hidden&quot;&gt;<br>                &lt;Image<br>                  src={urlFor(t.photo).url()}<br>                  alt={t.name}<br>                  fill<br>                  sizes=&quot;48px&quot;<br>                  style={{ objectFit: &quot;cover&quot; }} /&gt;<br>              &lt;/div&gt;<br>              &lt;div className=&quot;flex flex-col&quot;&gt;<br>                &lt;div className=&quot;font-semibold&quot;&gt;{t.name}&lt;/div&gt;<br>                &lt;div className=&quot;text-sm font-medium&quot;&gt;{t.position}&lt;/div&gt;<br>              &lt;/div&gt;<br>            &lt;/div&gt;<br>            &lt;div className=&quot;text-gray-800 italic&quot;&gt;{t.quote}&lt;/div&gt;<br>            &lt;div className=&quot;text-xs text-gray-500&quot;&gt;{new Date(t.date).toLocaleDateString()}&lt;/div&gt;<br>          &lt;/div&gt;<br>        ))}<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>The type of the query result is autogenerated and can be found in the sanity.types.ts file after you run the npx sanity@latest typegen generate command in Step 2 above.</p><p><strong>Output</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJWJIX0hnBFv8wZ9pE8ORA.png" /></figure><h4>Managing User Access to Edit Testimonials in Sanity Studio</h4><p>To allow your marketing team or other collaborators to add and edit testimonials in Sanity Studio, you first need to manage their user access permissions via the Sanity management portal.</p><ol><li>Go to <a href="https://www.sanity.io/manage">https://www.sanity.io/manage</a> and log in with your Sanity account.</li><li>Find your project under the correct organization and select it.</li><li>From the page you navigate to, click on the “Members” tab. Then, click the light-blue “+ Add members” button on the right side and invite new users by entering their email addresses. (Note: team members must have a Sanity account to accept the invitation.) When inviting your team, assign appropriate roles such as Editor or Administrator, which determine each member’s level of access.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qfn1bHAF0bB-e6cTfylHMQ.png" /></figure><p>5. Once invited, your teammates will receive an email invitation. After accepting it, they can visit the /studio route on your deployed Next.js app (or at the custom route you defined earlier when setting up Sanity CMS in your Next.js application) to access the CMS. In the Studio, they will be able to add new testimonials, edit existing ones, and manage content according to their permissions.</p><p>Congrats! You’ve now integrated Sanity CMS into your Next.js 15 and TypeScript app. Your app is fetching testimonials directly from Sanity, giving you a dynamic, flexible content setup. From here, you can continue exploring Sanity’s features and expand your application with even more structured content.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5d3d054727e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aeturnuminc/integrating-sanity-cms-into-an-existing-next-js-15-typescript-app-a5d3d054727e">Integrating Sanity CMS into an Existing Next.js 15 &amp; TypeScript App</a> was originally published in <a href="https://medium.com/aeturnuminc">Aeturnum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Neo4j]]></title>
            <link>https://medium.com/aeturnuminc/introduction-to-neo4j-259fd3807bd2?source=rss----13bbb68d98b0---4</link>
            <guid isPermaLink="false">https://medium.com/p/259fd3807bd2</guid>
            <dc:creator><![CDATA[Chathura Hansika]]></dc:creator>
            <pubDate>Wed, 19 Feb 2025 12:09:08 GMT</pubDate>
            <atom:updated>2025-02-19T12:09:08.049Z</atom:updated>
            <content:encoded><![CDATA[<p>Neo4j is a native graph database that leverages the graph model at its core, even at the storage level. Unlike systems that overlay graph abstractions on other technologies, Neo4j is built entirely around graph structures. It uses the property graph model, enabling rich and flexible data representations through nodes, relationships, and their associated properties. Neo4j also features Cypher, a powerful and intuitive query language designed specifically for working with graph data. Over the years, Neo4j has evolved into a rich ecosystem of tools, applications, and libraries, allowing seamless integration of graph technologies into various workflows, making it an indispensable platform for modern data solutions.</p><p>In this article, we will explore key aspects such as graph databases, the property graph model, the Cypher query language, the transformation of a relational data model into the Neo4j graph data model, neo4j eco system, Core Features of Neo4j and Real-World Use Cases of Neo4j to understand how Neo4j revolutionizes the way we interact with data.</p><h3>Graph Database Concept</h3><p>Imagine you trying to model a real-world scenario, like a social network. You have people (users), each connected to their friends, followers, messages, and posts. Now, consider representing all these connections using a traditional relational database. You’d likely need separate tables for users, messages, friendships, and more. As you add additional relationships like tracking who follows whom, who commented on a post, or who shared what the complexity escalates rapidly.</p><p>In traditional databases, representing relationships often involves complex queries with multiple joins. As the number of connections grows, these queries become slower and more challenging to manage. Developers began to realize that relational databases, with their rigid structure of rows, columns, and foreign keys, weren’t designed to handle the intricate, interconnected nature of modern data.</p><p>This realization sparked the emergence of graph databases. Imagine being able to represent everything users, friendships, messages, and posts — as nodes in a graph, with the relationships between them represented as edges. With graph databases, this vision becomes a reality. They enable us to store data as interconnected graphs, where every data point is naturally linked to others. This structure makes it incredibly efficient to query relationships and uncover patterns, solving a problem that relational databases struggled to address.</p><p>A graph data structure consists of nodes (representing discrete objects) and relationships that establish connections between them. The image below illustrates this concept, showcasing three nodes (depicted as circles) and three relationships, highlighting the fundamental structure of a graph.</p><figure><img alt="Figure 1: Concept of graph structure" src="https://cdn-images-1.medium.com/max/662/1*o0eENV5_VI1etl0_xp6KZA.jpeg" /></figure><p>Graph databases are classified into different types based on their data models, and <strong><em>Neo4j uniquely adopts the Property Graph Model</em></strong>.</p><h3><strong>Property Graph Model</strong></h3><p>Unlike traditional databases that store data in tables or documents, a Neo4j graph database stores data as<strong> nodes, relationships, and properties</strong>. In this model, <strong>nodes</strong> represent entities (such as people, projects) and can be labeled for categorization (such as people, projects). <strong>Relationships</strong> are directed edges that connect nodes, defining how they are related (ex : DEDICATED_TO). Both nodes and relationships can have associated <strong>properties</strong>, stored as key-value pairs, to provide additional context or metadata.</p><p>Below is an example of the Neo4j Property Graph Model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p8oH6sPHfemWVTWW16_8rQ.jpeg" /><figcaption>Property Graph Model</figcaption></figure><p>Below is a table that illustrates the nodes, relationships, and properties as depicted in the above image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ir44LzcGNhzvRM7ImZLQ3w.jpeg" /></figure><p><strong>Node</strong> :</p><p>Nodes are used to represent entities within a specific domain. Each node can be categorized using one or more labels, which help classify the type of entity it represents. Additionally, nodes are highly flexible in terms of data storage, as they can contain multiple properties in the form of key-value pairs, allowing for rich and detailed information to be associated with each entity.</p><p><strong>Node labels :</strong></p><p>A label is a named element in a graph that classifies nodes into specific sets. Nodes with the same label are grouped together within the same set.</p><p><em>Ex: Person, Project</em></p><p><strong>Properties :</strong></p><p>Properties are key-value pairs used to store data on nodes or relationships. The value associated with a property can take various forms, including different data types like numbers, strings, or booleans. Additionally, it can be a homogeneous list (or array) containing elements such as strings, numbers, or boolean values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*VH-5q6q3Oa9Hng8IRJG_eQ.jpeg" /></figure><p><strong>Relationship :</strong></p><p>A relationship defines the connection between a source node and a target node, specifying how they are related. It is directional, meaning it flows in a single direction, and it must have a specific type to classify the nature of the relationship, such as <em>DEDICATED_TO</em>. Relationships can also include properties in the form of key-value pairs to provide additional details. For instance, a property like <em>role : ’developer’</em> can further describe the relationship.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B2EOFZNYcD3InOoaKFPqHg.jpeg" /></figure><h3><strong>Cypher</strong></h3><p>Cypher is the declarative query language of Neo4j, designed to harness the full capabilities of property graph databases. Its syntax is influenced by an ASCII-art style, making it intuitive and visually expressive.</p><p>Let’s explore how to create nodes and relationships using Cypher queries.</p><blockquote>We use the Cypher <a href="https://github.com/aeturnum-inc/ianacare-scheduler-service/pull/330"><strong>CREATE </strong>clause to create nodes and relationships.</a></blockquote><h4><strong>Creating Nodes in Cypher</strong></h4><p>Below are the Cypher queries to create the nodes :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97c4ee0fee1c5052bc95e60c63b8ccc2/href">https://medium.com/media/97c4ee0fee1c5052bc95e60c63b8ccc2/href</a></iframe><p>The following illustrates the node label and node properties in a Cypher queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_vwrvnmfTR4rTix-L855Yw.jpeg" /></figure><h4><strong>Creating Relationships in Cypher</strong></h4><p>The following illustrates the pattern for creating relationships.</p><blockquote>(:node1)-[:CONNECTED_TO]-&gt;(:node2)</blockquote><p>Below is the Cypher query to create the relationship.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/470a3f17533b38a298da35d20b9b0db4/href">https://medium.com/media/470a3f17533b38a298da35d20b9b0db4/href</a></iframe><p>This query creates a Person node for Jane Doe and a Project node for Project X. It also establishes a DEDICATED_TO relationship between them, specifying the role as &#39;developer&#39;.</p><p>In the above query, the relationship is represented as</p><blockquote>-[:DEDICATED_TO {role: ‘developer’}]-&gt;.</blockquote><p>Here, the relationship type is `DEDICATED_TO`, and the relationship property is `{role: ‘developer’}`.</p><p><strong>Creating Relationships in Cypher by Reusing Variables</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/09d1fe3607f89121d37d2d3079a3441e/href">https://medium.com/media/09d1fe3607f89121d37d2d3079a3441e/href</a></iframe><blockquote>We use the Cypher <strong>MATCH </strong>clause to specify patterns that the database searches for within its graph structure.</blockquote><p>This Cypher query demonstrates how to match existing nodes and create a relationship between them. Let’s break it down:</p><ol><li><strong><em>MATCH (per{personId: 10000})</em></strong><br>This part of the query searches for a node with the label Person and a personId property of 10000. The node is assigned to the variable per.</li><li><strong><em>MATCH (pro{title: ‘Project X’})</em></strong><br>This part of the query finds a node with the label project and a title property of ‘Project X’. The node is assigned to the variable pro.</li><li><strong><em>CREATE (per)-[{role: ‘developer’}]-&gt;(pro);</em></strong><br>After matching the nodes, this clause creates a directed relationship from the per(Person) node to the pro(Project) node. The relationship is of type DEDICATED_TO and includes a property role set to ‘developer’. This signifies that the person with personId = 10000 is dedicated to the project &quot;Project X&quot; in the role of a developer.</li></ol><h3>Data model Transformation (Relational to Graph)</h3><p>Data model transformation from relational to graph involves shifting from traditional table-based structures to graph-based representations. Let’s explore the key elements of a relational data model and map them to their corresponding components in a graph data model.</p><ul><li><strong>Table</strong> <em>to</em> <strong>Node Label :</strong> Each entity table in the relational model is transformed into a node label in the graph model</li><li><strong>Row</strong> <em>to</em> <strong>Node : </strong>Each row in a relational entity table is converted into a node in the graph model.</li><li><strong>Column</strong> <em>to</em><strong> Node Property : </strong>Columns (fields) in relational tables are transformed into node properties in the graph model.</li><li><strong>Foreign keys</strong> <em>to</em> <strong>Relationships : </strong>Foreign keys linking to other tables are replaced with relationships, and the foreign keys are removed in the process.</li><li><strong>Join tables</strong> <em>to</em> <strong>Relationships : </strong>Join tables are transformed into relationships, columns on those tables become relationship properties.</li></ul><p>The image below illustrates how a table in the relational data model is transformed into the graph data model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kNcS4sfMAKl0ycM-dA1tkA.jpeg" /><figcaption>A table in the relational data model transformed into the graph data model.</figcaption></figure><p>As shown in the image above, the Person table is transformed into a node label, with the table columns (personId, title, startDate, endDate) becoming node properties. Each row in the table is converted into a separate node.</p><p>For instance, if the Person table contains two rows, it transforms into two nodes under the ‘Person’ label. Each node will have property keys such as personId, title, startDate, and endDate, with the property values corresponding to the respective row values from the Person table. The below image shows how this transformation visually represents relational data as graph nodes with their respective properties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MqMcc4swdZ56NI5sI-Ly8w.jpeg" /><figcaption>Transforming two rows of a relational table into a graph representation</figcaption></figure><p>Below is a depiction of removing foreign keys and join tables during the transformation of a relational data model into a graph data model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8c0yZQnMe7O8KkO10MLHvw.jpeg" /><figcaption>Removing foreign keys and join tables in the transformation from a relational data model to a graph data model.</figcaption></figure><p>After completing the <a href="#4a4c">transformation steps mentioned above</a>, the resulting graph is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N-sJ48hA3EzhWJxDq9UiyQ.jpeg" /><figcaption>Graph Data Model Representation</figcaption></figure><h3>Neo4j eco system</h3><p>The Neo4j ecosystem offers a rich collection of tools, integrations, and resources aimed at improving the functionality and scalability of its graph database. It includes:</p><ul><li>Neo4j Aura : is a fully managed cloud service that allows you to start exploring Neo4j right from your browser.</li><li>Drivers/API’s and Connectors : Neo4j offers a powerful collection of drivers, APIs, and connectors to integrate effortlessly with a variety of programming languages and data platforms. Official drivers are available for Java, Python, JavaScript, and .NET. Furthermore, Neo4j’s APIs and connectors enable smooth integration with tools such as Apache Spark and Kafka.</li><li>Visualization : Neo4j Bloom(A visualization tool for exploring and analyzing graph data intuitively.)</li><li>Neo4j Tools : Neo4j Browser, Neo4j Data Importer, Neo4j Desktop</li><li>Cypher query language : A powerful language for querying and interacting with graph data.</li><li>Graph data Science : Advanced tools for graph-based analytics and machine learning.</li></ul><h3>Core Features of Neo4j</h3><ol><li><strong>Native Graph Storage &amp; Processing</strong> : Neo4j employs a graph-based data model, representing data as nodes, relationships, and properties, which is stored in its native graph format. This design ensures high performance for graph traversal and operations, particularly when handling complex, interconnected data and large-scale datasets.</li><li><strong>Cypher Query Language : </strong>Cypher is Neo4j’s powerful, declarative query language that allows users to express graph patterns and traverse relationships easily, enabling efficient querying of graph data.</li><li><strong>ACID Compliance : </strong>Neo4j supports ACID (Atomicity, Consistency, Isolation, Durability) transactions, ensuring data integrity and reliability, even during complex updates or failures.</li><li><strong>Scalability and High Availability</strong> : Neo4j is designed to scale horizontally and vertically, supporting distributed clusters for high availability and the ability to handle large volumes of data across multiple nodes.</li><li><strong>Integration and Extensibility</strong>: Neo4j seamlessly integrates with a wide range of data sources and technologies, providing an extensive ecosystem of tools and libraries for data integration and application development.</li></ol><h3>Real-World Use Cases of Neo4j</h3><ul><li>Social Networks : Neo4j is great for modeling social networks by linking users, groups, and content. It makes it easy to analyze social interactions, recommend friends, and understand network patterns</li><li>Fraud Detection : Neo4j helps detect fraud by modeling transactions, accounts, and patterns in financial systems. It reveals suspicious activities and hidden connections that could point to fraud.</li><li>Real-Time Recommendation Engines : Neo4j maps user behaviors and preferences as a graph, enabling recommendation systems to suggest products, movies, or services based on relationships between users, items, and past interactions.</li><li>Network and IT Operations : In network management, Neo4j models complex IT systems, helping companies improve network performance, spot vulnerabilities, and understand how different parts of the system are connected.</li><li>Master Data Management : Neo4j supports organizations in consolidating, enriching, and managing master data by modeling entities, relationships, and hierarchies in a flexible and scalable graph format.</li></ul><h3>Conclusion</h3><p>Neo4j stands out as a powerful graph database that uses its native graph model to represent and manage complex, interconnected data. With its flexible property graph model and the intuitive Cypher query language, it provides a n efficient way to model, query, and analyze data relationships. As we’ve explored in this article, Neo4j’s comprehensive ecosystem and real-world applications across various industries highlight its growing importance in modern data solutions. By transforming traditional relational models and offering versatile tools for integration, Neo4j is shaping the future of data management and providing innovative ways to unlock insights from connected data.</p><h4>Reference :</h4><p>Neo4j Documentation : <a href="https://neo4j.com/docs/getting-started/">https://neo4j.com/docs/getting-started/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=259fd3807bd2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aeturnuminc/introduction-to-neo4j-259fd3807bd2">Introduction to Neo4j</a> was originally published in <a href="https://medium.com/aeturnuminc">Aeturnum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing AI features in Android Apps]]></title>
            <link>https://medium.com/aeturnuminc/implementing-ai-features-in-android-apps-42b31ce88bcd?source=rss----13bbb68d98b0---4</link>
            <guid isPermaLink="false">https://medium.com/p/42b31ce88bcd</guid>
            <dc:creator><![CDATA[Sasini Perera]]></dc:creator>
            <pubDate>Fri, 20 Dec 2024 08:06:47 GMT</pubDate>
            <atom:updated>2024-12-20T08:06:47.646Z</atom:updated>
            <content:encoded><![CDATA[<p>The world is changing due to artificial intelligence (AI). Several tools and frameworks designed for Android have made it easier to apply AI features with native Android development. These can assist developers in solving typical Android app development issues, simplifying their development processes, and producing applications that are more intelligent and user-centric.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NZVTzmvQk72IYM6P" /></figure><p>In this blog, we’ll discuss the importance of AI in Android Apps, focusing on different approaches and tools available for developers, common use cases for AI in Android Apps and challenges.</p><h4><strong>Advantages of integrating AI into Android applications</strong></h4><ul><li><strong>Enhanced User Experience</strong> : Applications can provide content, recommendations, and alerts that are especially relevant to the user by using AI algorithms which monitor user behavior and preferences.</li><li><strong>Competitive Advantage</strong> : Users will grow expected to AI as it appears more often in mobile apps. By integrating AI into your android app, you can stay ahead of the curve and set yourself apart from competitors. Additionally, you can utilize AI to develop new and innovative features that distinguish your app.</li><li><strong>Cost savings</strong> : Implementing AI can require an upfront investment, it can lead to cost savings in the long run. Tasks and procedures can be automated to cut down on the amount of manual work required</li></ul><h3>Use cases of AI in Android mobile apps</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/0*3zO2Qan5Ka03Mq11.jpg" /></figure><ol><li><strong>Predictive Analytics: </strong>Using past data, AI can assist you in predicting user preferences and behavior in android development. Future user behavior can be predicted by training AI algorithms.</li></ol><ul><li>For example: Music streaming app can use predictive analysis to suggest songs based on users’ history and e-commerce app can use predictive analysis to recommend products based on customer’s purchase and browsing history.</li></ul><p>2. <strong>Voice Assistants and Chatbots: </strong>Implementing a voice assistant/chatbot in the Android app could assist users with setting reminders, navigating the app, or finding answers to frequently asked questions. This makes the experience smooth and hands-free. NLP is used in chatbots to understand and process human language.</p><ul><li>For example: Google Assistant</li></ul><p>3. <strong>Image Recognition: </strong>AI-powered recognition of images is capable of identifying people, objects, and even text in pictures. AI can be used by developers to offer augmented reality (AR) experiences or smart photo management in Android apps.</p><ul><li>For example: Google Lens use AI to identify and analyze what the camera is aiming at, whether it a landmark, a product, or text.</li></ul><p>4.<strong> Speech-to-Text and Text-to-Speech: </strong>Speech-to-text technology allows users to dictate notes, messages or search queries. Text-to-speech technology, which reads text aloud, is helpful for voice notifications or accessibility features.</p><ul><li>For example: Google Assistant</li></ul><p>5. <strong>Autonomous Features:</strong> In android applications, self-driving features like gesture-based navigation, face unlocking, and image auto-tagging are powered by AI.</p><h3>Tools and Frameworks for AI in Android</h3><ol><li><strong>TensorFlow Lite (LiteRT) for Custom AI Models</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/249/0*kRjM9K9nwYmSMq_2.png" /></figure><ul><li>It is an open-source, lightweight tool by Google that optimized to run ML models on mobile devices. It allows developers to implement custom machine learning models. On an Android device, you can use models that have been trained on large data sets to perform complicated AI tasks.</li><li>It provides developers to create customized ML models for applications such as <strong>natural language processing, object detection, and image recognition.</strong></li></ul><p><strong>Why Choose TensorFlow Lite?</strong></p><ul><li>Availability of pre trained models</li><li>Allow to use custom models</li><li>Suited for mobile applications</li></ul><p><a href="https://ai.google.dev/edge/litert/android"><strong>https://ai.google.dev/edge/litert/android</strong></a></p><p>2. <strong>Pre-Trained Models with Google’s ML Kit</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/217/1*Zyc-rLDs7KLZCVpHz_v_QA.png" /></figure><ul><li>A mobile SDK offers ready-to-use APIs for incorporating ML into Android applications. It runs efficiently on-device allowing for real-time use cases.</li><li>It provides Vision API s for applications such as <strong>face detection, barcode scanning, image labeling </strong>and natural language APIs for applications such as<strong> translation, smart reply.</strong></li></ul><p><strong>Why Choose ML Kit?</strong></p><ul><li>Simple to integrate and fast to implement.</li><li>Easy to integrate with google services</li></ul><p><a href="https://developers.google.com/ml-kit/guides"><strong>https://developers.google.com/ml-kit/guides</strong></a></p><p>3. <strong>Dialogflow for Conversational AI</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*_9bhUT7kkzmeFywcSMrn-g.png" /></figure><ul><li>Dialogflow is an essential platform to create <strong>chatbots</strong>. It allows applications to understand and handle natural language user inquiries, which is suitable for creating interactive chatbots, voice assistants, and customer support bots.</li><li>Dialogflow allows you to create a chatbot that can communicate with users by voice or text, understands their input, and provides intelligent responses. Multi-language functionality also supported.</li></ul><p><strong>Why Choose Dialogflow?</strong></p><ul><li>Powered by Google, ensuring reliable and scalable performance.</li><li>Easy integration into Android apps using the Dialogflow SDK.</li></ul><pre>  //dialogFlow<br>    implementation &#39;com.google.cloud:google-cloud-dialogflow:2.1.0&#39;</pre><p><a href="https://cloud.google.com/dialogflow/docs"><strong>https://cloud.google.com/dialogflow/docs</strong></a></p><p>4.<strong> Android Studio with Gemini</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*2BjSeYIGUqfQLaOSJZMWJQ.png" /></figure><ul><li>The official IDE for Android development, Android Studio, has been improved using Gemini’s AI capabilities.</li><li>It provides AI-powered refactoring tools, error detection, and intelligent code suggestions.</li><li>Improves functionality by integrating easily with other Google AI services.</li><li>Offers faster coding and debugging procedures.</li></ul><h3>Challenges in Implementing AI for Android Apps</h3><p>The integration of AI into Android app development involves particular difficulties. Developers must have a solid understanding of AI concepts, algorithms, and methodologies in order to produce AI-driven features.</p><ul><li><strong>Model Maintenance: </strong>Updating and maintaining models is a crucial task for apps that use customized AI models. Developers need to ensure their models stay relevant and accurate, which can sometimes require continuous data training and updates.</li><li><strong>Complexity:</strong> If the app’s use cases require custom-trained models, integrating AI/ML models can be challenging. In those cases, it’s better to get support from data science expertise.</li><li><strong>Data privacy:</strong> Privacy issues arise when user data is processed and stored locally or in the cloud. AI frequently needs data to work properly, whether it’s user behavior data or input from camera/microphone sensors.</li><li><strong>Limitations on Performance:</strong> ML models require a lot of resources to run on mobile devices, therefore performance and battery life must be optimized.</li></ul><p>Using AI technologies to produce innovative apps is an important part of android app developers. In order to be ahead of the competition in the demand for android development trends, developers must:</p><ol><li>Improve skills in Kotlin and AI : The latest and popular programming language for Android development is Kotlin. It plays a role for making it easier to incorporate AI features into Android applications.</li><li>Collaborate with AI Specialists: Android app developers can enhance their understanding and use of complex AI algorithms by collaborating with data scientists and AI specialists. This will ensure that apps are optimized for both user experience and performance.</li><li>Staying up to date with AI technologies : Developing innovative Android apps requires staying up to date on the most recent advancements in AI and knowing how to incorporate them into apps.</li></ol><p>In conclusion, Android’s use of AI represents a fundamental change in the way mobile apps are created and used. It is not just a trend. With the variety of tools and libraries availability, developers can now implement features to android apps, improving user engagement and experience. However, to ensure a smooth integration of these AI technologies into real-world applications, challenges must be properly addressed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42b31ce88bcd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aeturnuminc/implementing-ai-features-in-android-apps-42b31ce88bcd">Implementing AI features in Android Apps</a> was originally published in <a href="https://medium.com/aeturnuminc">Aeturnum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking Efficiency with Xcode Cloud Integration for iOS Development]]></title>
            <link>https://medium.com/aeturnuminc/unlocking-efficiency-with-xcode-cloud-integration-for-ios-development-55282a8eaeb4?source=rss----13bbb68d98b0---4</link>
            <guid isPermaLink="false">https://medium.com/p/55282a8eaeb4</guid>
            <dc:creator><![CDATA[Yasiru Navoda Jayasekara]]></dc:creator>
            <pubDate>Wed, 11 Dec 2024 06:17:09 GMT</pubDate>
            <atom:updated>2024-12-11T06:17:09.204Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lTdTLa35ushzd_YhuJAV1g.jpeg" /></figure><p>In the fast-paced world of iOS development, efficiency and speed are paramount. Apple’s Xcode Cloud is a powerful continuous integration and delivery (CI/CD) service that integrates seamlessly with Xcode, enabling developers to automate their build, test, and deployment processes. This article will delve into the features, benefits, and practical applications of Xcode Cloud, providing you with a comprehensive guide to enhance your development workflow.</p><h4><strong>The Importance of automated building and testing</strong></h4><p>In a standard development cycle, changes to your code are followed by building the project and running it in a simulator or on test devices. You might also include running unit, integration, or performance tests using tools like Swift Testing or XCTest. However, this process can be time-consuming, especially for complex apps that need to support various devices and operating systems.</p><p>Xcode Cloud streamlines this by automating the build, test, and verification steps across multiple simulated devices simultaneously. Once the changes are verified, Xcode Cloud provides instant feedback via email or within Xcode itself, ensuring that any issues are caught early, helping maintain the stability and quality of your app. This automation saves significant development time and helps reduce errors, improving overall efficiency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ins9p4-cV5GHJx7UHkbbLQ.jpeg" /></figure><h4><strong>What is Xcode Cloud?</strong></h4><p>Xcode Cloud is a cloud-based continuous integration and delivery (CI/CD) service built directly into Xcode, Apple’s primary development environment for iOS, macOS, watchOS, and tvOS applications. It automates key stages of the app development lifecycle, including:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*g9XAep5qfrz2eAxeJdCUeg@2x.png" /></figure><ul><li>Building: Automatically compiles your code whenever changes are made.</li><li>Testing: Runs automated tests in parallel across multiple device configurations.</li><li>Distribution: Simplifies the process of delivering builds to testers and users.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1eGHupD6pjIVOc0zGOe5jQ.jpeg" /></figure><h4>Key Features of Xcode Cloud</h4><p>1. Continuous Integration</p><p>Xcode Cloud automates the integration process by building every committed code change. This feature not only saves time but also helps catch bugs early in the development cycle. Developers receive notifications if any issues arise, allowing for quick resolutions.</p><p><em>2. Automated Testing</em></p><p>With Xcode Cloud, you can run automated tests across various devices simultaneously. This ensures that your app functions correctly on different configurations, helping maintain high quality before release.</p><p><em>2. </em>Streamlined Distribution</p><p>Distributing apps is made easier with Xcode Cloud. You can archive your app and upload it directly to App Store Connect for distribution, reducing manual effort and potential errors.</p><blockquote>This service simplifies the CI/CD pipeline, helping both indie developers and teams deliver high-quality apps faster and more efficiently.</blockquote><h4>Setting Up Xcode Cloud for Your Project</h4><p>Setting up Xcode Cloud is a straightforward process that involves several key steps.</p><p><strong>1. Prerequisites</strong></p><p><strong><em>Developer Account Requirements:</em></strong></p><ul><li>Enroll in the <a href="https://developer.apple.com/programs/">Apple Developer Program</a>.</li><li>Use Xcode 14.0.1 or later.</li><li>Add your Apple ID under Accounts in Xcode settings.</li><li>Ensure you have an app record in App Store Connect or possess the necessary role or permissions to create one.</li></ul><blockquote>Note: To create an app record, you need to hold the App Manager, Admin, or Account Holder role within your Apple Developer team. If you have a developer role, you’ll need the Create Apps permission. If you lack the necessary role or permission, collaborate with a team member who has it.</blockquote><p><strong><em>Project and Workspace Requirements:</em></strong></p><p>To successfully work with Xcode Cloud, ensure that your project and workspace meet the following criteria</p><ul><li>Maintain a steady Xcode project or workspace throughout.</li><li>Utilize shared schemes and Xcode’s new build system within your project.</li><li>Ensure that the archive action is activated for the scheme used to build your app or framework.</li><li>Make sure that all project dependencies and third-party tools are accessible to Xcode Cloud.</li><li>Use automatic code signing for your app.</li><li>Set the bundle identifier for your app target in the “Signing &amp; Capabilities” tab of your Xcode project or workspace.</li></ul><p><strong><em>Source Control Requirements:</em></strong></p><p>To utilize Xcode Cloud, your project must be managed with Git for source control. Xcode Cloud is compatible with the following Source Code Management (SCM) providers:</p><ul><li>Bitbucket</li><li>GitHub</li><li>GitLab</li></ul><blockquote>Note: Additionally, you must have the appropriate permissions or role to link Xcode Cloud with your Git repository.</blockquote><p><strong>2. Connecting Xcode to Xcode Cloud</strong></p><p><strong><em>Open Xcode Settings:</em></strong></p><ul><li>Launch Xcode on your Mac, go to the “Xcode” menu, and select “Settings…” In the Settings window, navigate to the “Accounts” tab.</li></ul><p><strong><em>Add Your Apple ID:</em></strong></p><ul><li>Sign in using the Apple ID associated with your Apple Developer account. Click the “<strong>+</strong>” button to add the Apple ID you used to enroll in Xcode Cloud.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rNVbN7zxZijL4DII02Cj-Q.jpeg" /></figure><p><strong><em>Configure Xcode Cloud in Your Project:</em></strong></p><ul><li>Open your Xcode project and select the project navigator from the left sidebar.</li><li>Click your project name, then navigate to the “Signing &amp; Capabilities” tab.</li><li>Click the “<strong>+</strong>” button to add a new capability and choose “Xcode Cloud” from the list. Follow the prompts to enable Xcode Cloud for your project.</li></ul><h4>Use Case of Xcode Cloud</h4><h4><strong>1. </strong>Creating your first Xcode Workflow</h4><p><strong><em>Ensure the Archive Action is Selected:</em></strong></p><p>For each app or framework, you want to build with Xcode Cloud, ensure that the corresponding scheme includes the archive action. This is important for Xcode Cloud to properly archive and build your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hv_5kwWM1KgDAH6WKzeuqA.jpeg" /></figure><p>To check which schemes in your project are set up for archiving, you can run the following command in Terminal:</p><pre>xcodebuild -project Example.xcodeproj -describeAllArchivableProducts -json </pre><p>Xcode Cloud uses this same command to identify which products are available for building and archiving.</p><p><strong><em>Open Xcode and Access Xcode Cloud:</em></strong></p><p>Start by navigating to the <strong>Report Navigator</strong> in Xcode, which has two tabs: <strong>Local</strong> for your local builds, and <strong>Cloud</strong> for your Xcode Cloud builds. Alternatively, you can go to the menu bar and select <strong>Product &gt; Xcode Cloud &gt; Create Workflow</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SMXaMlzaglG541FS8jyOCQ.png" /></figure><p><strong><em>Create Workflow:</em></strong></p><p>In the <strong>Cloud</strong> tab, click on the <strong>Create Workflow</strong> button to begin setting up your first workflow. Select your product (app or framework) and click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*akolwPqZmg7J7rtiOv9ssg.png" /></figure><p>At this point, you can review the default configuration for the workflow. To customize it, click the <strong>Edit Workflow</strong> button, and a new window will appear, allowing you to modify various aspects of the workflow (covered in the next step).</p><p><strong><em>Edit and Set Workflow Parameters:</em></strong></p><p>Once you click <strong>Edit Workflow</strong>, a menu will open showing several steps to configure the workflow.</p><ul><li><strong>General</strong>: You can define a name and description for the workflow. If you want to restrict future editing, you can check the <strong>Restrict Editing</strong> box.</li><li><strong>Environment</strong>: Here, you can choose the specific Xcode version and macOS version for the build. If needed, you can also check the <strong>Clean</strong> option to clear the derived data during the build process, which may be useful but could increase the build time slightly.</li><li><strong>Start Condition</strong>: This step allows you to set the conditions under which the workflow should be triggered. By default, <strong>Branch Changes</strong> will archive a build whenever there’s a change in the selected branch (usually the main branch). Other available conditions include <strong>Pull Request Changes</strong>, <strong>Tag Changes</strong>, or <strong>Scheduled Builds</strong> for a particular branch.</li><li><strong>Actions</strong>: In this section, you can select the key actions such as <strong>Build</strong>, <strong>Test</strong>, <strong>Analyze</strong>, and <strong>Archive</strong>. You can also define the platform (iOS, macOS, etc.), scheme, and deployment options. Additionally, you can specify different types of devices for testing purposes.</li><li><strong>Post Actions</strong>: You can configure notifications after the build, such as sending updates to <strong>Slack channels</strong> or via <strong>email</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CLIer3Xvak1SyqmQgnKKnQ.png" /></figure><p><strong><em>Save Workflow and Connect to GitHub/Bitbucket/GitLab:</em></strong></p><p>Once you’ve customized the workflow and saved the configuration, Xcode Cloud will prompt you to link your repository (GitHub, Bitbucket, or GitLab). Follow these steps to complete the connection and grant necessary permissions.</p><ul><li>Click Next: After saving the workflow, click the <strong>Next </strong>button, which will take you to a permission review screen. Here, Xcode Cloud verifies permissions with your Git provider (GitHub, Bitbucket, or GitLab).</li><li>Grant Access: If the required permissions haven’t been set up yet, Xcode Cloud will ask you to grant access to your source code repository. Click on the <strong>Grant Access</strong> button to start this process.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JUbY6LT9umgDQ8Kfa0AfNQ.png" /></figure><ul><li>Connect Apple ID and Repository</li><li>Xcode will open App Store Connect in your web browser and prompt you to link Xcode Cloud with your repository provider (e.g., GitHub). The connection process involves two steps:</li><li>Link your Apple ID to your GitHub/Bitbucket/GitLab account.</li><li>Install the Xcode Cloud app on your repository account to facilitate continuous integration.</li><li>Confirmation: After completing these steps, you’ll see a confirmation pop-up with a green checkmark, signaling that Xcode Cloud has successfully connected to your repository. Click Continue in Xcode to return to Xcode. At this point, the <strong>Grant Access</strong> button will no longer be visible, indicating that access has been successfully granted.</li><li>Finalize Setup: Once back in Xcode, click Next to continue. A final confirmation screen will appear, showing that all steps are complete. Click Complete to finish setting up Xcode Cloud for your project.</li><li>Start Build: Now that your project is connected, you can select the branch and start building by clicking the <strong>Start Build</strong> button. Alternatively, you can trigger the build by committing changes to the selected branch.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A0Ye9gpzwKLkK3-lAjwDYw.png" /></figure><p>By following these steps, you’ll have successfully linked Xcode Cloud to your repository, ready to manage workflows and run automated builds!</p><p><strong><em>View Build Details:</em></strong></p><p>After the build, review the details, including the commit message, the macOS/Xcode versions used, and any error logs if the build failed. If successful, you’ll see the complete build history with relevant details.</p><p><strong><em>When a build is completed, Xcode Cloud:</em></strong></p><ul><li><strong>Sends an email</strong> with key details about the build, including direct links to the build report in both Xcode and App Store Connect.</li><li><strong>Stores the build artifacts</strong> and makes them available for download via Xcode or App Store Connect.</li></ul><p><strong><em>The artifacts generated by Xcode Cloud include:</em></strong></p><ul><li>Comprehensive <strong>build logs</strong></li><li>The <strong>exported app archive</strong>, app binary, or framework</li><li>A <strong>test result bundle</strong>, which also contains any screenshots from your automated UI tests</li></ul><blockquote><strong>Note:</strong> Build information and artifacts are accessible for 30 days after Xcode Cloud finishes the build. For workflows that publish apps to the App Store, be sure to download and archive the artifacts to retain them permanently.</blockquote><h4><strong>2. Setting up Automating Testing with Xcode Cloud</strong></h4><p>Running automated tests, including Unit Tests and UI Tests, is essential to ensure that your code remains stable, especially when working on the main branch. Xcode Cloud can help you automate this process by running tests every time code changes are pushed, freeing up your local machine for other tasks.</p><p><strong><em>Edit the default workflow for Run Tests:</em></strong></p><p>Here’s how you can set up an automated testing workflow using Xcode Cloud:</p><ul><li><strong>Access the Workflow:</strong></li></ul><p>a). Go to the Report Navigator in Xcode.</p><p>b). Right-click on the existing <strong>Default Workflow</strong> and select <strong>Edit Workflow</strong>. This is the workflow you set up earlier for building your project.</p><ul><li><strong>Modify the Workflow for Testing:</strong></li></ul><p>a). Once in the <strong>Edit Workflow</strong> window, you’ll configure the workflow specifically for running tests.</p><p>b). Start by navigating to the <strong>General</strong> section and changing the <strong>Name</strong> of the workflow to something like “Test” to clearly identify it.</p><ul><li><strong>Remove the Archive Action:</strong></li></ul><p>a). Since the focus here is testing, you don’t need the archive action from the build workflow. Head to the <strong>Actions</strong> section, locate the <strong>Archive — iOS</strong> action, and remove it by clicking the trash icon.</p><ul><li><strong>Add the Test Action:</strong></li></ul><p>a). Now, add a new <strong>Test</strong> action by clicking the <strong>+</strong> next to the <strong>Actions</strong> title and selecting <strong>Test</strong> from the options.</p><p>b). In the <strong>Test</strong> action settings, configure the following:</p><p><strong>Platform</strong>: Specify which platform(s) the tests will run on. You can add multiple platforms if necessary.</p><p><strong>Scheme</strong>: Choose the scheme associated with your tests.</p><p><strong>Requirement</strong>: Ensure that the tests are required to pass by selecting <strong>Required to Pass</strong>. This means the workflow will fail if any tests fail.</p><p><strong>Devices</strong>: Add the specific devices, like iPhones or iPads, on which you want the tests to run. You can add devices by clicking the <strong>+</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mS6u13o0bdZzo-MZOuww-g.png" /></figure><ul><li><strong>Save the Workflow:</strong></li></ul><p>a). After setting up the test configuration, click <strong>Save</strong> to finalize the changes. Your new test workflow is now ready to run.</p><p><strong><em>Running the Test Workflow:</em></strong></p><p>Once you’ve set up the automated testing workflow, you’ll want to verify that everything works correctly.</p><ul><li><strong>Manually Start the Workflow:</strong></li></ul><p>a). Go to the <strong>Report Navigator</strong> and switch to the <strong>Cloud</strong> tab.</p><p>b). Right-click on the main branch and select <strong>Start Build</strong> to manually trigger the new <strong>Test</strong> workflow.</p><p>c). Confirm by selecting <strong>Start</strong> if prompted by Xcode.</p><ul><li><strong>Monitor the Build Process:</strong></li></ul><p>a). Xcode will display the build progress and details in the build overview. The tests will be executed on Apple’s build servers, running on various iPhone and iPad devices.</p><p>b). This may take a few minutes to complete, depending on the complexity of your tests.</p><ul><li><strong>Automatic Workflow Trigger:</strong></li></ul><p>a). Once everything is set up, Xcode Cloud will automatically run the tests whenever you commit and push changes to the main branch. This ensures that every code update is thoroughly tested, preventing potential issues from reaching production.</p><p>By automating your test workflows with Xcode Cloud, you’ll maintain high code quality without having to manually run tests every time a change is made.</p><h4>3. Building and Distributing the App to TestFlight Using Xcode Cloud</h4><p>Distributing your app to testers via TestFlight is a key part of the development process. Xcode Cloud simplifies this by automating the process of building and deploying the app to internal testers whenever you push changes to your main branch.</p><p>Here’s how to set up a workflow for building and distributing your app to TestFlight using Xcode Cloud:</p><p><strong><em>Create a New Workflow:</em></strong></p><ul><li>Open <strong>Xcode</strong> and navigate to the <strong>Report Navigator</strong>.</li><li>Click on the <strong>Cloud</strong> tab to access your workflows.</li><li>To create a new workflow for TestFlight, click the <strong>circle </strong>button at the bottom left and select <strong>Create Workflow</strong>.</li><li>Choose the app product that you want to build and distribute, then click <strong>Next</strong>.</li></ul><p><strong><em>Configure the Workflow:</em></strong></p><ul><li>First, give your workflow a descriptive name, like “TestFlight”.</li><li>Check the <strong>Restrict Editing</strong> box to ensure that only authorized users can edit this workflow. Apple requires this for workflows that involve external distribution.</li></ul><p><strong><em>Add an Archive Action:</em></strong></p><ul><li>In the <strong>Actions</strong> section, click the <strong>+</strong> button and select <strong>Archive</strong>.</li><li>By default, the <strong>Platform</strong> is set to iOS, and the <strong>Scheme</strong> will be automatically set to your app’s scheme (for example, “Coffee”).</li><li>For <strong>Deployment Preparation</strong>, select <strong>TestFlight (Internal Testing Only)</strong>. This ensures the build is prepared for internal testers.</li></ul><p><strong><em>Set Up Post-Actions for TestFlight:</em></strong></p><ul><li>After adding the archive action, create a <strong>Post-Actions</strong> step. Click the <strong>+</strong> next to <strong>Post-Actions</strong> and choose <strong>TestFlight Internal Testing</strong>.</li><li>You’ll notice a red X next to the post-action, indicating that no tester groups have been assigned yet.</li><li>To fix this, click the <strong>+</strong> under the <strong>Groups</strong> section and select your internal tester group.</li><li>Once your internal testers group is added, the red X will disappear, indicating that the setup is correct.</li></ul><p><strong><em>Save the Workflow:</em></strong></p><ul><li>After configuring all the steps, click <strong>Save</strong> to complete the workflow setup. This workflow will now automatically distribute a build to your internal testers on TestFlight every time you push changes to the main branch.</li></ul><p><strong><em>Manually Run the Workflow:</em></strong></p><ul><li>You can manually trigger the workflow to test it. Right-click the newly created <strong>TestFlight</strong> workflow and select <strong>Start Build</strong>.</li><li>You will be prompted to select a branch. If needed, switch the filter from <strong>Mine</strong> to <strong>All</strong> to display all available branches.</li><li>Select the <strong>main</strong> branch and click <strong>Start Build</strong>.</li></ul><p><strong><em>Receive the TestFlight Invite:</em></strong></p><ul><li>Once Xcode Cloud finishes building and distributing the app, TestFlight will send an email invitation to your internal testers.</li><li>Testers can then accept the invitation and install the latest version of your app through TestFlight.</li></ul><p>With this workflow in place, distributing new builds to your internal testers is effortless. Xcode Cloud handles the heavy lifting, allowing you to focus on refining and improving your app.</p><h4>Practical Applications of Xcode Cloud</h4><p><strong><em>Case Study 1: Startups</em></strong></p><p>For startups with limited resources, Xcode Cloud provides a cost-effective way to manage CI/CD processes without needing extensive infrastructure. By automating builds and tests, startups can release features faster while maintaining code quality.</p><p><strong><em>Case Study 2: Large Enterprises</em></strong></p><p>Large teams benefit from Xcode Cloud’s collaborative features by sharing build results and test reports across departments. This transparency helps align efforts and fosters better communication within teams working on complex projects.</p><p><strong><em>Case Study 3: Remote Teams</em></strong></p><p>With remote work becoming more common, Xcode Cloud allows distributed teams to collaborate effectively by providing a shared environment for development, testing, and deployment. Team members can access build results from anywhere, ensuring everyone stays in sync.</p><h4>Key Advantages of Xcode Cloud</h4><ul><li><strong>Enhanced Productivity</strong>: Automating repetitive tasks frees up developers’ time for more critical coding activities.</li><li><strong>Improved Code Quality</strong>: Continuous testing helps catch bugs early in the development cycle, leading to higher-quality applications.</li><li><strong>Faster Time-to-Market</strong>: Streamlined workflows allow teams to release updates more frequently without sacrificing quality.</li><li><strong>Scalability</strong>: The cloud infrastructure enables teams to scale their operations easily as their needs grow.</li><li><strong>Collaboration</strong>: Built-in tools facilitate better communication among team members, ensuring everyone is informed about project statuses.</li></ul><h4>Xcode Cloud Pricing Overview</h4><p>Apple’s Xcode Cloud offers a flexible pricing structure designed to meet the needs of developers at various stages of their projects. This subscription model allows teams to choose the plan that best fits their workload and budget, ensuring they have the necessary resources for continuous integration and delivery. Here’s a detailed breakdown of the current pricing options available for Xcode Cloud:</p><ul><li><strong>Free Tier</strong>: Starting January 2024, all Apple Developer Program members will receive 25 compute hours per month at no additional cost. This introductory offer allows developers to explore Xcode Cloud’s capabilities without any financial commitment.</li><li><strong>Basic Plan</strong>: For those requiring more resources, the 100 compute hours per month plan is priced at $49.99. This option is ideal for small to medium-sized projects that need regular builds and testing.</li><li><strong>Standard Plan</strong>: The 250 compute hours per month plan costs $99.99. This tier caters to teams working on larger applications or those that require extensive testing across multiple device configurations.</li><li><strong>Premium Plan</strong>: For enterprises or large teams with significant development needs, the 1,000 compute hours per month plan is available for $399.99. This plan is perfect for managing multiple applications and ensuring robust CI/CD capabilities.</li></ul><h4>Conclusion</h4><p>Xcode Cloud represents a significant advancement in iOS development practices by integrating CI/CD capabilities directly into the familiar Xcode environment. By automating build processes, running tests concurrently, and simplifying distribution, it empowers developers to focus on creating exceptional applications while maintaining high standards of quality.As you consider integrating Xcode Cloud into your workflow, remember that its capabilities can transform how you approach app development — making it faster, more efficient, and ultimately more rewarding. Embrace this powerful tool today to elevate your iOS development experience!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55282a8eaeb4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aeturnuminc/unlocking-efficiency-with-xcode-cloud-integration-for-ios-development-55282a8eaeb4">Unlocking Efficiency with Xcode Cloud Integration for iOS Development</a> was originally published in <a href="https://medium.com/aeturnuminc">Aeturnum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Asynchronous and Synchronous Operations: An iOS developer’s guide]]></title>
            <link>https://medium.com/aeturnuminc/asynchronous-and-synchronous-operations-an-ios-developers-guide-07700e44febd?source=rss----13bbb68d98b0---4</link>
            <guid isPermaLink="false">https://medium.com/p/07700e44febd</guid>
            <dc:creator><![CDATA[Himali Marasinghe]]></dc:creator>
            <pubDate>Thu, 01 Aug 2024 10:02:07 GMT</pubDate>
            <atom:updated>2024-08-01T10:02:07.272Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Synchronous operations:</strong> Like standing in a line at the ice cream shop, where everybody gets served in order, but it can take a while if there’s a crowd. <strong>Asynchronous operations:</strong> Like having several ice cream windows; you could order and pay at one while others are being served, and this way, you could keep the line moving and your calm cravings satisfied!</blockquote><p>As an iOS developer, it is essential to keep your app running correctly and with a responsive user interface. As of Swift 5.5, the <strong>async</strong> and <strong>await</strong> feature makes it super simple to work asynchronously. There is also a complete guide with best practices and pro tips regarding working with operations and the core differences between synchronous and asynchronous processes. Whether it is optimization for performance enhancement or optimization to smoothen the development workflow, this article will help you with the knowledge of handling async tasks effectively in Swift.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*u6haN-PEQV3PHzDCSuI_Cw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*NZtdetssfaFmmj9HOeYKLw.gif" /><figcaption>Synchronous Vs Asynchronous</figcaption></figure><h4>Understanding Synchronous vs. Asynchronous Operations</h4><p>When it comes to iOS development, it is critical to know what kind of operation is most appropriate for each task. What separates synchronous from asynchronous operation is very important if one wants their app to perform better and be more responsive.</p><p><strong>Synchronous Operations</strong></p><p>In general, synchronous operations run sequentially, blocking the main thread until they are finished. Because the sync procedure is still in progress, your application’s UI becomes unresponsive. To ensure a seamless user experience, synchronous operation can be used for short-lived operations. However, using synchronous operations for longer tasks, such as network queries or data processing, will result in a slow-moving, non-responsive app.</p><pre>func performSynchronousTask() {<br>    for i in 1...5 {<br>        print(&quot;Synchronous task: \(i)&quot;)<br>        // Simulate a time-consuming task<br>        Thread.sleep(forTimeInterval: 1)<br>    }<br>}</pre><pre>Synchronous task: 1<br>Synchronous task: 2<br>Synchronous task: 3<br>Synchronous task: 4<br>Synchronous task: 5</pre><p><strong>Keeping Your App Responsive: Asynchronous Operations in Swift</strong></p><p>On the other hand, Asynchronous operations run concurrently and do not block the main thread. This way, your app remains responsive, running other tasks in the background. Some of the activities that can be performed using an asynchronous operation are: Downloading files or images, Upload content, and Performing lengthy running operations.</p><p>Swift features and tools help you to handle async operations well. Now let’s have a look at some examples for GCD, Combine, and the newly introduced async/await syntax of Swift 5.5.</p><p><strong>Grand Central Dispatch (GCD)</strong></p><p>GCD provides a powerful mechanism for handling concurrent tasks through queues (<strong>serial</strong> and <strong>concurrent</strong>) and <strong>dispatch groups</strong>. You can use it to schedule multiple asynchronous operations on different queues while ensuring the efficient use of system resources.</p><p><strong>Example using GCD:</strong></p><pre>func downloadImageWithGCD(imageUrl: String, completion: @escaping (UIImage?, Error?) -&gt; Void) {<br>    DispatchQueue.global().async {<br>        guard let url = URL(string: imageUrl) else {<br>            completion(nil, NSError(domain: &quot;Invalid URL&quot;, code: 1, userInfo: nil))<br>            return<br>        }<br><br>        do {<br>            let data = try Data(contentsOf: url)<br>            let image = UIImage(data: data)<br>            completion(image, nil)<br>        } catch {<br>            completion(nil, error)<br>        }<br>    }<br>}</pre><pre>// Example image URL<br>let imageUrl = &quot;https://example.com/image.jpg&quot;<br><br>// Call the function<br>downloadImageWithGCD(imageUrl: imageUrl) { image, error in<br>    DispatchQueue.main.async {<br>        if let error = error {<br>            // Handle the error<br>            print(&quot;Failed to download image: \(error.localizedDescription)&quot;)<br>        } else if let image = image {<br>            // Handle the downloaded image<br>            print(&quot;Image downloaded successfully&quot;)<br>            // For example, you can display the image in an UIImageView<br>            imageView.image = image<br>        } else {<br>            // Handle the case where image is nil without an error<br>            print(&quot;Image is nil, but no error occurred&quot;)<br>        }<br>    }<br>}</pre><p><strong>Combine Framework</strong></p><p>Combine was introduced in Swift 5 as a declarative framework for handling asynchronous events using <strong>publishers</strong> and <strong>subscribers</strong>, where publishers encapsulate a data stream, and subscribers show interest in receiving that stream. This framework makes it easier to manage asynchronous events and error conditions.</p><p><strong>Example using Combine:</strong></p><pre>import Combine<br>import UIKit<br><br>func downloadImageWithCombine(imageUrl: String) -&gt; AnyPublisher&lt;UIImage, Error&gt; {<br>    return URLSession.shared.dataTaskPublisher(for: URL(string: imageUrl)!)<br>        .tryMap { data, _ in<br>            guard let image = UIImage(data: data) else {<br>                throw NSError(domain: &quot;Image Conversion Error&quot;, code: 2, userInfo: nil)<br>            }<br>            return image<br>        }<br>        .eraseToAnyPublisher()<br>}<br><br>var cancellable: AnyCancellable?<br><br>func fetchImage() {<br>    let imageUrl = &quot;https://example.com/image.jpg&quot; <br>    cancellable = downloadImageWithCombine(imageUrl: imageUrl)<br>        .sink(receiveCompletion: { completion in<br>            switch completion {<br>            case .finished:<br>                print(&quot;Image download completed.&quot;)<br>            case .failure(let error):<br>                print(&quot;Error downloading image: \(error)&quot;)<br>            }<br>        }, receiveValue: { image in<br>            // Use the image (e.g., set it to an UIImageView)<br>            DispatchQueue.main.async {<br>                imageView.image = image<br>            }<br>        })<br>}</pre><p><strong>Async/Await (Swift 5.5 and above)</strong></p><p>This type of syntactic sugar significantly improves the readability of programming with asynchronous operations and reduces error probability in code. An <strong>async </strong>labeled function declares that the operation is carried out asynchronously, whereas the <strong>await</strong> keyword pauses execution until some asynchronous operation is completed.</p><p><strong>Example using Async/ Await:</strong></p><pre>func downloadImageWithAsyncAwait(imageUrl: String) async throws -&gt; UIImage {<br>    guard let url = URL(string: imageUrl) else {<br>        throw URLError(.badURL)<br>    }<br>    let (data, _) = try await URLSession.shared.data(from: url)<br>    guard let image = UIImage(data: data) else {<br>        throw NSError(domain: &quot;Image Conversion Error&quot;, code: 2, userInfo: nil)<br>    }<br>    return image<br>}<br><br>func fetchImage() {<br>    Task {<br>        do {<br>            let imageUrl = &quot;https://example.com/image.png&quot;<br>            let image = try await downloadImageWithAsyncAwait(imageUrl: imageUrl)<br>            // Update UI with the downloaded image<br>            DispatchQueue.main.async {<br>                imageView.image = image<br>            }<br>        } catch {<br>            print(&quot;Failed to download image: \(error)&quot;)<br>        }<br>    }<br>}</pre><p><strong>Managing Concurrent Tasks with Task and TaskGroup</strong></p><p>Swift’s async/await syntax provides a powerful way to write asynchronous code. But what if you need to manage multiple concurrent asynchronous tasks? That’s where <strong>Task</strong> and <strong>TaskGroup</strong> come in.</p><p><strong>Concurrent Image Downloads:</strong></p><pre>import UIKit<br><br>func downloadImagesWithTaskGroup(imageUrls: [String]) async throws -&gt; [UIImage] {<br>    return try await withThrowingTaskGroup(of: UIImage.self) { group in<br>        var images: [UIImage] = []<br><br>        for imageUrl in imageUrls {<br>            group.addTask {<br>                guard let url = URL(string: imageUrl) else {<br>                    throw URLError(.badURL)<br>                }<br>                let (data, _) = try await URLSession.shared.data(from: url)<br>                guard let image = UIImage(data: data) else {<br>                    throw NSError(domain: &quot;Image Conversion Error&quot;, code: 2, userInfo: nil)<br>                }<br>                return image<br>            }<br>        }<br><br>        // Wait for all tasks to finish<br>        for try await image in group {<br>            images.append(image)<br>        }<br><br>        return images<br>    }<br>}<br><br>func fetchImages() {<br>    let imageUrls = [<br>        &quot;https://example.com/image1.png&quot;,<br>        &quot;https://example.com/image2.png&quot;,<br>        &quot;https://example.com/image3.png&quot;<br>    ]<br><br>    let task = Task {<br>        do {<br>            let images = try await downloadImagesWithTaskGroup(imageUrls: imageUrls)<br>            // Update UI with the downloaded images<br>            DispatchQueue.main.async {<br>                imageView1.image = images[0]<br>                imageView2.image = images[1]<br>                imageView3.image = images[2]<br>            }<br>        } catch {<br>            print(&quot;Failed to download images: \(error)&quot;)<br>        }<br>    }<br><br>   // Cancel the task group if needed<br>    task.cancel()<br>}</pre><p><strong>Benefits of TaskGroup:</strong></p><ul><li><strong>Error Handling:</strong> You may centrally manage all errors that have occurred in any of the group’s tasks.</li><li><strong>Cancellation:</strong> All group tasks can be simply cancelled if necessary.</li><li><strong>Coordination:</strong> TaskGroup enables you to wait for all tasks to complete or to retrieve results as they become available.</li></ul><p><strong>Use Cases for TaskGroup:</strong></p><ul><li>Downloading multiple files concurrently.</li><li>Making concurrent multiple network requests.</li><li>Performing independent background processing tasks.</li></ul><p><strong>Actors in Swift: A Safe Haven for Shared State</strong></p><p>Swift <strong>actors</strong> help manage and synchronize access to shared data in Swift, ensuring only one piece of code interacts with the data at a time. This prevents race conditions and makes writing safe, concurrent code easier.</p><p>The use of Swift <strong>actors</strong> in combination with <strong>async/await</strong> provides additional benefits beyond what <strong>async/await</strong> alone can offer.</p><p><strong>Example of Using Actors with Async/Await:</strong></p><pre>actor ImageDownloader {<br>    private var cachedImages: [URL: UIImage] = [:]<br><br>    func downloadImage(from url: URL) async throws -&gt; UIImage? {<br>        if let cachedImage = cachedImages[url] {<br>            return cachedImage<br>        }<br><br>        let (data, response) = try await URLSession.shared.data(from: url)<br>        <br>        guard (response as? HTTPURLResponse)?.statusCode == 200 else {<br>            return nil<br>        }<br><br>        let image = UIImage(data: data)<br>        cachedImages[url] = image<br>        return image<br>    }<br>}<br><br>// Create an instance of ImageDownloader actor<br>let imageDownloader = ImageDownloader()<br><br>// Start downloading the image<br>Task {<br>    do {<br>        if let image = try await imageDownloader.downloadImage(from: someURL) {<br>            // Update the UI on the main thread<br>            await MainActor.run {<br>                imageView.image = image<br>            }<br>        } else {<br>            print(&quot;Failed to download image&quot;)<br>        }<br>    } catch {<br>        print(&quot;Error downloading image: \(error)&quot;)<br>    }<br>}</pre><p>While async/await makes asynchronous programming easier to read and write, Swift actors add extra safety and simplicity by managing concurrency and protecting shared data. The key benefits are,</p><ul><li><strong>Data Safety</strong>: Prevents race conditions.</li><li><strong>Simplified Concurrency</strong>: Easier async code management.</li><li><strong>Clean Code</strong>: Less error-prone and more maintainable.</li></ul><p>Each of this tool has its own way to manage the asynchronous tasks and you can choose your best that fulfill your requirements. Swift can be efficient at async by design, whether you like <strong>async/await</strong> for its simplicity, <strong>Combine</strong> for its declarative nature, <strong>GCD</strong> for its flexibility or <strong>Task and Task Group</strong> for structured concurrency, or Swift <strong>Actors</strong> for managing concurrency and protecting shared data.</p><h4>Conclusion</h4><p>Asynchronous and synchronous operations are the most basic building blocks for all iOS developers. With the introduction of powerful concepts, such as Async/Await and TaskGroup, Swift takes another massive step toward advanced, efficient ways of handling parallel activities. Stay one step ahead with other growing capabilities and continue building innovative and performant iOS apps!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=07700e44febd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aeturnuminc/asynchronous-and-synchronous-operations-an-ios-developers-guide-07700e44febd">Asynchronous and Synchronous Operations: An iOS developer’s guide</a> was originally published in <a href="https://medium.com/aeturnuminc">Aeturnum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Google Cloud Translation Service with a Spring Boot Application]]></title>
            <link>https://medium.com/aeturnuminc/integrating-google-cloud-translation-service-with-a-spring-boot-application-b53a159b6246?source=rss----13bbb68d98b0---4</link>
            <guid isPermaLink="false">https://medium.com/p/b53a159b6246</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[google-cloud]]></category>
            <category><![CDATA[translation-services]]></category>
            <category><![CDATA[intergration]]></category>
            <dc:creator><![CDATA[Ishara Perera]]></dc:creator>
            <pubDate>Wed, 03 Jul 2024 10:23:32 GMT</pubDate>
            <atom:updated>2024-07-03T10:23:32.556Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g022Y1cjekSGtI33YKe3cA.jpeg" /></figure><p>In today’s globalized world, providing content in multiple languages can significantly enhance user engagement and accessibility. Integrating language translation services into your applications can streamline this process. This article will walk you through the steps to integrate the Google Cloud Translation API with a Spring Boot application, enabling you to translate text dynamically within your app.</p><h3>Why <strong>Google Cloud Translation?</strong></h3><p>Google Translation Service is a powerful tool that provides extensive features to meet various translation needs. Its integration capabilities, support for numerous languages, advanced neural machine translation, and customization options make it an ideal choice for developers and businesses looking to add translation functionalities to their applications.</p><p>While Google Translate is a popular and powerful translation service, there are several other competitive services available that offer unique features and capabilities. Some of them are</p><ul><li>Microsoft Translator</li><li>Amazon Translate</li><li>IBM Watson Language Translator</li><li>DeepL Translator</li><li>SYSTRAN</li><li>SDL Language Cloud</li></ul><p>Google Translation Service stands out from other translation services for several reasons.</p><ul><li><strong>Real-Time Translation</strong> — <em>Instantly translate text between languages with high accuracy</em></li><li><strong>Extensive Language Support </strong>— <em>Supports over 100 languages, covering most of the world’s widely spoken languages</em></li><li><strong>Advanced Neural Machine Translation (NMT) </strong>— <em>Google uses state-of-the-art Neural Machine Translation models, which provide more accurate and fluent translations compared to traditional phrase-based translation models</em></li><li><strong>Integration and Accessibility</strong> —<em> Provides RESTful APIs, SDKs for different programming languages</em></li><li><strong>Security and Compliance</strong> — <em>Ensures that your data is handled securely and in compliance with global data protection regulations</em></li><li><strong>Ease of Use — </strong><em>Extensive documentation and tutorials</em></li></ul><h3>Let’s start</h3><p>In this article, I will demonstrate the <strong><em>minimal </em></strong>steps needed to get the project up and running in the following areas. You can add additional features and configurations to the Spring Boot application and the Google Cloud project later.</p><ol><li><strong>Google Cloud Translation API Setup</strong><br><em>This setup involves creating a new project in the Google Cloud Console, enabling the Translation API, and generating the necessary API credentials</em></li><li><strong>Spring Boot Project Setup</strong><br><em>Configure Spring Boot by setting up a new Spring Boot project, adding the required dependencies, and configuring the application properties</em></li><li><strong>Integrating Google Cloud Translation Service</strong><br><em>Writing a service to interact with the Translation API and creating REST endpoints for translation requests</em></li><li><strong>Running the Application</strong><br><em>Guide to running the Spring Boot application</em></li><li><strong>Testing</strong><br><em>Demonstrating how to test the application with Postman</em></li></ol><h3>Google Cloud Translation API Setup</h3><p>We’ll start by setting up Google Cloud Project.</p><ul><li>Go to the Google Cloud Console: Visit <a href="https://console.cloud.google.com/"><strong>Google Cloud Console</strong></a></li><li>Click on the project dropdown in the top menu and select “<strong>New Project</strong>”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*1UI5LubCByd2Y5Y0ie56sg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*3NS6r8y_vG4vXUsTo5UVeg.png" /></figure><ul><li>Enter a desired name for your project and click “<strong>Create</strong>”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*YpYrTkr18EJoiA1dNmqrJw.png" /></figure><p>Next, we need to enable the Translation API. To do this, enter “Cloud Translation API” in the search box and select that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*v_DLpC6NN3N3G-KoqUQMmw.png" /></figure><p>Then, enable this service. Once enabled, it will appear under “<strong>Enabled APIs &amp; Services</strong>” in your console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*W1kgRX6DWDdaMprgJ-IVfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*eVjkk0y7Fin5_wFNaF0gCw.png" /></figure><p>After enabling the service, you’ll need credentials to utilize it. We’ll proceed by creating new credentials specifically for this service.</p><ul><li>In the left-hand menu, select the “<strong>Credentials</strong>” option and it will navigate you to the credentials page</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*Zxk2H1OPFGEERSI9NEdWAg.png" /></figure><ul><li>Click on the “Create Credentials” button at the top. Then select “<strong>Service account</strong>” from the dropdown menu</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*uVSjEttqG4t2HdETYXvG9Q.png" /></figure><ul><li>Next, provide a service account name and press “<strong>CREATE AND CONTINUE</strong>”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*LP8kaGeVaNx7fWOLzJnTwQ.png" /></figure><ul><li>After that select “<strong>Cloud Translation API User</strong>” as the role option and complete the flow by pressing “<strong>Done</strong>”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*45_LJpb-PbIQaphmW_ICFQ.png" /></figure><ul><li>Upon completion, the created service account should be visible on the “<strong>Service Accounts</strong>” page as depicted below</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*RtxLGqywq8b4jsUNZmjOoA.png" /></figure><ul><li>To create a key for the newly created service account, navigate to the “<strong>Manage keys</strong>” option from the “<strong>Actions</strong>” menu.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*r7Xz2oNZJyi0GlFCXTZerA.png" /></figure><ul><li>Proceed by selecting the “Create new key” option from the “ADD KEY” dropdown menu. Then, choose the “JSON” option and click “CREATE”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*EApUDqb81_gNkRvMYZXBEQ.png" /></figure><ul><li>Finally, the newly created private key will be downloaded to your device. Remember to keep it safe as it will be used to facilitate communication between your Java application and the Google Cloud Translate service.</li></ul><p><strong><em>Sample key structure</em></strong></p><pre>{<br>  &quot;type&quot;: &quot;service_account&quot;,<br>  &quot;project_id&quot;: &quot;***************-*****&quot;,<br>  &quot;private_key_id&quot;: &quot;********************&quot;,<br>  &quot;private_key&quot;: &quot;*************************&quot;,<br>  &quot;client_email&quot;: &quot;**********@*****-*****.*****.*****.com&quot;,<br>  &quot;client_id&quot;: &quot;***************&quot;,<br>  &quot;auth_uri&quot;: &quot;https://accounts.google.com/o/oauth2/auth&quot;,<br>  &quot;token_uri&quot;: &quot;https://oauth2.googleapis.com/token&quot;,<br>  &quot;auth_provider_x509_cert_url&quot;: &quot;https://www.googleapis.com/oauth2/v1/certs&quot;,<br>  &quot;client_x509_cert_url&quot;: &quot;https://www.googleapis.com/robot/v1/metadata/x509/*************************-*****.*****.*****.com&quot;,<br>  &quot;universe_domain&quot;: &quot;googleapis.com&quot;<br>}</pre><h3>Spring Boot Project Setup</h3><p>In this section, I will walk you through configuring a Spring Boot application to integrate with the Google Cloud Translation API. Follow these steps to set up your project, add the necessary dependencies, and configure the application properties.</p><p>In this example, I will use<a href="https://start.spring.io/"> Spring Initializr</a> to set up the Spring Boot project, Gradle as the build tool, and IntelliJ Community Edition as the IDE. You can use any Java-supported IDE you are comfortable with, such as Spring Tools Suite (STS), Eclipse, Visual Studio Code (VS Code), NetBeans, etc.</p><p>Follow these steps to create a new Spring Boot application.</p><p>1 . Go to <a href="https://start.spring.io/">https://start.spring.io/</a></p><p>2 . Fill in the project details</p><ul><li><em>Project</em>: <strong>Gradle</strong></li><li><em>Language</em>: <strong>Java</strong></li><li><em>Spring Boot Version</em>: <strong>3.3.0</strong> (or select a stable version at the project creation time)</li><li><em>Group</em>: organization’s domain name in reverse</li><li><em>Artifact</em>: Name of your project</li><li><em>Name</em>: A user-friendly name for your application</li><li><em>Description</em>: A summary of what your project is about</li><li><em>Package Name</em>: Auto-generated based on your group and artifact, but you can customize it if needed</li><li><em>Packaging</em>: <strong>Jar</strong></li><li><em>Java version</em>: <strong>17</strong></li></ul><p>3 . <em>Add the following Dependencies</em></p><ul><li><strong>Spring Web</strong></li><li><strong>Lombok</strong></li></ul><p>4 . Press the “<strong>GENERATE</strong>” button and it will download a ZIP file containing your new Spring Boot project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zWI2bbx939iaQ3rGclfxLg.png" /></figure><p>5 . Extract the contents of the ZIP file to your project directory, and then open it from IntelliJ IDEA.</p><p>Once you’ve opened the project in IntelliJ IDEA, ensure the following configurations are set correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*CeEtEvURtavfS_jGSMb2xQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*acq5VgBj34PK-8zt8GWeOQ.png" /><figcaption>File -&gt; Project Structure -&gt; Project Settings -&gt; Project</figcaption></figure><h3>Integrating Google Cloud Translation Service</h3><p>Follow these steps to integrate the Google Cloud Translation API into your newly created Spring Boot application.</p><ul><li>First, you have to add the dependency for the Google Cloud Translation API client library. Open “<em>build.gradle</em>” and add the following. (<em>Make sure to use the latest version available</em>)</li></ul><pre>implementation group: &#39;com.google.cloud&#39;, name: &#39;google-cloud-translate&#39;, version: &#39;2.43.0&#39;</pre><ul><li>Next, include the following dependency to enable validation.</li></ul><pre>implementation &#39;org.springframework.boot:spring-boot-starter-validation&#39;</pre><ul><li>Next, you’ll need to add the Google Cloud Service configurations to your project. To do this, include the following properties in the “<em>application.properties</em>” file located in the “<em>src/main/resources</em>” directory.</li></ul><pre>google.cloud.project-id=your-project-id<br>google.cloud.credentials.location=file:/path/to/your-service-account-file.json</pre><p>Replace “<strong>your-project-id”</strong> with your actual Google Cloud project ID. This information can be found in the JSON file (private key) you created at the beginning of this article.<br>Replace “<strong>/path/to/your-service-account-file.json</strong>” with the path to your downloaded service account JSON file (private key).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DoqdVi3zvPAIwyHE5exbJw.png" /></figure><ul><li>Then we need to create REST endpoints to expose translation functionality. Therefore, we will implement two controller methods responsible for handling incoming translation requests and delegating them to the translation service for processing. Please refer “<a href="https://github.com/isharadilukshaperera/language-translation-demo/blob/main/src/main/java/com/example/language_translation_demo/controller/LanguageUtilityController.java"><strong><em>LanguageUtilityController.java</em></strong></a><strong>”</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*Z5gFjkVlBjWMZyX5Bygziw.png" /></figure><ul><li>Next, we need a service class to interact with the Google Cloud Translation API. This class will contain methods to translate text from one language to another and to detect the language of a given text. This service class will utilize a “<em>TranslationServiceClient</em>” for accessing Google Cloud Translation services with the specified credentials. Please refer “<strong><em>GoogleCloudTranslateCredentialsProvider.java</em></strong><em>”</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*OcUoBk_nHFRn5xCfiK1UzA.png" /></figure><ul><li>All necessary source code for the examples discussed in this article can be found in the following repository.</li></ul><p><a href="https://github.com/isharadilukshaperera/language-translation-demo">GitHub</a></p><h3><strong>Running the Application</strong></h3><p>Running a Spring Boot application can be done in a few simple steps, whether you’re using an IDE or the command line.</p><h4>Using an IDE</h4><p>1 . <strong>STS (Spring Tool Suite)</strong></p><ul><li>Import the project as a Gradle project.</li><li>Locate the main application class (<em>LanguageTranslationDemoApplication</em>).</li><li>Right-click on the class and select <strong><em>Run As -&gt; Java Application</em></strong>.</li></ul><p>2 . <strong>IntelliJ IDEA</strong></p><ul><li>Open the project.</li><li>Locate the main application class.</li><li>Right-click on the class and select <br><strong><em>Run ‘LanguageTranslationDemoApplication’</em></strong>.</li></ul><h4>Using Command Line</h4><ul><li>Gradle- Navigate to the root directory of your project (where the <strong><em>build.gradle</em></strong> file is located) and run the following command.</li></ul><pre>./gradlew bootRun</pre><p>Alternatively, you can package your application into a JAR file and run it.</p><pre>./gradlew build<br>java -jar build/libs/demo-0.0.1-SNAPSHOT.jar</pre><p>Once the application is running, you can access it through a web browser or an API client like Postman. By default, Spring Boot runs on port 8080.</p><h3>Testing</h3><p>The “http://localhost:8080/language-service” API offers two essential endpoints: one for detecting the language of a given text and another for translating text from one language to another. By using an API development tool, you can effortlessly send requests to these endpoints and examine the responses. In this demonstration, I used Postman to send requests to a locally running instance of the Language Service API.</p><p>1 . <strong>Detect Language</strong></p><ul><li>URL: <a href="http://localhost:8080/language-service/utility/detect"><em>http://localhost:8080/language-service/utility/detect</em></a></li><li>Method: <em>POST</em></li><li>Description: <em>This endpoint accepts text input and returns the detected language</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*IN4YB7qKLO59_dK2tzfPgQ.png" /></figure><p>2 . <strong>Translate Text</strong></p><ul><li>URL: <a href="http://localhost:8080/language-service/utility/translate"><em>http://localhost:8080/language-service/utility/translate</em></a></li><li>Method: <em>POST</em></li><li>Description: <em>This endpoint accepts text input and target language and returns the translated text.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*hqu7uBHnssX7WnshHZOWUA.png" /></figure><h3>Conclusion</h3><p>Integrating Google Translate into a Spring Boot application is straightforward and can significantly enhance the reach and usability of your application. By following the steps outlined in this article, you can quickly add powerful translation capabilities to your Spring Boot project. Remember to handle the API keys and credentials securely and adhere to best practices for security and privacy.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b53a159b6246" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aeturnuminc/integrating-google-cloud-translation-service-with-a-spring-boot-application-b53a159b6246">Integrating Google Cloud Translation Service with a Spring Boot Application</a> was originally published in <a href="https://medium.com/aeturnuminc">Aeturnum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Authentication Service using Microsoft ASP.NET Core Identity and .NET 8]]></title>
            <link>https://medium.com/aeturnuminc/building-authentication-service-using-microsoft-asp-net-core-identity-and-net-8-3fea53cfe0f8?source=rss----13bbb68d98b0---4</link>
            <guid isPermaLink="false">https://medium.com/p/3fea53cfe0f8</guid>
            <category><![CDATA[microsoftidentity]]></category>
            <category><![CDATA[identity-endpoints]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[aspnet-core-web-api]]></category>
            <category><![CDATA[authorization]]></category>
            <dc:creator><![CDATA[Chamara Madushanka Dodandeniya]]></dc:creator>
            <pubDate>Thu, 06 Jun 2024 07:47:22 GMT</pubDate>
            <atom:updated>2024-06-06T07:47:22.689Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Authentication Service using Microsoft ASP.NET Core Identity and .NET 8</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gDAtlCUgpq4eAgow5pjnLw.png" /></figure><p>Microsoft Identity is a powerful feature that comes with the .NET framework and .NET Core packages. It allows developers to enable complete user login flows with ASP.NET web UI interfaces. However, the biggest disadvantage was the dependency on the ASP.NET web interfaces for the UIs and the difficulties in implementing SPA applications with custom login flows. With the introduction of .NET 8, Microsoft has addressed this issue by introducing ASP.NET Core Identity APIs, which provide a more robust and secure web API backend for SPAs. In this article, we will discuss what ASP.NET Core Identity is, the issues with the new Identity APIs, and how to integrate it step-by-step while customizing Identity APIs.</p><h3>What is ASP.NET Core Identity?</h3><p>In simple terms, <a href="https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity-api-authorization?view=aspnetcore-8.0">ASP.NET Core Identity</a> is a NuGet library provided by Microsoft, which enables a set of APIs that handle authentication, authorization, and identity management. These APIs can be used to secure backend endpoints using either cookie-based authentication or token-based authentication.</p><p>ASP.Net Core Identity provides the following key features</p><ol><li>User authentication and authorization</li><li>User and role management</li><li>Password hashing</li><li>Two-Factor Authentication (2FA)</li><li>Claims-Based Authorization</li></ol><h3>Limitations of ASP.NET Core Identity</h3><p>Even though it provides powerful APIs, the biggest issue is customizing the endpoints. Hopefully, this will be fixed in an upcoming .NET release or later. Until then, this article will discuss how we can extend the existing endpoints provided by ASP.NET Core Identity.</p><p>Additionally, the access token provided by this library is not configured for JWT access tokens. Hence, if you are trying to use it for more complex and secure systems, you must consider using OpenID Connect or a similar approach combined with ASP.NET Core Identity features for authentication.</p><h3>How to Integrate ASP.NET Core Identity Step by Step?</h3><h4>Prerequisites</h4><p>Before starting the development, ensure you have installed the following required SDKs and libraries:</p><ol><li><a href="https://dotnet.microsoft.com/en-us/download/dotnet">NET 8</a> or higher installed</li><li>EF Core installed globally (dotnet tool install — global dotnet-ef)</li><li>IDE with .Net supported ( <a href="https://visualstudio.microsoft.com/downloads/">Visual Studio</a> or <a href="https://code.visualstudio.com/Download">Visual Studio Code</a>)</li><li>Familiar with C#</li></ol><h4>Project Setup</h4><p>Let’s create a new .NET project by executing the following command in the terminal or Command Prompt. This will set up a project with Controllers template.</p><pre>dotnet new webapi -controllers -n AuthService</pre><p>Now, let’s open the project using Visual Studio or Visual Studio Code and install the required NuGet packages either using the package manager in Visual Studio or by using the terminal.</p><pre>dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore<br>dotnet add package Microsoft.EntityFrameworkCore.Sqlite<br>dotnet add package Microsoft.EntityFrameworkCore.Design<br>dotnet add package Microsoft.EntityFrameworkCore.Tools<br>dotnet add package Microsoft.AspNetCore.OpenApi</pre><p>Next, let’s create the following directories inside the project solution root level, which we will use later:</p><p><strong>Directories</strong> — Data, Dtos, Extensions, Models, Swagger</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*KT3sVxDCCra0UUj0OV-i_g.png" /><figcaption>AuthService Project Directory structure</figcaption></figure><h4>Identity Configuration Step by Step</h4><p>Now, let’s create a User.cs file under the Models directory. We will use this model class to extend the IdentityUser class provided by ASP.NET Core Identity.</p><pre>using Microsoft.AspNetCore.Identity;<br><br>namespace AuthService.Models;<br><br>public class User : IdentityUser<br>{<br><br>}</pre><p>After that, let’s add an AppDBContext.cs class under the Data folder. We will use this class to set up the database context of the AuthService. The class extends the IdentityDbContext generic class, and we pass the newly created User data type to the IdentityDbContext class.</p><pre>using AuthService.Models;<br>using Microsoft.AspNetCore.Identity.EntityFrameworkCore;<br>using Microsoft.EntityFrameworkCore;<br><br>namespace AuthService.Data;<br><br>public class AppDBContext(DbContextOptions&lt;AppDBContext&gt; options) : IdentityDbContext&lt;User&gt;(options)<br>{<br>}</pre><p>Now, let’s update the Program.cs file as follows:</p><pre>using AuthService.Data;<br>using AuthService.Models;<br>using Microsoft.AspNetCore.Identity;<br>using Microsoft.EntityFrameworkCore;<br><br>var builder = WebApplication.CreateBuilder(args);<br><br>// Add services to the container.<br><br>builder.Services.AddControllers();<br>// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle<br>builder.Services.AddEndpointsApiExplorer();<br>builder.Services.AddSwaggerGen();<br><br>// Add Authentication<br>builder.Services.AddAuthentication()<br>    .AddBearerToken(IdentityConstants.BearerScheme);<br><br><br>// Add Authorization<br>builder.Services.AddAuthorization();<br><br>// Configure DBContext<br>builder.Services.AddDbContext&lt;AppDBContext&gt;(opt =&gt; opt.UseSqlite(&quot;DataSource=appdata.db&quot;));<br><br>// Add IdentityCore<br>builder.Services<br>    .AddIdentityCore&lt;User&gt;()<br>    .AddEntityFrameworkStores&lt;AppDBContext&gt;()<br>    .AddApiEndpoints();<br><br>var app = builder.Build();<br><br>// Configure the HTTP request pipeline.<br>if (app.Environment.IsDevelopment())<br>{<br>    app.UseSwagger();<br>    app.UseSwaggerUI();<br>}<br><br>// Enable Identity APIs<br>app.MapIdentityApi&lt;User&gt;();<br><br>app.UseHttpsRedirection();<br>app.UseAuthentication();<br>app.UseAuthorization();<br><br>app.MapControllers();<br><br>app.Run();</pre><p>In the above section, you can see we have configured Authentication as a Bearer Token. Further, we have configured the Database context and used SQLite as the database. Lastly, we have enabled the default Identity APIs with app.MapIdentityApi&lt;User&gt;();.</p><p>Now, let’s perform the database migrations using Entity Framework Core by executing the following commands in the terminal. This will create the appdata.db database in the project&#39;s root directory with the initial identity tables.</p><pre>dotnet ef migrations add InitialMigrations<br>dotnet ef database update   </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JxTpP0iThomAKMThg4TJUA.png" /><figcaption>appdata.db</figcaption></figure><p>After the database migrations, you can run the app using the dotnet run command. Then, you can open the Swagger documentation in the browser by following this URL: http://localhost:{YOUR PORT NUMBER}/swagger/index.html.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lf_t_AgUrXyrzt1HCW-WuQ.png" /><figcaption>Swagger Doc with default Identity APIs</figcaption></figure><p>How simple isn’t it?</p><h4>Extend the “/register&quot; Endpoint</h4><p>If you expand the /register endpoint in the Swagger documentation, you can see it&#39;s only requesting the email and password for user registration. So, how can we extend this endpoint?</p><p>As I explained earlier, ASP.NET Core Identity does not provide a way to extend the default APIs. Therefore, we need to develop a custom extension method to extend the existing APIs.</p><p>Before that, let’s update the User.cs class by adding FirstName and LastName columns to the database.</p><pre>using Microsoft.AspNetCore.Identity;<br><br>namespace AuthService.Models;<br><br>public class User : IdentityUser<br>{<br>    public string? FirstName { get; set; }<br>    public string? LastName { get; set; }<br>}</pre><p>Now, let’s do the DB migration</p><pre>dotnet ef migrations add UpdateUserTable<br>dotnet ef database update</pre><p>After that, let’s create the CreateUserDto.cs class in the Dtos directory. This DTO class will be used for the user registration endpoint.</p><pre>namespace AuthService.Dtos.User;<br><br>public record CreateUserDto(<br>    string Email,<br>    string Password,<br>    string FirstName,<br>    string LastName<br>);</pre><p>Now, let’s create CustomIdentityApiEndpointExtensions.cs class inside the Extensions directory.</p><pre>...<br><br>namespace AuthService.Extensions;<br><br>public static class IdentityApiEndpointRouteBuilderExtensions<br>{<br>    private static readonly EmailAddressAttribute _emailAddressAttribute = new();<br><br><br>    public static IEndpointConventionBuilder CustomMapIdentityApi&lt;TUser&gt;(this IEndpointRouteBuilder endpoints)<br>        where TUser : User, new()<br>    {<br>      ...<br><br>        routeGroup.MapPost(&quot;/register&quot;, async Task&lt;Results&lt;Ok, ValidationProblem&gt;&gt;<br>            ([FromBody] CreateUserDto registration, HttpContext context, [FromServices] IServiceProvider sp) =&gt;<br>        {<br>            var userManager = sp.GetRequiredService&lt;UserManager&lt;TUser&gt;&gt;();<br><br>            if (!userManager.SupportsUserEmail)<br>            {<br>                throw new NotSupportedException($&quot;{nameof(CustomMapIdentityApi)} requires a user store with email support.&quot;);<br>            }<br><br>            var userStore = sp.GetRequiredService&lt;IUserStore&lt;TUser&gt;&gt;();<br>            var emailStore = (IUserEmailStore&lt;TUser&gt;)userStore;<br>            var email = registration.Email;<br><br>            if (string.IsNullOrEmpty(email) || !_emailAddressAttribute.IsValid(email))<br>            {<br>                return CreateValidationProblem(IdentityResult.Failed(userManager.ErrorDescriber.InvalidEmail(email)));<br>            }<br><br>            // Add customization to the Endpoint<br>            var user = new TUser{<br>                FirstName = registration.FirstName,<br>                LastName = registration.LastName<br>            };<br><br>            await userStore.SetUserNameAsync(user, email, CancellationToken.None);<br>            await emailStore.SetEmailAsync(user, email, CancellationToken.None);<br>            var result = await userManager.CreateAsync(user, registration.Password);<br><br>            if (!result.Succeeded)<br>            {<br>                return CreateValidationProblem(result);<br>            }<br><br>            await SendConfirmationEmailAsync(user, userManager, context, email);<br>            return TypedResults.Ok();<br>        });<br><br>        ...<br><br>    }<br><br>   ...<br>}</pre><p>You can find the full CustomIdentityApiEndpointExtensions.cs in the <a href="https://github.com/dodandeniya-aet/IdentityService/blob/main/Extensions/CustomIdentityApiEndpointExtensions.cs">GitHub repository</a>.</p><p>Now, you need to update the Program.cs file to use the custom identity endpoint extension we have created.</p><pre>...<br><br>// Enable Identity APIs<br>app.CustomMapIdentityApi&lt;User&gt;();<br><br>...</pre><h4>Add “/logout” Endpoint</h4><p>In the default Identity APIs, you cannot find any /logout endpoint. Let&#39;s add a logout endpoint to the extensions method. <strong>Note that</strong> currently, this only supports Cookie authentication.</p><p>First, let’s update the Program.cs file to support cookie authentication.</p><pre>...<br>// Add Authentication<br>builder.Services.AddAuthentication()<br>    .AddCookie(IdentityConstants.ApplicationScheme);<br>...</pre><p>Next, let’s define the /logout endpoint in the extensions method.</p><pre>...<br> routeGroup.MapPost(&quot;/logout&quot;, async Task&lt;IResult&gt; ([FromServices] IServiceProvider sp, [FromBody] object empty) =&gt; {<br>            var signInManager = sp.GetRequiredService&lt;SignInManager&lt;TUser&gt;&gt;();<br><br>            if(empty != null){<br>                await signInManager.SignOutAsync();<br>                return Results.Ok();<br>            }<br>            return Results.Unauthorized();<br>        })<br>        .WithOpenApi()<br>        .RequireAuthorization(); <br>...</pre><p>By adding.RequireAuthorization(), the endpoint requires authorization before it can be called.</p><p>Now, let’s run the application, and you can see the newly added endpoint in the Swagger documentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xUq3hXUg_Wgts1kcY7susA.png" /></figure><h4>Securing Endpoints</h4><p>With .NET, it is easy to authorize endpoints by adding an [Authorize] attribute to the endpoint controller. Let&#39;s add the [Authorize] attribute to the WeatherForecast controller.</p><pre>using Microsoft.AspNetCore.Authorization;<br>using Microsoft.AspNetCore.Mvc;<br><br>namespace AuthService.Controllers;<br><br>[ApiController]<br>[Route(&quot;[controller]&quot;)]<br>[Authorize]<br>public class WeatherForecastController : ControllerBase<br>{<br>    private static readonly string[] Summaries = new[]<br>    {<br>        &quot;Freezing&quot;, &quot;Bracing&quot;, &quot;Chilly&quot;, &quot;Cool&quot;, &quot;Mild&quot;, &quot;Warm&quot;, &quot;Balmy&quot;, &quot;Hot&quot;, &quot;Sweltering&quot;, &quot;Scorching&quot;<br>    };<br><br>    private readonly ILogger&lt;WeatherForecastController&gt; _logger;<br><br>    public WeatherForecastController(ILogger&lt;WeatherForecastController&gt; logger)<br>    {<br>        _logger = logger;<br>    }<br><br>    [HttpGet(Name = &quot;GetWeatherForecast&quot;)]<br>    public IEnumerable&lt;WeatherForecast&gt; Get()<br>    {<br>        return Enumerable.Range(1, 5).Select(index =&gt; new WeatherForecast<br>        {<br>            Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),<br>            TemperatureC = Random.Shared.Next(-20, 55),<br>            Summary = Summaries[Random.Shared.Next(Summaries.Length)]<br>        })<br>        .ToArray();<br>    }<br>}</pre><p>Now, let’s run the application and try to execute the WeatherForecast endpoint without authorization and with authorization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gekfqZc0vun5yE4jEC725Q.png" /><figcaption>Without authorization</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1dKNQSexSOZjIBIzYIVUHQ.png" /><figcaption>With authorization</figcaption></figure><p>You can find the full source code from <a href="https://github.com/dodandeniya-aet/IdentityService/tree/main">GitHub repository</a></p><h3>Conclusion</h3><p>Identity is a powerful feature built into ASP.NET Core. It makes managing authentication and authorization easy and secure. With .NET 8, Identity is even better and more flexible, giving developers many tools to handle security needs in their apps. This version has improved the Identity API, making it simpler and more intuitive to use. Developers can now use Identity with less code, making the implementation and maintenance easier.</p><p>In this article, we have discussed how to customize the existing Identity endpoints with the help of extension methods and secure endpoints with the authorization attribute provided by .NET Identity. While Identity is great for building authentication systems in SPAs, be aware of the risks when using its native token system. Using Identity can save a lot of time in analysis and development, so consider using it if it suits your needs.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fea53cfe0f8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aeturnuminc/building-authentication-service-using-microsoft-asp-net-core-identity-and-net-8-3fea53cfe0f8">Building Authentication Service using Microsoft ASP.NET Core Identity and .NET 8</a> was originally published in <a href="https://medium.com/aeturnuminc">Aeturnum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How do you Learn Any Programming Language Within 5 Working Days?]]></title>
            <link>https://medium.com/aeturnuminc/how-do-you-learn-any-programming-language-within-5-working-days-81861576bee7?source=rss----13bbb68d98b0---4</link>
            <guid isPermaLink="false">https://medium.com/p/81861576bee7</guid>
            <category><![CDATA[quick-coding-guide]]></category>
            <category><![CDATA[learn-programming-fast]]></category>
            <category><![CDATA[programming-tips]]></category>
            <category><![CDATA[master-new-language]]></category>
            <category><![CDATA[efficient-coding-skills]]></category>
            <dc:creator><![CDATA[Chamara Madushanka Dodandeniya]]></dc:creator>
            <pubDate>Tue, 04 Jun 2024 04:00:35 GMT</pubDate>
            <atom:updated>2024-06-04T04:00:35.404Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oXNLCbtOcYz6824ZwB102A.jpeg" /></figure><blockquote>“If you know the core concepts of one programming language very well, then you can easily learn any programming language. The only difference is the keyword tokens, syntax, and semantics of the new programming language you wish to learn.”</blockquote><h3>Background and Motivation</h3><p>It was challenging for me to learn Visual Basic 6.0 in 2007 when I was at school. As I remember, we wrote a lot of pseudocode before learning the actual programming language. Unlike today, all the programming language packages had to be installed using compact disks (CDs), and Visual Basic 6.0 also came as a CD package with 5 CDs. During school, we learned VB 6 from our teachers, and for further reading, we referred to a VB 6 textbook containing more than 2000 pages full of English content. Luckily, we had 2 books in the school library, but unfortunately, they didn’t allow us to borrow them. In other words, today we have a lot of resources to learn anything we want. But in the early days, textbooks were the key resources.</p><p>A couple of days ago, my sister asked me about “Laravel,” and she needed my help to fix some issues in her university project. Honestly, I didn’t know about that framework and didn’t have any motivation to learn it previously. However, after spending around 30 minutes on the official documentation, I was able to resolve those issues. So how did I fix them? What is the secret behind that?</p><h3>Fish Buns, Fish Rolls, and Fish Patties Concept</h3><p>You have eaten at least one of the flavours of the above three types of foods. Did you notice the difference between each of the above foods? The only difference is the wrapper of the food. But you can see that the inside is made from the same mixture. What is the deep connection between the above concept and programming languages?</p><p>When I was doing my undergraduate and reading my Master’s program, there was a course module called “Principles of Programming Languages.” This course module was introduced by Prof. D.D. Karunaratna (School of Computing, University of Colombo) to Sri Lanka’s university course curriculum. Luckily, I had a chance to learn both course modules conducted by him. The course module covers the key concepts that I mentioned earlier, the difference between one programming language and another.</p><p>In Prof. Karunaratna’s words, “If you know the core concepts of one programming language very well, then you can easily learn any programming language. The only difference is the keyword tokens, syntax, and semantics of the new programming language you wish to learn.”</p><p>For example, you can write a to-do application using Java, Python, PHP, Node.js, React, C#, or any programming language. But the ultimate end goal is the same, and the only difference is the language you choose to implement the application, the keyword tokens, and the syntaxes provided by the selected language.</p><p>As a software engineer, whether fresh out of university or with a couple of years of industry experience, the ability to quickly pick up new programming languages is a valuable skill. In today’s rapidly evolving tech landscape, being adaptable and able to learn new languages efficiently can greatly enhance your career prospects and job satisfaction. So how are you going to do that within 5 working days?</p><h3>Day 01 — Familiarize Yourself with Fundamentals and Basic Concepts</h3><p>When you join a software company or a new project, normally in the industry, PMs allocate you a timeslot for project ramp-up. During this period, you will have a lot of project KT sessions regarding the business domain knowledge and technical knowledge. Probably, you might need to learn new programming languages as well to work with the project smoothly.</p><p>Before diving into the syntax and intricacies of a new language, it’s crucial to grasp the fundamental concepts that underpin all programming languages. Spend the first day familiarizing yourself with concepts such as variables, data types, control structures (like loops and conditionals), functions, and basic algorithms. Start by reading the language’s official documentation or online tutorials, textbooks, and interactive coding platforms can be invaluable resources for acquiring this foundational knowledge. If you are familiar with at least one programming language, these tasks are straightforward.</p><h3>Day 02 — Explore Syntax and Language Features</h3><p>With a solid understanding of programming fundamentals, it’s time to dive into the syntax and unique features of the language you’re learning. Start by reading through the official documentation or reputable tutorials that cover the language’s syntax rules, keywords, and common idioms. Take notes and create simple programs to practice applying these concepts. Pay close attention to any features that distinguish the new language from ones you’re already familiar with. Choose small projects or exercises that cover different aspects of the language. Websites like LeetCode, HackerRank, or Codecademy offer a variety of coding challenges and exercises tailored to different programming languages.</p><h3>Day 03 — Deep Dive into Language Features and Libraries</h3><p>On the third day, delve deeper into the language’s features and explore commonly used libraries or frameworks. Focus on understanding concepts such as object-oriented programming (if applicable to your language), error-handling mechanisms, standard libraries, and third-party libraries commonly used in the ecosystem. Refer to advanced tutorials, official documentation, or online courses to gain a deeper understanding of these concepts.</p><p>Most programming languages have a rich ecosystem of libraries and frameworks that extend their capabilities and simplify common tasks. Spend time exploring some of the most commonly used libraries and frameworks in the language you’re learning. This could include web frameworks or libraries, mobile SDKs, ML libraries, or DB access libraries, etc.</p><h3>Day 04 — Build a Real-World Project</h3><p>Once you’ve explored advanced language features and familiarized yourself with commonly used libraries and frameworks, it’s time to experiment and build prototypes. Choose a small project or idea that interests you and incorporates the concepts and libraries you’ve learned about. This could be a web application, a command-line tool, a data analysis script, or any other project that aligns with your interests and goals. The goal is not to build a perfect or production-ready project but to apply your newfound knowledge in a practical context and gain hands-on experience. This will boost your curiosity of learning new skills and programming languages.</p><h3>Day 05 — Review and Refine</h3><p>On the final day, take some time to review what you’ve learned and identify areas for improvement. Reflect on the challenges you faced during the learning process and how you overcame them. Revisit your project code and look for opportunities to refactor or optimize it. Seek feedback from peers or mentors and don’t hesitate to ask for help if you encounter any roadblocks. Finally, document your learning journey by writing a summary or blog post sharing your experience and insights. Don’t stop on day 05. Keep seeking new trends and learn and apply them to the project you are working on.</p><h3>Conclusion</h3><p>Learning a new programming language within five working days is an ambitious goal and not an easy task, but with a structured approach and dedicated effort, it’s entirely achievable. By focusing on fundamentals, exploring syntax, building projects, seeking feedback, and deepening your knowledge, you can rapidly acquire proficiency in any language. Remember that mastery takes time and practice, so continue to hone your skills and embrace lifelong learning as you navigate your software engineering career. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81861576bee7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aeturnuminc/how-do-you-learn-any-programming-language-within-5-working-days-81861576bee7">How do you Learn Any Programming Language Within 5 Working Days?</a> was originally published in <a href="https://medium.com/aeturnuminc">Aeturnum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>