<?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[Stories by Daniel Gaias Malagurti on Medium]]></title>
        <description><![CDATA[Stories by Daniel Gaias Malagurti on Medium]]></description>
        <link>https://medium.com/@danielmalagurti?source=rss-2ab867e00916------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*z81VYyxqJNL1mJ4caSrT-g.jpeg</url>
            <title>Stories by Daniel Gaias Malagurti on Medium</title>
            <link>https://medium.com/@danielmalagurti?source=rss-2ab867e00916------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 27 May 2026 22:44:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@danielmalagurti/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Efficient Logging in Go: Utilizing Logrus with Lumberjack]]></title>
            <link>https://medium.com/@danielmalagurti/efficient-logging-in-go-utilizing-logrus-with-lumberjack-b77713b972e0?source=rss-2ab867e00916------2</link>
            <guid isPermaLink="false">https://medium.com/p/b77713b972e0</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Daniel Gaias Malagurti]]></dc:creator>
            <pubDate>Fri, 12 Jul 2024 14:28:06 GMT</pubDate>
            <atom:updated>2024-07-12T14:28:06.906Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kmVxQHU8IDW82W4yt0nDaw.png" /></figure><h3>Introduction</h3><p>Managing logs is a crucial aspect of any application. Logs provide vital information about the application’s behavior, errors that occurred, and assist in troubleshooting. Two popular tools for log management in Go applications are Logrus and Lumberjack. Logrus is a feature-rich logging library, while Lumberjack handles log file rotation and compression. In this article, we will explore how these tools can be used together to create a robust and scalable logging system.</p><h3>Why Use Logrus with Lumberjack?</h3><p><strong>Logrus</strong>:</p><ul><li><strong>Structured Logging</strong>: Logrus allows you to create structured logs, which are easier to search and analyze.</li><li><strong>Hooks</strong>: You can add hooks to send logs to various destinations like log monitoring services, files, etc.</li><li><strong>Formatting</strong>: Logrus supports multiple formats, including JSON, making it flexible for different logging requirements.</li></ul><p><strong>Lumberjack</strong>:</p><ul><li><strong>Log Rotation</strong>: Lumberjack automatically handles log file rotation based on size, time, or number of backups.</li><li><strong>Compression</strong>: It can compress old log files to save disk space.</li><li><strong>Retention Policy</strong>: Lumberjack allows you to set policies for retaining log files, ensuring that old logs are archived or deleted as per your configuration.</li></ul><h3>Setting Up Logrus with Lumberjack</h3><p>Here’s a step-by-step guide on how to set up Logrus with Lumberjack in a Go application:</p><p>1 — <strong>Install Dependencies</strong>:</p><pre>go get github.com/sirupsen/logrus<br>go get gopkg.in/natefinch/lumberjack.v2</pre><p>2 — <strong>Configure Logrus with Lumberjack</strong>:</p><pre>package main<br><br>import (<br>    &quot;github.com/sirupsen/logrus&quot;<br>    &quot;gopkg.in/natefinch/lumberjack.v2&quot;<br>)<br><br>func main() {<br>    log := logrus.New()<br>    log.SetOutput(&amp;lumberjack.Logger{<br>        Filename:   &quot;./logs/application.log&quot;,<br>        MaxSize:    10, // Max size in MB<br>        MaxBackups: 3,  // Max number of old log files to keep<br>        MaxAge:     28, // Max age in days to keep a log file<br>        Compress:   true, // Compress old log files<br>    })<br><br>    log.Info(&quot;This is an info log message&quot;)<br>    log.Warn(&quot;This is a warning log message&quot;)<br>    log.Error(&quot;This is an error log message&quot;)<br>}</pre><h3>Logging Examples</h3><p>Here are some examples demonstrating how to use Logrus for different log levels and structured logging:</p><p>1 — <strong>Basic Logging</strong>:</p><pre>log.Info(&quot;Application started&quot;)<br>log.Warn(&quot;This is a warning&quot;)<br>log.Error(&quot;An error occurred&quot;)</pre><p>2 — <strong>Structured Logging</strong>:</p><pre>log.WithFields(logrus.Fields{<br>    &quot;event&quot;: &quot;user_signup&quot;,<br>    &quot;user&quot;:  &quot;john_doe&quot;,<br>}).Info(&quot;New user signup&quot;)</pre><p>3 — <strong>Logging with Hooks</strong>:</p><pre>hook, err := logrus_syslog.NewSyslogHook(&quot;udp&quot;, &quot;localhost:514&quot;, syslog.LOG_INFO, &quot;&quot;)<br>if err == nil {<br>    log.Hooks.Add(hook)<br>}</pre><h3>Advantages of Using Logrus with Lumberjack</h3><ul><li><strong>Scalability</strong>: As your application grows, log files can become large. Lumberjack manages log file size and rotation, preventing disk space issues.</li><li><strong>Flexibility</strong>: Logrus’s structured logging and multiple format support make it adaptable to various logging requirements.</li><li><strong>Efficiency</strong>: Automated log rotation and compression reduce manual intervention, saving time and effort in log management.</li></ul><h3>Log Storage Modes with Lumberjack</h3><p>Lumberjack offers various modes for storing logs:</p><ul><li><strong>Size-Based Rotation</strong>: Rotate log files when they reach a certain size.</li><li><strong>Time-Based Rotation</strong>: Rotate logs based on a specific time interval.</li><li><strong>Backup Retention</strong>: Keep a specified number of old log files.</li><li><strong>Compression</strong>: Compress old logs to save disk space.</li></ul><h3>Conclusion</h3><p>Using Logrus with Lumberjack provides a powerful logging solution for Go applications. Logrus offers rich features for creating structured logs, while Lumberjack ensures efficient log file management through rotation and compression. Together, they help maintain a scalable, flexible, and efficient logging system that meets the needs of growing applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b77713b972e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best Practices for Pulumi Projects]]></title>
            <link>https://medium.com/@danielmalagurti/best-practices-for-pulumi-projects-626f12733b58?source=rss-2ab867e00916------2</link>
            <guid isPermaLink="false">https://medium.com/p/626f12733b58</guid>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[pulumi]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[best-practices]]></category>
            <dc:creator><![CDATA[Daniel Gaias Malagurti]]></dc:creator>
            <pubDate>Thu, 04 Jul 2024 12:04:43 GMT</pubDate>
            <atom:updated>2024-07-04T12:04:43.257Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gDSl76q64z_5uuwcLDmoUA.png" /></figure><p>Pulumi is a modern infrastructure as code platform that enables developers to define, deploy, and manage cloud infrastructure using familiar programming languages like TypeScript, Python, Go, and C#. Unlike traditional templating or DSL-based approaches, Pulumi allows you to leverage the full power of general-purpose languages, including their ecosystems, tools, and best practices, to manage your infrastructure.</p><p>Adopting best practices when using Pulumi is crucial to ensure that your infrastructure is reliable, secure, and maintainable. These best practices help you avoid common pitfalls, enhance collaboration among team members, and streamline the deployment process. By following these guidelines, you can build robust, scalable infrastructure that meets the needs of your applications and services while minimizing risks and operational overhead.</p><p><strong>1 — Version Control Infrastructure as Code (IaC)</strong> Store your Pulumi code in a version control system like Git. This enables team collaboration and tracks changes over time.</p><p><strong>2 — Organize Your Project Structure</strong> Keep your Pulumi project organized by separating configuration files, code, and resources. Use directories and modules to logically group resources.</p><p><strong>3 — Use Configurations for Environment-Specific Values</strong> Use Pulumi configuration files to manage environment-specific values (e.g., dev, staging, production). This ensures that your code is environment-agnostic.</p><p><strong>4 — Secure Sensitive Information</strong> Store sensitive information, such as API keys and passwords, in Pulumi’s secrets management system. Avoid hardcoding sensitive data in your codebase.</p><p><strong>5 — Automate Deployments</strong> Integrate Pulumi with your CI/CD pipeline to automate deployments. This ensures consistency and reduces the risk of human error during manual deployments.</p><p><strong>6 — Write Idempotent Code</strong> Ensure your Pulumi code is idempotent, meaning multiple runs should produce the same result. This helps in achieving predictable infrastructure states.</p><p><strong>7 — Use Proper Resource Naming Conventions</strong> Adopt a consistent naming convention for resources to make them easily identifiable and manageable.</p><p><strong>8 — Manage State Securely</strong> Use a secure and reliable backend for Pulumi state management, such as the Pulumi Service, AWS S3, or Azure Blob Storage. Ensure state files are encrypted and access-controlled.</p><p><strong>9 — Test Your Infrastructure Code</strong> Write unit and integration tests for your Pulumi code. Use tools like pulumi/pulumictl to test your infrastructure changes before applying them.</p><p><strong>10 — Document Your Code and Processes</strong> Maintain clear and comprehensive documentation for your Pulumi code and deployment processes. This aids team onboarding and knowledge sharing.</p><p><strong>11 — Leverage Pulumi’s Multi-Language Support</strong> Use the language you’re most comfortable with, whether it’s TypeScript, Python, Go, or C#. Pulumi supports multiple languages, allowing you to leverage existing skills.</p><p><strong>12 — Monitor and Manage Resource Drift</strong> Regularly check for drift between your Pulumi code and the actual deployed resources. Use tools and processes to detect and correct drifts.</p><p><strong>13 — Implement Rollbacks and Recovery Plans</strong> Plan for rollbacks and recovery. Ensure you have strategies to revert changes in case of failures during deployments.</p><p><strong>14 — Keep Dependencies Up-to-Date</strong> Regularly update your Pulumi CLI, libraries, and dependencies to benefit from the latest features, improvements, and security patches.</p><p><strong>15 — Collaborate with Stacks</strong> Use Pulumi stacks to manage different environments and share configurations across teams. Stacks allow you to isolate environments and collaborate effectively.</p><p>Following these best practices helps ensure your Pulumi projects are maintainable, secure, and scalable, providing a robust foundation for your infrastructure as code endeavors.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=626f12733b58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Go, also known as Golang, is a powerful and efficient programming language that has gained immense…]]></title>
            <link>https://medium.com/@danielmalagurti/go-also-known-as-golang-is-a-powerful-and-efficient-programming-language-that-has-gained-immense-0ab572855382?source=rss-2ab867e00916------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ab572855382</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Daniel Gaias Malagurti]]></dc:creator>
            <pubDate>Wed, 03 Jul 2024 20:36:42 GMT</pubDate>
            <atom:updated>2024-07-03T22:02:20.409Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fZL-hEUUlDxqJvdNZQxLBA.png" /></figure><p>Go, also known as Golang, is a powerful and efficient programming language that has gained immense popularity in recent years. Whether you’re building web applications, microservices, or command-line tools, Go has a rich ecosystem of libraries that can enhance your productivity and streamline your development process. Here are ten essential libraries to consider for your next Go project:</p><p><strong>Gin</strong></p><ul><li><strong>Description:</strong> Gin is a lightweight and high-performance web framework for Go. It is known for its speed and minimalism, making it ideal for building RESTful APIs.</li><li><strong>Features:</strong> Middleware support, JSON validation, routing, error management, and rendering</li></ul><pre>import &quot;github.com/gin-gonic/gin&quot;<br><br>func main() {<br>    r := gin.Default()<br>    r.GET(&quot;/ping&quot;, func(c *gin.Context) {<br>        c.JSON(200, gin.H{<br>            &quot;message&quot;: &quot;pong&quot;,<br>        })<br>    })<br>    r.Run()<br>}</pre><p><strong>Echo</strong></p><ul><li><strong>Description:</strong> Echo is another fast and minimalist web framework for Go, focusing on simplicity and performance.</li><li><strong>Features:</strong> Routing, middleware, data binding, and validation.</li></ul><pre>import (<br>    &quot;net/http&quot;<br>    &quot;github.com/labstack/echo/v4&quot;<br>)<br><br>func main() {<br>    e := echo.New()<br>    e.GET(&quot;/&quot;, func(c echo.Context) error {<br>        return c.String(http.StatusOK, &quot;Hello, Echo!&quot;)<br>    })<br>    e.Start(&quot;:8080&quot;)<br>}</pre><p><strong>GORM</strong></p><ul><li><strong>Description:</strong> GORM is an ORM (Object-Relational Mapping) library for Go that simplifies database interactions.</li><li><strong>Features:</strong> Associations, hooks, preloading, transactions, and more.</li></ul><pre>import (<br>    &quot;gorm.io/driver/sqlite&quot;<br>    &quot;gorm.io/gorm&quot;<br>)<br><br>type Product struct {<br>    gorm.Model<br>    Code  string<br>    Price uint<br>}<br><br>func main() {<br>    db, err := gorm.Open(sqlite.Open(&quot;test.db&quot;), &amp;gorm.Config{})<br>    if err != nil {<br>        panic(&quot;failed to connect database&quot;)<br>    }<br>    db.AutoMigrate(&amp;Product{})<br>    db.Create(&amp;Product{Code: &quot;D42&quot;, Price: 100})<br>}</pre><p><strong>Viper</strong></p><ul><li><strong>Description:</strong> Viper is a comprehensive library for configuration management in Go applications.</li><li><strong>Features:</strong> Reading from JSON, TOML, YAML, HCL, envfile and Java properties config files, remote configuration systems, and more.</li></ul><pre>import (<br>    &quot;fmt&quot;<br>    &quot;github.com/spf13/viper&quot;<br>)<br><br>func main() {<br>    viper.SetConfigName(&quot;config&quot;)<br>    viper.AddConfigPath(&quot;.&quot;)<br>    err := viper.ReadInConfig()<br>    if err != nil {<br>        panic(fmt.Errorf(&quot;Fatal error config file: %w \n&quot;, err))<br>    }<br>    fmt.Println(&quot;Config value:&quot;, viper.GetString(&quot;key&quot;))<br>}</pre><p><strong>Cobra</strong></p><ul><li><strong>Description:</strong> Cobra is a library for creating powerful and modern CLI applications.</li><li><strong>Features:</strong> Command line flag parsing, command aliases, and extensive documentation support.</li></ul><pre>import (<br>    &quot;github.com/spf13/cobra&quot;<br>)<br><br>func main() {<br>    var rootCmd = &amp;cobra.Command{<br>        Use:   &quot;app&quot;,<br>        Short: &quot;A brief description of your application&quot;,<br>        Run: func(cmd *cobra.Command, args []string) {<br>            fmt.Println(&quot;Hello, Cobra!&quot;)<br>        },<br>    }<br>    rootCmd.Execute()<br>}</pre><p><strong>Go Kit</strong></p><ul><li><strong>Description:</strong> Go Kit provides a comprehensive toolkit for building microservices.</li><li><strong>Features:</strong> Transport-agnostic RPC, service discovery, load balancing, tracing, and more.</li></ul><pre>import (<br>    &quot;github.com/go-kit/kit/endpoint&quot;<br>    &quot;github.com/go-kit/kit/log&quot;<br>    &quot;github.com/go-kit/kit/transport/http&quot;<br>)<br><br>func main() {<br>    logger := log.NewLogfmtLogger(os.Stderr)<br>    endpoint := func(ctx context.Context, request interface{}) (interface{}, error) {<br>        return &quot;Hello, Go Kit!&quot;, nil<br>    }<br>    handler := http.NewServer(endpoint, decodeRequest, encodeResponse)<br>    http.ListenAndServe(&quot;:8080&quot;, handler)<br>}<br><br>func decodeRequest(_ context.Context, r *http.Request) (interface{}, error) {<br>    return nil, nil<br>}<br><br>func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {<br>    w.Header().Set(&quot;Content-Type&quot;, &quot;application/json&quot;)<br>    return json.NewEncoder(w).Encode(response)<br>}</pre><p><strong>Logrus</strong></p><ul><li><strong>Description:</strong> Logrus is a structured logging library for Go that provides leveled logging.</li><li><strong>Features:</strong> Hooks, formatters (JSON, text), and extensive field logging.</li></ul><pre>import (<br>    &quot;github.com/sirupsen/logrus&quot;<br>)<br><br>func main() {<br>    var log = logrus.New()<br>    log.Out = os.Stdout<br>    log.WithFields(logrus.Fields{<br>        &quot;animal&quot;: &quot;walrus&quot;,<br>        &quot;size&quot;:   10,<br>    }).Info(&quot;A walrus appears&quot;)<br>}</pre><p><strong>Migrate</strong></p><ul><li><strong>Description:</strong> Migrate provides a simple way to manage database migrations.</li><li><strong>Features:</strong> CLI support, migration files in various formats, and database driver support.</li></ul><pre>import (<br>    &quot;github.com/golang-migrate/migrate/v4&quot;<br>    _ &quot;github.com/golang-migrate/migrate/v4/database/postgres&quot;<br>    _ &quot;github.com/golang-migrate/migrate/v4/source/file&quot;<br>)<br><br>func main() {<br>    m, err := migrate.New(<br>        &quot;file://path/to/migrations&quot;,<br>        &quot;postgres://localhost:5432/database?sslmode=disable&quot;)<br>    if err != nil {<br>        log.Fatal(err)<br>    }<br>    m.Up()<br>}</pre><p><strong>JWT</strong></p><ul><li><strong>Description:</strong> JWT is a Go library for working with JSON Web Tokens.</li><li><strong>Features:</strong> Token creation, parsing, and validation.</li></ul><pre>import (<br>    &quot;github.com/dgrijalva/jwt-go&quot;<br>    &quot;time&quot;<br>)<br><br>func main() {<br>    token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{<br>        &quot;name&quot;: &quot;John Doe&quot;,<br>        &quot;exp&quot;:  time.Now().Add(time.Hour * 72).Unix(),<br>    })<br>    tokenString, err := token.SignedString([]byte(&quot;secret&quot;))<br>    if err != nil {<br>        log.Fatal(err)<br>    }<br>    fmt.Println(tokenString)<br>}</pre><p><strong>Swagger</strong></p><ul><li><strong>Description:</strong> Swagger is a tool to automatically generate and serve documentation for your Go API.</li><li><strong>Features:</strong> Integration with Go HTTP servers, customizable documentation, and OpenAPI support.</li></ul><pre>import (<br>    &quot;github.com/swaggo/swag/example/basic/docs&quot;<br>    &quot;github.com/gin-gonic/gin&quot;<br>)<br><br>func main() {<br>    r := gin.New()<br>    docs.SwaggerInfo.BasePath = &quot;/api/v1&quot;<br>    r.GET(&quot;/swagger/*any&quot;, ginSwagger.WrapHandler(swaggerFiles.Handler))<br>    r.Run()<br>}</pre><p>These libraries cover a wide range of functionalities, from web frameworks and ORMs to configuration management and logging. By incorporating these tools into your Go projects, you can significantly enhance your development workflow and create robust, scalable applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ab572855382" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MLOps Workflow Using GCP: A Comprehensive Guide]]></title>
            <link>https://medium.com/@danielmalagurti/mlops-workflow-using-gcp-a-comprehensive-guide-39d101e11b37?source=rss-2ab867e00916------2</link>
            <guid isPermaLink="false">https://medium.com/p/39d101e11b37</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Daniel Gaias Malagurti]]></dc:creator>
            <pubDate>Sat, 15 Jun 2024 11:49:51 GMT</pubDate>
            <atom:updated>2024-06-15T11:49:51.098Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EyrqXu9Wz6qRopMGiZOS9Q.png" /></figure><h3>Introduction</h3><p>In the rapidly evolving landscape of Machine Learning (ML) and Artificial Intelligence (AI), the ability to efficiently develop, deploy, and maintain ML models is crucial. This process, known as MLOps (Machine Learning Operations), combines the principles of DevOps with ML to streamline the end-to-end lifecycle of ML models. Google Cloud Platform (GCP) offers a suite of services that facilitate each stage of this lifecycle. In this article, we will explore a detailed MLOps workflow using GCP services, illustrated by a comprehensive diagram.</p><h3>1. Data Ingestion</h3><p><strong>Services</strong>: Cloud Storage, BigQuery, Pub/Sub<br><strong>Description</strong>: The first step in any ML project is to collect and store raw data from various sources. GCP provides several tools to facilitate this process:</p><ul><li><strong>Cloud Storage</strong>: Used for storing large volumes of unstructured data.</li><li><strong>BigQuery</strong>: A highly scalable data warehouse for storing structured data.</li><li><strong>Pub/Sub</strong>: A messaging service for ingesting streaming data in real-time.</li></ul><h3>2. Data Processing and Preparation</h3><p><strong>Services</strong>: Dataflow, Dataproc, BigQuery<br><strong>Description</strong>: Once the data is ingested, it needs to be cleaned and transformed into a suitable format for analysis and model training. GCP offers robust tools for data processing:</p><ul><li><strong>Dataflow</strong>: A fully managed service for stream and batch processing.</li><li><strong>Dataproc</strong>: A fast, easy-to-use, fully managed cloud service for running Apache Spark and Apache Hadoop clusters.</li><li><strong>BigQuery</strong>: Used for executing complex queries on large datasets.</li></ul><h3>3. Data Exploration and Visualization</h3><p><strong>Services</strong>: Datalab, Data Studio, AI Platform Notebooks<br><strong>Description</strong>: Data exploration and visualization are essential for understanding the data and generating insights. GCP provides the following tools:</p><ul><li><strong>Datalab</strong>: An interactive tool for exploring, analyzing, and visualizing data.</li><li><strong>Data Studio</strong>: A powerful dashboarding and reporting tool.</li><li><strong>AI Platform Notebooks</strong>: Jupyter notebooks that are managed, scalable, and integrate seamlessly with other GCP services.</li></ul><h3>4. Model Training</h3><p><strong>Services</strong>: AI Platform Training, Compute Engine, TensorFlow<br><strong>Description</strong>: Training the ML model is a critical step that involves developing algorithms and feeding the prepared data into these algorithms to create predictive models. GCP supports this with:</p><ul><li><strong>AI Platform Training</strong>: A managed service for training ML models at scale.</li><li><strong>Compute Engine</strong>: Provides the computational resources needed for intensive training tasks.</li><li><strong>TensorFlow</strong>: An open-source library for developing ML models.</li></ul><h3>5. Model Evaluation and Tuning</h3><p><strong>Services</strong>: AI Platform Training, TensorBoard<br><strong>Description</strong>: Evaluating the model’s performance and tuning its parameters are necessary to ensure accuracy and efficiency. GCP facilitates this with:</p><ul><li><strong>AI Platform Training</strong>: Used for running and managing training jobs.</li><li><strong>TensorBoard</strong>: A suite of visualization tools to inspect and understand the training process.</li></ul><h3>6. Model Deployment</h3><p><strong>Services</strong>: AI Platform Prediction, Kubernetes Engine (GKE), Cloud Functions<br><strong>Description</strong>: Deploying the trained model to a production environment where it can make real-time predictions is the next step. GCP offers several deployment options:</p><ul><li><strong>AI Platform Prediction</strong>: A managed service for serving ML models in production.</li><li><strong>Kubernetes Engine (GKE)</strong>: A managed Kubernetes service for deploying containerized applications.</li><li><strong>Cloud Functions</strong>: A serverless environment to execute functions in response to events.</li></ul><h3>7. Model Monitoring and Management</h3><p><strong>Services</strong>: Stackdriver, AI Platform, BigQuery<br><strong>Description</strong>: Continuous monitoring and management of the deployed model are crucial for maintaining performance and making necessary adjustments. GCP provides tools for:</p><ul><li><strong>Stackdriver</strong>: Monitoring, logging, and diagnostics for applications on GCP.</li><li><strong>AI Platform</strong>: Provides model versioning and management capabilities.</li><li><strong>BigQuery</strong>: Used for analyzing logs and performance data.</li></ul><h3>8. Continuous Integration and Continuous Deployment (CI/CD)</h3><p><strong>Services</strong>: Cloud Build, Cloud Source Repositories, Cloud Scheduler<br><strong>Description</strong>: Automating the lifecycle of ML model development and deployment is key to ensuring efficiency and consistency. GCP supports CI/CD with:</p><ul><li><strong>Cloud Build</strong>: A continuous integration service that automates the build and test process.</li><li><strong>Cloud Source Repositories</strong>: A managed source control service for Git repositories.</li><li><strong>Cloud Scheduler</strong>: A fully managed cron job service for scheduling tasks.</li></ul><h3>Conclusion</h3><p>Implementing an MLOps workflow using GCP can significantly enhance the efficiency and reliability of ML model development and deployment. By leveraging GCP’s comprehensive suite of services, organizations can streamline their ML pipelines, from data ingestion to continuous deployment and monitoring. This holistic approach ensures that ML models are not only developed quickly but also maintained and updated effectively, leading to better performance and more accurate predictions.</p><p>Embrace the power of MLOps with GCP and transform your ML projects into robust, scalable solutions that drive real business value.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39d101e11b37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Deep Learning-Based Recommendation Systems with Go — Part 2]]></title>
            <link>https://medium.com/@danielmalagurti/integrating-deep-learning-based-recommendation-systems-with-go-part-2-e642d384ceec?source=rss-2ab867e00916------2</link>
            <guid isPermaLink="false">https://medium.com/p/e642d384ceec</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Daniel Gaias Malagurti]]></dc:creator>
            <pubDate>Fri, 14 Jun 2024 12:29:32 GMT</pubDate>
            <atom:updated>2024-06-14T12:29:32.631Z</atom:updated>
            <content:encoded><![CDATA[<h3>Integrating Deep Learning-Based Recommendation Systems with Go — Part 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*37yavyuwbdnI34dEp2i3QA.png" /></figure><h3>Introduction</h3><p>In the era of big data, recommendation systems have become a cornerstone for enhancing user experience by providing personalized content and suggestions. Deep learning models, known for their ability to capture complex patterns in data, are increasingly being used to power these systems. However, deploying such models in a production environment requires a robust and efficient backend. This is where Go (Golang) shines, providing performance and scalability.</p><p>In this article, we will explore how to integrate a deep learning-based recommendation system, trained with TensorFlow in Python, into a Go application. We will walk through the steps of exporting the trained model, setting up a Go service to serve the model via API, and calling the Python script from Go to make predictions.</p><h3>Key Steps and Implementation</h3><h3>1. Exporting the Trained Model in Python</h3><p>First, we train a recommendation system using TensorFlow and save the trained model. This step involves typical machine learning workflow steps such as data preprocessing, model training, and evaluation.</p><p>Here’s a snippet showing how to save the trained model:</p><pre>import tensorflow as tf<br><br># Assuming `model` is your trained model<br>model.save(&#39;recommendation_model.h5&#39;)</pre><h3>2. Setting Up the Go Service</h3><p>We will create a Go service that can handle API requests and interact with the Python model for predictions.</p><h4>Installing Dependencies</h4><p>We use the Gorilla Mux package for routing and the exec package to run the Python script:</p><pre>go get -u github.com/gorilla/mux</pre><h4>Go Service Code</h4><p>Below is the Go code for setting up a basic HTTP server that interacts with our Python model:</p><pre>package main<br><br>import (<br>    &quot;encoding/json&quot;<br>    &quot;log&quot;<br>    &quot;net/http&quot;<br>    &quot;os/exec&quot;<br>    &quot;strconv&quot;<br><br>    &quot;github.com/gorilla/mux&quot;<br>)<br><br>type PredictionRequest struct {<br>    UserID int `json:&quot;user_id&quot;`<br>    TopN   int `json:&quot;top_n&quot;`<br>}<br><br>type PredictionResponse struct {<br>    Recommendations []string `json:&quot;recommendations&quot;`<br>}<br><br>func getRecommendations(userID int, topN int) ([]string, error) {<br>    cmd := exec.Command(&quot;python3&quot;, &quot;predict.py&quot;, strconv.Itoa(userID), strconv.Itoa(topN))<br>    output, err := cmd.Output()<br>    if err != nil {<br>        return nil, err<br>    }<br><br>    var recommendations []string<br>    err = json.Unmarshal(output, &amp;recommendations)<br>    if err != nil {<br>        return nil, err<br>    }<br><br>    return recommendations, nil<br>}<br><br>func recommendHandler(w http.ResponseWriter, r *http.Request) {<br>    var req PredictionRequest<br>    if err := json.NewDecoder(r.Body).Decode(&amp;req); err != nil {<br>        http.Error(w, err.Error(), http.StatusBadRequest)<br>        return<br>    }<br><br>    recommendations, err := getRecommendations(req.UserID, req.TopN)<br>    if err != nil {<br>        http.Error(w, err.Error(), http.StatusInternalServerError)<br>        return<br>    }<br><br>    res := PredictionResponse{Recommendations: recommendations}<br>    json.NewEncoder(w).Encode(res)<br>}<br><br>func main() {<br>    r := mux.NewRouter()<br>    r.HandleFunc(&quot;/recommend&quot;, recommendHandler).Methods(&quot;POST&quot;)<br>    log.Fatal(http.ListenAndServe(&quot;:8000&quot;, r))<br>}</pre><h3>3. Python Script for Predictions</h3><p>The Python script (predict.py) will load the saved model and make predictions based on the input received from the Go service.</p><pre>import sys<br>import json<br>import pandas as pd<br>import numpy as np<br>from tensorflow.keras.models import load_model<br>from sklearn.preprocessing import LabelEncoder, StandardScaler<br><br># Load the model<br>model = load_model(&#39;recommendation_model.h5&#39;)<br><br># Load and preprocess the data<br>df = pd.read_csv(&#39;dataset.csv&#39;)<br><br>label_encoders = {}<br>for column in [&#39;Branch&#39;, &#39;City&#39;, &#39;Customer type&#39;, &#39;Gender&#39;, &#39;Payment&#39;]:<br>    le = LabelEncoder()<br>    df[column] = le.fit_transform(df[column])<br>    label_encoders[column] = le<br><br>scaler = StandardScaler()<br>df[[&#39;Unit price&#39;, &#39;Quantity&#39;, &#39;Tax 5%&#39;, &#39;Total&#39;, &#39;cogs&#39;, &#39;gross margin percentage&#39;, &#39;gross income&#39;, &#39;Rating&#39;]] = scaler.fit_transform(<br>    df[[&#39;Unit price&#39;, &#39;Quantity&#39;, &#39;Tax 5%&#39;, &#39;Total&#39;, &#39;cogs&#39;, &#39;gross margin percentage&#39;, &#39;gross income&#39;, &#39;Rating&#39;]])<br><br>le_product_line = LabelEncoder()<br>df[&#39;Product line&#39;] = le_product_line.fit_transform(df[&#39;Product line&#39;])<br>label_encoders[&#39;Product line&#39;] = le_product_line<br><br>df = df.drop([&#39;Invoice ID&#39;, &#39;Date&#39;, &#39;Time&#39;], axis=1)<br><br>def recommend_items(user_id, top_n):<br>    user_data = df.iloc[[user_id]]<br>    predictions = model.predict(user_data.drop(&#39;Product line&#39;, axis=1).astype(float))<br>    top_items = predictions.argsort()[0][-top_n:][::-1]<br>    return [label_encoders[&#39;Product line&#39;].inverse_transform([i])[0] for i in top_items]<br><br>user_id = int(sys.argv[1])<br>top_n = int(sys.argv[2])<br>recommendations = recommend_items(user_id, top_n)<br>print(json.dumps(recommendations))</pre><h3>Running the Service</h3><p>Ensure the dataset and the saved model are in the correct directory, and run the Go service:</p><pre>go run main.go</pre><h3>Testing the API</h3><p>To test the API, you can use a tool like curl:</p><pre>curl -X POST -H &quot;Content-Type: application/json&quot; -d &#39;{&quot;user_id&quot;: 0, &quot;top_n&quot;: 3}&#39; http://localhost:8000/recommend</pre><h3>Benefits of Using Go for Machine Learning APIs</h3><ul><li><strong>Performance</strong>: Go is known for its performance and efficiency. It compiles to native code and has low overhead, making it ideal for building high-performance APIs.</li><li><strong>Concurrency</strong>: Go’s goroutines make it easy to handle multiple requests concurrently, which is crucial for a recommendation system serving many users simultaneously.</li><li><strong>Simplicity</strong>: Go’s simplicity and clean syntax reduce the complexity of building and maintaining APIs, ensuring that developers can quickly deploy and scale their applications.</li><li><strong>Scalability</strong>: Go is designed with scalability in mind. It can handle a large number of connections, making it suitable for high-traffic applications.</li></ul><h3>Conclusion</h3><p>Integrating a deep learning-based recommendation system with a Go backend leverages the strengths of both technologies. While TensorFlow provides the power and flexibility of deep learning, Go offers the performance and scalability needed for production-grade APIs. This combination ensures that your recommendation system is both intelligent and efficient, capable of delivering personalized experiences at scale.</p><p>By following the steps outlined in this article, you can create a robust recommendation system that combines the best of machine learning and backend engineering. Whether you’re working on a small project or a large-scale application, this approach will help you deliver high-quality recommendations to your users.</p><h3>Next Steps</h3><p>In the next steps we will aproach the deploy stage with Pulumi and GCP. Stay close to see the news.</p><p>Part One — <a href="https://medium.com/@danielmalagurti/building-a-deep-learning-based-recommendation-system-with-tensorflow-and-go-8127d2df271e">Building a Deep Learning-Based Recommendation System with TensorFlow and Go — Part 1 | by Daniel Gaias Malagurti | Jun, 2024 | Medium</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e642d384ceec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Deep Learning-Based Recommendation System with TensorFlow and Go — Part 1]]></title>
            <link>https://medium.com/@danielmalagurti/building-a-deep-learning-based-recommendation-system-with-tensorflow-and-go-8127d2df271e?source=rss-2ab867e00916------2</link>
            <guid isPermaLink="false">https://medium.com/p/8127d2df271e</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Daniel Gaias Malagurti]]></dc:creator>
            <pubDate>Wed, 12 Jun 2024 11:43:06 GMT</pubDate>
            <atom:updated>2024-06-14T12:35:09.656Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Epx42gNL55iKBoY4WIn80g.png" /></figure><h3>Introduction</h3><p>In recent years, deep learning has revolutionized various fields, including natural language processing, image recognition, and recommendation systems. Unlike traditional machine learning algorithms, deep learning models can automatically extract features from raw data, making them highly effective for complex tasks. In this article, we will explore how to build a deep learning-based recommendation system using TensorFlow. We will walk through the process of loading and pre-processing the dataset, creating and training a deep learning model, and making item recommendations.</p><h3>Dataset Overview</h3><p>The dataset used in this project contains transaction records from a retail store. Each record includes information such as the invoice ID, branch, city, customer type, gender, product line, unit price, quantity, tax, total amount, date, time, payment method, cost of goods sold (cogs), gross margin percentage, gross income, and customer rating. Here is a sample of the dataset:</p><pre>| Invoice ID | Branch | City      | Customer type | Gender | Product line          | Unit price | Quantity | Tax 5% | Total  | Date     | Time  | Payment    | cogs  | gross margin percentage | gross income | Rating |<br>|------------|--------|-----------|---------------|--------|-----------------------|------------|----------|--------|--------|----------|-------|------------|-------|-------------------------|---------------|--------|<br>| 750-67-8428| A      | Yangon    | Member        | Female | Health and beauty     | 74.69      | 7        | 26.1415| 548.9715| 1/5/2019 | 13:08 | Ewallet    | 522.83| 4.761905                | 26.1415       | 9.1    |<br>| 226-31-3081| C      | Naypyitaw | Normal        | Female | Electronic accessories| 15.28      | 5        | 3.8200 | 80.2200 | 3/8/2019 | 10:29 | Cash       | 76.40 | 4.761905                | 3.8200        | 9.6    |<br>| 631-41-3108| A      | Yangon    | Normal        | Male   | Home and lifestyle    | 46.33      | 7        | 16.2155| 340.5255| 3/3/2019 | 13:23 | Credit card| 324.31| 4.761905                | 16.2155       | 7.4    |<br>| 123-19-1176| A      | Yangon    | Member        | Male   | Health and beauty     | 58.22      | 8        | 23.2880| 489.0480| 1/27/2019| 20:33 | Ewallet    | 465.76| 4.761905                | 23.2880       | 8.4    |<br>| 373-73-7910| A      | Yangon    | Normal        | Male   | Sports and travel     | 86.31      | 7        | 30.2085| 634.3785| 2/8/2019 | 10:37 | Ewallet    | 604.17| 4.761905                | 30.2085       | 5.3    |</pre><h3>Pre-processing the Data</h3><p>Before training the model, we need to pre-process the dataset to ensure it is in the correct format. This involves encoding categorical variables, normalizing numerical features, and splitting the data into training and testing sets.</p><pre>import pandas as pd<br>from sklearn.model_selection import train_test_split<br>from sklearn.preprocessing import LabelEncoder, StandardScaler<br><br># Load the dataset<br>df = pd.read_csv(&#39;dataset.csv&#39;)<br><br># Encode categorical columns<br>label_encoders = {}<br>for column in [&#39;Branch&#39;, &#39;City&#39;, &#39;Customer type&#39;, &#39;Gender&#39;, &#39;Payment&#39;]:<br>    le = LabelEncoder()<br>    df[column] = le.fit_transform(df[column])<br>    label_encoders[column] = le<br><br># Normalize numerical columns<br>scaler = StandardScaler()<br>df[[&#39;Unit price&#39;, &#39;Quantity&#39;, &#39;Tax 5%&#39;, &#39;Total&#39;, &#39;cogs&#39;, &#39;gross margin percentage&#39;, &#39;gross income&#39;, &#39;Rating&#39;]] = scaler.fit_transform(<br>    df[[&#39;Unit price&#39;, &#39;Quantity&#39;, &#39;Tax 5%&#39;, &#39;Total&#39;, &#39;cogs&#39;, &#39;gross margin percentage&#39;, &#39;gross income&#39;, &#39;Rating&#39;]])<br><br># Encode the target column<br>le_product_line = LabelEncoder()<br>df[&#39;Product line&#39;] = le_product_line.fit_transform(df[&#39;Product line&#39;])<br>label_encoders[&#39;Product line&#39;] = le_product_line<br><br># Drop unnecessary columns<br>df = df.drop([&#39;Invoice ID&#39;, &#39;Date&#39;, &#39;Time&#39;], axis=1)<br><br># Split the data into training and testing sets<br>train, test = train_test_split(df, test_size=0.2, random_state=42)</pre><h3>Creating the Deep Learning Model</h3><p>We will create a deep learning model using TensorFlow’s Keras API. The model consists of an input layer, three hidden layers with ReLU activation functions, and an output layer with a softmax activation function.</p><pre>import tensorflow as tf<br>from tensorflow.keras.models import Model<br>from tensorflow.keras.layers import Input, Dense<br><br># Function to create the model<br>def create_model(input_dim, num_classes):<br>    inputs = Input(shape=(input_dim,))<br>    x = Dense(128, activation=&#39;relu&#39;)(inputs)<br>    x = Dense(64, activation=&#39;relu&#39;)(x)<br>    x = Dense(32, activation=&#39;relu&#39;)(x)<br>    outputs = Dense(num_classes, activation=&#39;softmax&#39;)(x)<br>    model = Model(inputs, outputs)<br>    return model<br><br># Define model parameters<br>input_dim = train.shape[1] - 1  # Number of input features<br>num_classes = len(df[&#39;Product line&#39;].unique())  # Number of classes in the target column<br><br># Create the model<br>model = create_model(input_dim, num_classes)<br>model.compile(optimizer=&#39;adam&#39;, loss=&#39;sparse_categorical_crossentropy&#39;, metrics=[&#39;accuracy&#39;])<br><br># Display model summary<br>model.summary()</pre><h3>Training the Model</h3><p>Next, we will train the model using the training data. We will also validate the model on the test data to monitor its performance.</p><pre># Prepare training and testing data<br>X_train = train.drop(&#39;Product line&#39;, axis=1).astype(float)<br>y_train = train[&#39;Product line&#39;].astype(int)<br>X_test = test.drop(&#39;Product line&#39;, axis=1).astype(float)<br>y_test = test[&#39;Product line&#39;].astype(int)<br><br># Train the model<br>history = model.fit(X_train, y_train, epochs=20, batch_size=32, validation_data=(X_test, y_test))</pre><h3>Making Recommendations</h3><p>After training the model, we can use it to make item recommendations for users. The recommend_items function takes the trained model, user data, and the label encoders, and returns the top N recommended items.</p><pre># Function to recommend items<br>def recommend_items(model, user_data, label_encoders, top_n=3):<br>    predictions = model.predict(user_data)<br>    top_items = predictions.argsort()[0][-top_n:][::-1]<br>    return [label_encoders[&#39;Product line&#39;].inverse_transform([i])[0] for i in top_items]<br><br># Example recommendation for a specific user<br>user_data = X_test.iloc[0:1]  # User data (modify as needed)<br>recommended_items = recommend_items(model, user_data, label_encoders)<br>print(f&quot;Recommended items: {recommended_items}&quot;)</pre><h3>Conclusion</h3><p>In this article, we have built a deep learning-based recommendation system using TensorFlow. We started by pre-processing the dataset, creating a deep learning model, training the model, and finally making item recommendations. Deep learning offers powerful tools for building recommendation systems that can capture complex patterns in data, leading to more accurate and personalized recommendations.</p><h3>Next steps</h3><p>How to use tensorflow models with go, to improve performance</p><p>part 2 — <a href="https://medium.com/@danielmalagurti/integrating-deep-learning-based-recommendation-systems-with-go-part-2-e642d384ceec">Integrating Deep Learning-Based Recommendation Systems with Go — Part 2 | by Daniel Gaias Malagurti | Jun, 2024 | Medium</a></p><h3><strong>Notebook link</strong></h3><p><a href="https://colab.research.google.com/drive/1dgwYeziZiDBCkMcofYEvld8NToLYMnda?usp=sharing">Google Colab</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8127d2df271e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding gRPC with Go: A Powerful Duo for Microservices]]></title>
            <link>https://medium.com/@danielmalagurti/understanding-grpc-with-go-a-powerful-duo-for-microservices-ca2d0da02a58?source=rss-2ab867e00916------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca2d0da02a58</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[web-server]]></category>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[go]]></category>
            <dc:creator><![CDATA[Daniel Gaias Malagurti]]></dc:creator>
            <pubDate>Mon, 10 Jun 2024 18:44:25 GMT</pubDate>
            <atom:updated>2024-06-10T18:44:25.208Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7DIeFBqJTo2qFGVnP1UkQw.png" /></figure><p>In the landscape of modern software development, microservices architecture has gained significant traction. One of the critical components in such architectures is the communication protocol between different services. gRPC, a high-performance RPC framework developed by Google, has become a popular choice for this purpose. Coupled with Go, a language known for its efficiency and simplicity, gRPC offers a robust solution for building scalable and efficient microservices. This article delves into the strengths of gRPC with Go and provides practical examples to get you started.</p><h4>What is gRPC?</h4><p>gRPC stands for Google Remote Procedure Call. It is an open-source framework that uses HTTP/2 for transport, Protocol Buffers (protobuf) as the interface description language, and provides features such as authentication, load balancing, and more. gRPC is designed to make communication between services more efficient and straightforward.</p><h4>Why Use gRPC with Go?</h4><ol><li><strong>Performance and Efficiency</strong>: gRPC uses HTTP/2, which provides multiplexing of multiple requests over a single connection, reducing latency and improving overall performance. Go, known for its minimal resource usage and high performance, complements this by providing fast execution and efficient concurrency management.</li><li><strong>Strongly Typed Contracts</strong>: gRPC uses Protocol Buffers for defining service contracts. This ensures that the communication between client and server is type-safe, reducing the chances of runtime errors and making the system more robust.</li><li><strong>Bi-directional Streaming</strong>: gRPC supports streaming in both directions. This is particularly useful for applications that require real-time data exchange, such as chat applications, live data feeds, and IoT.</li><li><strong>Ease of Use</strong>: The combination of Go’s simplicity and gRPC’s straightforward service definitions makes the development process intuitive and efficient.</li></ol><h4>Setting Up gRPC with Go</h4><p>Let’s walk through a simple example to illustrate how to set up a gRPC service in Go.</p><p>Step 1: Install Dependencies</p><p>First, install the necessary tools. You’ll need the Protocol Buffers compiler (protoc) and the Go plugins for gRPC and protobuf.</p><pre># Install Protocol Buffers compiler<br>brew install protobuf<br><br># Install Go plugins for gRPC and Protocol Buffers<br>go install google.golang.org/protobuf/cmd/protoc-gen-go@latest<br>go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest<br><br># Ensure the binaries are in your PATH<br>export PATH=&quot;$PATH:$(go env GOPATH)/bin&quot;</pre><p>Step 2: Define the Service</p><p>Create a .proto file to define your gRPC service and messages. Let&#39;s call it helloworld.proto.</p><pre>syntax = &quot;proto3&quot;;<br><br>package helloworld;<br><br>service Greeter {<br>  rpc SayHello (HelloRequest) returns (HelloReply);<br>}<br><br>message HelloRequest {<br>  string name = 1;<br>}<br><br>message HelloReply {<br>  string message = 1;<br>}</pre><p>Step 3: Generate Go Code</p><p>Use the protoc command to generate Go code from the .proto file.</p><pre>protoc --go_out=. --go-grpc_out=. helloworld.proto</pre><p>This will generate two files: helloworld.pb.go and helloworld_grpc.pb.go.</p><p>Step 4: Implement the Server</p><p>Create a Go file to implement the server. Let’s name it server.go.</p><pre>package main<br><br>import (<br>  &quot;context&quot;<br>  &quot;log&quot;<br>  &quot;net&quot;<br><br>  &quot;google.golang.org/grpc&quot;<br>  pb &quot;path/to/helloworld&quot;<br>)<br><br>type server struct {<br>  pb.UnimplementedGreeterServer<br>}<br><br>func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {<br>  return &amp;pb.HelloReply{Message: &quot;Hello &quot; + in.Name}, nil<br>}<br><br>func main() {<br>  lis, err := net.Listen(&quot;tcp&quot;, &quot;:50051&quot;)<br>  if err != nil {<br>    log.Fatalf(&quot;failed to listen: %v&quot;, err)<br>  }<br>  s := grpc.NewServer()<br>  pb.RegisterGreeterServer(s, &amp;server{})<br>  if err := s.Serve(lis); err != nil {<br>    log.Fatalf(&quot;failed to serve: %v&quot;, err)<br>  }<br>}</pre><p>Step 5: Implement the Client</p><p>Create another Go file to implement the client. Let’s call it client.go.</p><pre>package main<br><br>import (<br>  &quot;context&quot;<br>  &quot;log&quot;<br>  &quot;os&quot;<br>  &quot;time&quot;<br><br>  &quot;google.golang.org/grpc&quot;<br>  pb &quot;path/to/helloworld&quot;<br>)<br><br>func main() {<br>  conn, err := grpc.Dial(&quot;localhost:50051&quot;, grpc.WithInsecure(), grpc.WithBlock())<br>  if err != nil {<br>    log.Fatalf(&quot;did not connect: %v&quot;, err)<br>  }<br>  defer conn.Close()<br>  c := pb.NewGreeterClient(conn)<br><br>  name := &quot;world&quot;<br>  if len(os.Args) &gt; 1 {<br>    name = os.Args[1]<br>  }<br>  ctx, cancel := context.WithTimeout(context.Background(), time.Second)<br>  defer cancel()<br><br>  r, err := c.SayHello(ctx, &amp;pb.HelloRequest{Name: name})<br>  if err != nil {<br>    log.Fatalf(&quot;could not greet: %v&quot;, err)<br>  }<br>  log.Printf(&quot;Greeting: %s&quot;, r.GetMessage())<br>}</pre><p>Step 6: Run the Server and Client</p><p>Start the server:</p><pre>go run server.go</pre><p>In a new terminal, run the client:</p><pre>go run client.go</pre><p>You should see the greeting message output in the client terminal.</p><h4>Conclusion</h4><p>gRPC, when combined with Go, offers a powerful and efficient solution for building microservices. With features like bi-directional streaming, strong typing, and high performance, gRPC is an excellent choice for scalable and robust service communication. By following the steps outlined in this article, you can set up a basic gRPC service in Go and start leveraging the strengths of this powerful duo in your projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca2d0da02a58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Overview of Key Deep Learning Algorithms and Their Applications]]></title>
            <link>https://medium.com/@danielmalagurti/an-overview-of-key-deep-learning-algorithms-and-their-applications-e55e527ad1a1?source=rss-2ab867e00916------2</link>
            <guid isPermaLink="false">https://medium.com/p/e55e527ad1a1</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[keras]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Daniel Gaias Malagurti]]></dc:creator>
            <pubDate>Thu, 06 Jun 2024 14:16:34 GMT</pubDate>
            <atom:updated>2024-06-06T14:16:34.322Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iovDnsi4UJO2gBf_dfl9eg.png" /></figure><h3>Introduction to Deep Learning</h3><p>Deep learning, a subset of machine learning, has revolutionized numerous fields by enabling machines to learn from vast amounts of data and make predictions or decisions. It involves the use of neural networks with many layers (hence “deep” learning) to model complex patterns in data. This technology powers many modern applications, from voice assistants and image recognition to autonomous vehicles and recommendation systems. In this article, we will explore some of the key algorithms in deep learning, their employability, and the frameworks in which they can be found.</p><h3>Key Deep Learning Algorithms</h3><h3>1. Convolutional Neural Networks (CNNs)</h3><p><strong>Employability:</strong> CNNs are primarily used in image processing tasks such as image recognition, object detection, and segmentation. They are also employed in video analysis and certain types of signal processing.</p><p><strong>Frameworks:</strong></p><ul><li>TensorFlow</li><li>PyTorch</li><li>Keras</li></ul><h3>2. Recurrent Neural Networks (RNNs)</h3><p><strong>Employability:</strong> RNNs are designed for sequential data and are widely used in natural language processing (NLP) tasks like language modeling, machine translation, and speech recognition. They are also used in time series prediction and music composition.</p><p><strong>Frameworks:</strong></p><ul><li>TensorFlow</li><li>PyTorch</li><li>Keras</li></ul><h3>3. Long Short-Term Memory Networks (LSTMs)</h3><p><strong>Employability:</strong> LSTMs are a special kind of RNN capable of learning long-term dependencies. They are highly effective in NLP tasks, such as text generation, sentiment analysis, and speech recognition, as well as in time series forecasting.</p><p><strong>Frameworks:</strong></p><ul><li>TensorFlow</li><li>PyTorch</li><li>Keras</li></ul><h3>4. Generative Adversarial Networks (GANs)</h3><p><strong>Employability:</strong> GANs are used to generate synthetic data that resembles real data. Applications include image generation, video generation, and data augmentation. GANs are also being explored in fields such as healthcare for generating medical images and in finance for creating synthetic financial data.</p><p><strong>Frameworks:</strong></p><ul><li>TensorFlow</li><li>PyTorch</li></ul><h3>5. Transformer Networks</h3><p><strong>Employability:</strong> Transformers are now the backbone of many state-of-the-art NLP models, including BERT and GPT-3. They excel in tasks such as language translation, text summarization, and question answering.</p><p><strong>Frameworks:</strong></p><ul><li>TensorFlow</li><li>PyTorch</li><li>Hugging Face Transformers</li></ul><h3>6. Autoencoders</h3><p><strong>Employability:</strong> Autoencoders are used for tasks such as data compression, denoising, and dimensionality reduction. They are also employed in anomaly detection and in generating new data samples.</p><p><strong>Frameworks:</strong></p><ul><li>TensorFlow</li><li>PyTorch</li><li>Keras</li></ul><h3>7. Reinforcement Learning (RL)</h3><p><strong>Employability:</strong> RL algorithms are used in decision-making tasks where an agent learns to perform actions in an environment to maximize cumulative reward. Applications include game playing (e.g., AlphaGo), robotics, and autonomous driving.</p><p><strong>Frameworks:</strong></p><ul><li>TensorFlow (TF-Agents)</li><li>PyTorch</li><li>OpenAI Gym</li></ul><h3>Conclusion</h3><p>Deep learning has transformed the landscape of artificial intelligence by providing powerful tools to learn from data and perform complex tasks. Each algorithm has its unique strengths and applications, making it crucial to choose the right one based on the specific requirements of a project. Frameworks like TensorFlow, PyTorch, and Keras provide robust environments to implement and experiment with these algorithms, enabling both researchers and practitioners to push the boundaries of what is possible with deep learning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e55e527ad1a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Boost Your Git Workflow with Left Hook: A Powerful Git Hook Manager for Go Projects]]></title>
            <link>https://medium.com/@danielmalagurti/boost-your-git-workflow-with-left-hook-a-powerful-git-hook-manager-for-go-projects-95591208971b?source=rss-2ab867e00916------2</link>
            <guid isPermaLink="false">https://medium.com/p/95591208971b</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Daniel Gaias Malagurti]]></dc:creator>
            <pubDate>Wed, 05 Jun 2024 18:24:50 GMT</pubDate>
            <atom:updated>2024-06-05T18:24:50.671Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3vBJsFOicV2i_b6_Qwy9vw.png" /></figure><p>Managing Git hooks can be a tedious task, especially when working on large-scale projects with multiple contributors. Enter <a href="https://github.com/Arkweid/lefthook">Left Hook</a>, a powerful and efficient tool written in Go that simplifies the process of managing Git hooks. Whether you’re looking to enforce coding standards, run tests, or automate tasks, Left Hook has got you covered.</p><h4>What is Left Hook?</h4><p>Left Hook is an open-source Git hook manager that provides a fast and flexible way to manage and execute Git hooks. It allows developers to write hooks in any language and execute them efficiently, helping teams maintain code quality and streamline their workflows.</p><h4>Key Features</h4><ul><li><strong>Speed and Efficiency</strong>: Left Hook is optimized for performance, ensuring that hooks run quickly without slowing down your workflow.</li><li><strong>Easy Configuration</strong>: With simple YAML configuration files, setting up and managing hooks is straightforward and intuitive.</li><li><strong>Language Agnostic</strong>: Write hooks in any language you prefer — Left Hook will handle the execution.</li><li><strong>Parallel Execution</strong>: Run multiple hooks in parallel to save time during commit and push processes.</li></ul><h4>Installing Left Hook</h4><p>Getting started with Left Hook is simple. Follow these steps to install and configure it in your Go project:</p><ol><li><strong>Install Left Hook</strong></li></ol><ul><li>You can install Left Hook using go get or a package manager like Homebrew (for macOS users):</li></ul><pre>go install github.com/arkweid/lefthook@latest</pre><p>2. <strong>Initialize Left Hook in Your Repository</strong></p><ul><li>After installation, initialize Left Hook in your Git repository:</li></ul><pre>lefthook install</pre><p>3. <strong>Configure Git Hooks</strong></p><ul><li>Create a .lefthook directory in your project root and add YAML files to configure your hooks. Here’s an example configuration for running lint checks and tests before a commit:</li></ul><pre>pre-commit:<br>  scripts:<br>    lint:<br>      runner: golangci-lint run<br>    test:<br>      runner: go test ./...</pre><p><strong>4. Automate Push Hooks</strong></p><ul><li>You can also configure hooks to run before pushing code to the repository. For instance, to ensure lint checks and tests pass before a push, add the following configuration:</li></ul><pre>pre-push:<br>  scripts:<br>    lint:<br>      runner: golangci-lint run<br>    test:<br>      runner: go test ./...</pre><h4>Enhancing Your Go Project with Left Hook</h4><p>Let’s put Left Hook into action. Suppose you have a Go project and you want to ensure that all code meets the linting standards and passes the tests before pushing to the repository. Here’s a step-by-step guide to setting this up:</p><ol><li><strong>Install Go Tools</strong></li></ol><ul><li>Ensure you have golangci-lint installed for linting and Go’s testing tools:</li></ul><pre>go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest</pre><p><strong>2. Add Configuration Files</strong></p><ul><li>Create the necessary configuration files in the .lefthook directory. For example, create .lefthook/pre-push.yaml with the following content:</li></ul><pre>pre-push:<br>  scripts:<br>    lint:<br>      runner: golangci-lint run<br>    test:<br>      runner: go test ./...</pre><p><strong>3. Test Your Setup</strong></p><ul><li>Make some changes to your code and try committing and pushing. Left Hook will automatically run the specified scripts, ensuring your code adheres to the defined standards.</li></ul><h4>Conclusion</h4><p>By integrating Left Hook into your Go projects, you can automate essential tasks, maintain high code quality, and streamline your development workflow. Its ease of use, speed, and flexibility make it an indispensable tool for any development team.</p><p>Start using Left Hook today and experience the benefits of automated Git hooks in your projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95591208971b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhancing Web API Security: Essential Open-Source Tools for Tech Leads: Part 6— Postman]]></title>
            <link>https://blog.stackademic.com/enhancing-web-api-security-essential-open-source-tools-for-tech-leads-part-6-postman-ff1e201069f8?source=rss-2ab867e00916------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff1e201069f8</guid>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[postman]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Daniel Gaias Malagurti]]></dc:creator>
            <pubDate>Tue, 14 May 2024 23:49:19 GMT</pubDate>
            <atom:updated>2024-05-14T23:52:39.453Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXgk5ZtMtgbL5NB6hEwk0Q.png" /></figure><p>While Postman is widely recognized as a powerful tool for API development and testing, it also offers significant capabilities for API security testing. By crafting specific HTTP requests, tech leads and developers can probe API endpoints for vulnerabilities, ensuring robust error handling and effective authentication mechanisms. This article will explore how to use Postman for security testing, specifically focusing on a Go API with known vulnerabilities.</p><p>Overview of Postman for Security Testing Postman allows users to send various types of HTTP requests to API endpoints and observe the responses. This capability is crucial for security testing as it can help identify how well the API handles unexpected input, manages authentication, and more.</p><p>Step-by-Step Guide to Using Postman for Testing the Go Vulnerable API</p><h3>Step 1: Set Up Postman</h3><ol><li>Download and Install Postman</li></ol><ul><li>Visit the <a href="https://www.postman.com/downloads/">Postman website</a> and download the version suitable for your operating system.</li><li>Install and open Postman.</li></ul><h3>Step 2: Configure the API Requests</h3><ol><li>Create a New Collection</li></ol><ul><li>In Postman, create a new collection for your API tests. This helps organize your requests and responses.</li></ul><p>2. Add Requests to the Collection</p><ul><li>For each endpoint in your Go API, create a corresponding request in Postman. Here’s how to set up a few key requests:</li></ul><p>GET /users</p><ul><li>Method: GET</li><li>URL: <a href="http://localhost:8080/users">http://localhost:8080/users</a></li><li>Purpose: Tests how the API lists users and checks for unauthorized data leakage.</li></ul><p>POST /users</p><ul><li>Method: POST</li><li>URL: <a href="http://localhost:8080/users">http://localhost:8080/users</a></li><li>Body: Set to raw JSON and input {&quot;name&quot;: &quot;&lt;script&gt;alert(&#39;XSS&#39;)&lt;/script&gt;&quot;, &quot;email&quot;: &quot;test@example.com&quot;}</li><li>Purpose: Checks for Cross-Site Scripting (XSS) vulnerabilities and how the API handles unexpected input.</li></ul><p>GET /users/:id</p><ul><li>Method: GET</li><li>URL: http://localhost:8080/users/1 OR 1=1</li><li>Purpose: Attempts SQL injection to see if the API improperly handles input leading to potential data breaches.</li></ul><h3>Step 3: Send Requests and Analyze Responses</h3><ol><li>Execute Each Request</li></ol><ul><li>Run each request in the collection and observe the responses.</li><li>Look for unexpected status codes, unauthorized data exposure, error messages that reveal too much information, or any signs of the API mishandling the request.</li></ul><p>2. Document Findings</p><ul><li>Record any vulnerabilities or issues discovered during testing. Note the conditions under which they occur and potential impacts.</li></ul><h3>Step 4: Remediate and Retest</h3><ol><li>Address Vulnerabilities</li></ol><ul><li>Based on your findings, make necessary code adjustments in your Go API to mitigate the vulnerabilities.</li><li>For example, implement proper input validation to protect against SQL injection and XSS.</li></ul><p>2. Retest the Endpoints</p><ul><li>After making changes, retest the endpoints using the same Postman requests to ensure that the vulnerabilities have been effectively resolved.</li></ul><p>Conclusion Using Postman for security testing is a practical approach that leverages its request crafting and response handling capabilities to uncover potential security weaknesses in APIs. By methodically testing each endpoint and analyzing the responses, developers can significantly enhance the security of their APIs. This proactive measure is crucial in developing secure applications that can resist common attacks and protect sensitive data.</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a><strong> | </strong><a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a><strong> | </strong><a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a><strong> | </strong><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io"><strong>In Plain English</strong></a><strong> | </strong><a href="https://cofeed.app/"><strong>CoFeed</strong></a><strong> | </strong><a href="https://venturemagazine.net/"><strong>Venture</strong></a><strong> | </strong><a href="https://blog.cubed.run"><strong>Cubed</strong></a></li><li>Tired of blogging platforms that force you to deal with algorithmic content? Try <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://stackademic.com"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff1e201069f8" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/enhancing-web-api-security-essential-open-source-tools-for-tech-leads-part-6-postman-ff1e201069f8">Enhancing Web API Security: Essential Open-Source Tools for Tech Leads: Part 6— Postman</a> was originally published in <a href="https://blog.stackademic.com">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>