Category

Programming Tutorials and Coding Guides

Explore programming tutorials with practical examples across multiple languages, scripting, and development concepts for beginners and advanced users.

Welcome to the Programming tutorials section, where you will learn coding concepts with real-world examples across multiple languages and platforms.

This category includes beginner to advanced guides covering scripting, automation, and application development in Java, JavaScript, Python, Go, TypeScript, and related stacks.

Whether you are learning programming for system administration or building applications, browse the articles below for practical examples and language-specific references.

Programming plays a crucial role in modern infrastructure and DevOps workflows. You can also explore DevOps and Linux to see how code integrates with system-level operations.

956 articles

Programming category illustration with code editor, automation, and debugging graphics
programming

FileNotFoundError in Python: Causes, Fixes, and Path Examples

Learn what FileNotFoundError (No such file or directory, errno 2) means in Python, why it happens even when the file seems to exist, and how to fix it with correct paths, working directory, pathlib, symlinks, and …

Deepak Prasad10 min read
programming

Golang Kill Process by PID: Process.Kill, Signal, and CommandContext

Terminate processes from Go by PID or child PID: os.Process and os.FindProcess, Process.Kill vs Process.Signal (SIGTERM vs SIGKILL), stopping commands started with os/exec, timeouts with exec.CommandContext, graceful …

Deepak Prasad9 min read
programming

How to Concatenate Tensors in PyTorch: torch.cat, stack, and shapes

Learn how to concatenate tensors in PyTorch with torch.cat along dim 0 or 1, torch.concat and torch.concatenate aliases, shape rules, stack vs cat, device errors, and a quick reference table.

Bashir Alam7 min read
programming

strconv in Go: parse, format, quote, and common errors

strconv in Go: parse and format integers, floats, and bools, Quote and Unquote, bases with FormatUint and ParseInt, NumError with errors.Is, and when to prefer strconv over fmt.Sscanf.

Deepak Prasad7 min read
programming

Check if a string contains a substring in Go (strings.Contains)

strings.Contains for literal UTF-8 substrings, case sensitivity and ToLower, match any or all needles, ContainsAny and ContainsRune, Index and HasPrefix or HasSuffix, empty substring behavior, and regexp only when you …

Deepak Prasad6 min read
programming

Golang SHA-512: Sum512, hex, files, streams, salt verify, and SHA-256 comparison

Golang SHA-512 with crypto/sha512: Sum512 and hex, sha512.New streaming io.Copy, file checksum verify, streams vs one-shot, salt-and-hash demo with verification caveats, SHA-512 vs SHA-256, HMAC, use cases, passwords …

Tuan Nguyen9 min read
programming

Golang Compare Strings: Equality, Ordering, and Case-Insensitive Match

Compare strings in Go with == and !=, lexicographic order with < and >, strings.EqualFold for case-insensitive match, strings.Compare for three-way results, and trimming input before comparing.

Tuan Nguyen5 min read
programming

Golang Command Line Arguments: os.Args, Flags, and Examples

Read command-line arguments in Go with os.Args, use the flag package for named options, validate positional args, parse numbers safely, and understand go run vs a compiled binary.

Tuan Nguyen6 min read
programming

What Is Ampersand in Golang? & and * Pointer Operators Explained

Learn what ampersand means in Go, how & gets a variable address, how * works with pointers, and how & and * are used together in simple examples.

Tuan Nguyen4 min read
programming

Golang Variable Scope: Local, Package-Level, Global, and Block Scope

Learn variable scope in Go, including local variables, package-level variables, global-style variables, block scope, short declarations, shadowing, and best practices.

Deepak Prasad7 min read
programming

Go Import Underscore Explained: Blank Imports and Side Effects

Learn why Go uses underscore before an import path, how blank imports work, when packages are imported for side effects, and how this relates to unused import errors.

Tuan Nguyen8 min read
programming

Golang Web Server Tutorial: Build and Configure an HTTP Server in Go

Learn how to build a Go web server using net/http, configure routes, handlers, ports, timeouts, static files, JSON responses, and graceful shutdown.

Deepak Prasad13 min read
programming

Golang Closure Function: Closures, Captured Variables, and Performance

Learn closures in Go: function values that capture outer variables, how they differ from anonymous functions, returned functions and state, goroutine loop pitfalls, and golang closure performance and escape analysis.

Deepak Prasad6 min read
programming

Golang WaitGroup: sync.WaitGroup Example, Add, Done, and Wait

Learn how to use sync.WaitGroup in Go to wait for goroutines, with Add, Done, Wait, WaitGroup.Go, common mistakes, and practical examples.

Antony Shikubu7 min read
programming

Golang Buffered Channel: Capacity, Blocking, and Buffered vs Unbuffered

Learn buffered channels in Go: make(chan T,n) capacity, len and cap, when send and receive block, buffered vs unbuffered channels, backpressure, deadlocks, choosing buffer size, and practical patterns.

Deepak Prasad5 min read
programming

Import Local Package in Go Without GOPATH: Step-by-Step Go Modules Example

Learn how to import a local Go package without GOPATH using go.mod, module paths, subfolders, exported names, replace directives, and go.work.

Tuan Nguyen8 min read
programming

Golang SHA-256: Sum256, hex, files, streams, verification, and security notes

Golang SHA-256 with crypto/sha256: Sum256 and hex, sha256.New streaming io.Copy, file checksums and verification, compare files, subtle comparison, HMAC sign/verify, MD5 vs SHA-1 vs SHA-256, passwords use bcrypt; quick …

Tuan Nguyen10 min read
programming

Golang Channel with Multiple Receivers: Workers, Fan-Out, and Safe Closing

Learn how multiple goroutines read from the same Go channel: each value is received once, fan-out worker pools, closing rules, result channels, buffered vs unbuffered, and why this is not broadcast.

Antony Shikubu8 min read
programming

Golang Regexp Tutorial: Match, Find, Replace, and Extract Regex Groups

Learn how to use regex in Go with the regexp package, including MatchString, Compile, MustCompile, FindString, submatches, ReplaceAllString, Split, and common mistakes.

Deepak Prasad9 min read
programming

Golang Slice Contains and Find Index: Contains, Index, and IndexFunc

Learn how to check if a Go slice contains a value, find the index of an element, search by condition with IndexFunc, and choose between slices, loops, and maps.

Tuan Nguyen15 min read
programming

Goroutine vs Thread in Go: Are Goroutines the Same as Threads?

Understand the difference between goroutines and OS threads in Go, how the Go runtime scheduler maps goroutines onto threads, and why goroutines are lightweight.

Deepak Prasad9 min read
programming

Golang Anonymous Struct: Inline Structs, JSON, Methods, and Return Values

Learn anonymous structs in Go: inline struct syntax, JSON tags, slices and maps, returning unnamed struct types, why methods attach to named types, embedding vs anonymous fields, and when to use a named struct.

Tuan Nguyen7 min read
programming

Golang import local package: modules, paths, and another directory

Golang import local package and go import local package with Go modules: golang import package from another directory under the module root, golang use local package and golang local package import paths, golang import …

Tuan Nguyen3 min read
programming

Golang functions: syntax, parameters, returns, methods, closures, and defer

Golang function guide: overview, syntax and naming, declaring and calling, single and multiple returns, errors and pointers, pass by value vs pointer, struct map slice channel, variadic pointer to variadic article, …

Antony Shikubu10 min read
programming

Golang Fan-Out Fan-In Pattern: Goroutines, Channels, and Worker Pools

Learn the fan-out fan-in pattern in Go with goroutines and channels: distribute work, merge results, relate it to worker pools, handle errors and cancellation, preserve ordering when needed, and close channels safely.

Antony Shikubu11 min read
programming

Best Go Web Frameworks: Gin, Echo, Fiber, Chi, and net/http Compared

Compare popular Go web frameworks including Gin, Echo, Fiber, Chi, Beego, and net/http. Learn which framework fits REST APIs, microservices, web apps, and high-performance services.

Tuan Nguyen8 min read
programming

Golang byte to int and []byte to int: strconv, binary, big.Int

Golang byte to int: uint8 widening, []byte ASCII to int with strconv.Atoi and validated ParseInt, math/big SetBytes for long unsigned magnitudes, encoding/binary Uint32 Uint64 and Read for int32, reverse int64 to []byte …

Tuan Nguyen5 min read
programming

Golang HTTP and HTTPS servers with net/http and ListenAndServeTLS

Golang http and go http with net/http: golang http server example using ListenAndServe and ServeMux, golang https server and https golang with http.ListenAndServeTLS, golang http module meaning the standard library …

Tuan Nguyen4 min read
programming

Golang portping: TCP checks with Ping and PingN (sequential, parallel, ranges)

Golang portping with janosgyerik/portping: set up module, Ping and PingN API, sequential and parallel TCP checks, port ranges, PingN result handling, retries, per-dial timing, CLI install, common dial errors; links to …

Deepak Prasad8 min read
programming

Golang Trim String: Remove Whitespace, Prefix, and Suffix

Trim strings in Go with strings.TrimSpace, strings.Trim, TrimPrefix, and TrimSuffix to remove whitespace, cutset characters, and exact prefixes or suffixes.

Antony Shikubu6 min read