Server content

    • Build with Naz : Capturing Real-Time Build Progress from Cargo Using PTY and OSC Sequences

      When building Rust projects, Cargo emits hidden OSC (Operating System Command) terminal control sequences that communicate build progress to compatible terminals like WezTerm. However, capturing these sequences programmatically is surprisingly tricky - standard process pipes won't work because Cargo only emits them when connected to a real TTY, and inheriting stdio bypasses your program entirely. This article explores how to use pseudo-terminals (PTY) with the portable-pty crate to create a virtual terminal that tricks Cargo into emitting OSC sequences while still allowing you to capture and parse them in real-time. We'll dive into the PTY architecture, understand why blocking I/O with cloned file descriptors causes hangs, and implement a production-ready solution using a detached task pattern that processes build progress events (0-100%) as they happen, not after the build completes.
    • Build with Naz : Rust, Memory performance & latency - locality, access, allocate, cache lines

      Moore’s Law, the observation that the number of transistors on a chip doubles roughly every 2 years, ended around 2015–2020. This means CPU bound code that runs slowly will run slowly on future CPUs. The traditional approach of Big-O analysis and algorithmic improvements is no longer accurate, since it only accounts for "op-count" and ignores the cost of memory access. Modern CPUs have many cores, but each core isn't getting any faster. So using parallelism is another way to get more performance. Let's explore memory performance and latency in Rust.
    • Build with Naz : TLS (Transport Layer Security) in Rust with tokio, rustls, CFSSL

      TLS is the backbone of web security. We will explore using TLS with Rust, and CFSSL to create a certificate authority to issue self signed certificates & keys. We will also create a server and client that communicate securely over the network using tokio and upgrade insecure TcpStream to TLSStream, and work with TLSAcceptor and TLSConnector.
    • Build with Naz : Diesel ORM, SQLite, and Rust

      SQLite is a great in-process database that supports concurrent processes. We will use Rust and Diesel ORM to create and run migrations, generate schemas and create more than one migration. We will also use Rust to perform CRUD operations and perform auto migrations.
    • Build with Naz : Rust lifetimes

      Rust lifetimes are key part of the type system which allows the Rust compiler to make its memory safety guarantees. We will explore subtyping, variance, references, memory aliasing, splitting borrows, and clone on write in this article, its video, and repo.
    • Build with Naz : Explore Linux TTY, process, signals w/ Rust

      This article, along with related videos and the repository, explores Linux TTY, shells, processes, sessions, jobs, PTYs, signals, and more using Rust. It explains /dev/tty and describes how terminal libraries like crossterm and termion build on top of stdio and /dev/tty. The article provides examples of using Rust to send and receive POSIX signals, communicate with processes via IPC, and spawn processes. Additionally, it includes examples of using PTY in Linux and controlling external commands (such as binaries like bash) using asynchronous Rust.
    • Build with Naz : Box and Pin exploration in Rust

      This tutorial, video, and repo are a deep dive into Rust `Pin` and `Box` types, along with concepts of ownership and borrowing. We will also cover a lot of background information on the concepts of operating system process, memory allocation and access, stack, and heap. The examples we create are designed to demonstrate the different semantics around the use of boxes and pinned boxes in Rust.
    • Build with Naz : Rust async in practice tokio::select!, actor pattern & cancel safety

      This tutorial, video, and repo are a deep dive into the concept of cancellation safety in async code using Tokio and Rust. It affects the `tokio::select!` macro, and what happens to the racing `Future`s that don't win. The examples provided here, along with the video, will go over both code that is is cancellation safe and code that is not. These examples reflect real-world patterns, and are a generalized form of them.
    • Build with Naz : Markdown parser in Rust and nom from r3bl_tui

      This tutorial and video are a deep dive in a real Markdown parser written using nom in Rust. This MD Parser is part of the r3bl_tui crate, which is part of the r3bl-open-core repo. It goes over the architecture of thinking about building complex parsers and the nitty gritty details the runtime nature and behavior when combining nom parsers.
    • Build with Naz : Rust error handling with miette

      miette is an excellent crate that can make error handling in Rust powerful, flexible, and easy to use. It provides a way to create custom error types, add context to errors, and display errors in a user-friendly way. In this article, video, and repo, we'll explore how to use miette to improve error handling in your Rust applications.
    • Build with Naz : Rust typestate pattern

      The Typestate Pattern in Rust is a way to manage objects that go through different states in their lifecycle. It leverages Rust's powerful type system to enforce these states and transitions between them, making your code safer and more predictable. Learn all about it in this article, its video, and repo.
    • Build with Naz : Linux io_uring and tokio-uring exploration with Rust

      Explore the Linux io_uring syscall with the tokio-uring crate in Rust. This article, video, and repo will show you how to use the tokio-uring do async file IO at the OS level, and how to use it to build a simple echo TCP server, for use with netcat.
    • Build with Naz : Rust async, non-blocking, concurrent, parallel, event loops, graceful shutdown

      In this article, video, and repo learn effective async Rust using real world patterns that show up consistently when creating non blocking, async, event loops, using channels. Delve into implementing the Future trait and async executor manually. Also explore graceful shutdown, when not to use async, and how to think about testing async code.
    • Build with Naz : tokio tracing & OTel and how to use it in Rust

      In this article, video, and repo learn how to use tokio tracing and OpenTelemetry (with Jaeger) in async Rust to instrument your code and collect telemetry data for observability.
    • Build with Naz : Rust Polymorphism, dyn, impl, using existing traits, trait objects for testing and extensibility

      Learn how to implement effective Rust polymorphism, using `dyn`, `impl`, existing traits, and trait objects for testing and extensibility, in real world projects.
    • Build with Naz : Build interactive and non blocking CLI apps with ease in Rust using r3bl_terminal_async

      The r3bl_terminal_async library lets your CLI program be asynchronous and interactive without blocking the main thread. Your spawned tasks can use it to concurrently write to the display output, pause and resume it. You can also display of colorful animated spinners ⌛🌈 for long running tasks. With it, you can create beautiful, powerful, and interactive REPLs (read execute print loops) with ease.
    • Write a simple netcat client and server in Rust

      A guide on how to a simple Rust netcat client and server
    • Write a simple TCP chat server in Rust

      A guide on how to create write a simple TCP chat server in Rust using Tokio
    • Build with Naz : Comprehensive guide to nom parsing

      This tutorial and video are a comprehensive guide to parsing with nom. We cover the basics of parsing and how to use nom to parse a string into a data structure. And more complex topics like human readable error reporting, and building up complex parsers. We will create a variety of different examples ranging from parsing simple CSS like syntax to a full blown Markdown parser.
    • Reference handbook for using Ink v3.2.0 components (w/ React, Node.js and TypeScript)

      This article is reference handbook for using Ink v3.2.0 (with TypeScript and React) components to create CLI apps. IDEA Ultimate / Webstorm project files are provided.
    • Advanced guide to Ink v3.2.0 (w/ React, Node.js and TypeScript)

      This article is an advanced guide to using Ink v3.2.0 (with TypeScript and React) to create CLI apps. IDEA Ultimate / Webstorm project files are provided.
    • Introduction to Ink v3.2.0 (w/ React, Node.js and TypeScript)

      This article is an introduction to using Ink v3.2.0 (with TypeScript and React) to create CLI apps. IDEA Ultimate / Webstorm project files are provided.
    • Node.js (v16.3.0) Handbook using TypeScript (v4.3.4)

      This handbook will use TypeScript to take you thru using Node.js. IDEA Ultimate / Webstorm project files are provided. This handbook is written as a reference. You can easily jump to the section that is relevant to you or read them in any order that you like.
    • Experimenting w/ Fibers in Project Loom preview

      This tutorial is an early exploration into Java Project Loom (preview technology)
    • Creating asynchronous servlets with Tomcat 7 (Servlet 3.0 API)

      Overall, the API is pretty straightforward to use, assuming that you are familiar with asynchronous processing in the first place. However, if you are not familiar with asynchronous processing, then this business of callbacks can be quite confusing and daunting. Additionally Tomcat 7 and Servlet API 3.0 make it easier to configure servlets using annotations. There are other cool features in 3.0 that I haven’t covered in this tutorial, like loading servlets programmatically.
    • Using JSON for mobile object exchange

      I've been working with various object encoding schemes to get information transferred over the network between services and mobile apps running on Android and BlackBerry. On Android, I figured I would try using Java object serialization, and that works some of the time, and not for anything complex. I wish the object serialization and deserialization mechanism in GWT would be ported over to all these mobile environments, but I digress. This tutorial outlines the use of JSON for this purpose.
    • Geocoding tutorial - Accessing Google Static Maps from Java

      Given an IP address, this tutorial will show you how to get a Google Static Map from it
    • What is XML? An introduction

      What is XML? This tutorial provides a brief review of the W3C XML 1.0 Recommendation itself.
    • Advanced Threads

      This tutorial is devoted to showing you advanced techniques of using threads to perform event driven tasks, without using polling, and usually with the use of queues. Along with techniques of managing life cycles of server objects (that are multithreaded) and runtime activation and deactivation of these objects.
    • XML and Java Tutorial, Part 1

      In this tutorial, we will create an XML document, the contents of which can be accessed using a JFC/Swing application and from a web browser (via a Servlet). The XML document is a very simplistic representation of an address book which stores the name, email and company name of people. The XML document is written manually, and its structure is known by the Swing application and the Servlet.

    Subscribe to RSS feed