RSSAmplifier

Blog

Peter Kellner's Blog

Problem solver author teacher

peterkellner.netRSS feed ↗606 posts

Latest posts

Are MCP Servers Going Obsolete? No — But Skills Are Claiming Territory That Was Never Really Theirs

MCP servers aren't dying, but a real shift is happening. Many use cases that started as MCP servers are finding a better home in skills. Here's what's actually going on.

Understanding React's useEffectEvent: A Complete Guide to Solving Stale Closures

React 19.2's useEffectEvent hook eliminates the useRef workaround pattern for accessing latest state in Effects. Learn when and how to use it.

Using AI to Create Secure MySQL Password Rotation Scripts (Without Exposing Secrets)

How to leverage AI assistants to build password management scripts while keeping your actual credentials completely private.

Monitoring Dual ISP Status with SonicWall SNMP and Next.js

A real-time dashboard to monitor multiple ISP connections through a SonicWall firewall using SNMP, built with Next.js and TypeScript.

Bluesky Lists Integration For Silicon Valley Code Camp Speakers and Attendees

Announcing seamless Bluesky List integration for all Silicon Valley Code Camp participants.

A Clean .zshrc Startup Script for Setting Github and Docker API Keys on a Mac

In this blog post, we present a streamlined zshrc startup script on macOS that sets environment variables and logs into Docker in the background. We also explore how minimal logging and background execution can improve your workflow.

Replacing Legacy throw in React 19 with Suspense and use

React once used thrown Promises for Suspense. .use() is recommended now, but legacy throwing is still supported.

OBS Recording Resolution 4K Even Though Display is 1080P

Set OBS base resolution to 4K and output to 1080P to capture entire screen on Retina MacBooks.

Running React 19 From a CDN and using esm.sh

This blog explains updating to React 19 using esm.sh, transitioning from UMD to ESM modules. It includes changes in CDN usage, detailed esm.sh functionality, and how to find and use the correct React package versions.

Mastering useState in React to Handle Multiple Values

In this blog post, we explore using useState with React's Context API to manage an array of constants effectively in Next.js projects, offering a simpler alternative to useReducer for state management.

Understanding Environment Variable Pitfalls in Next.js

Next.js handles env vars at build time, causing issues like static values in runtime logic, necessitating careful planning and execution.

Enhancing React's Drag-and-Drop with State Management: A Deep Dive

Explore advanced React state management in drag-and-drop interfaces, leveraging `useRef` and state setters for responsive, interactive web applications.

Building a Drag-and-Drop Interface in React: Beyond Basic React

Explore drag-and-drop in React, leveraging `useRef` for direct DOM interactions and efficient state management in interactive applications.

The Importance of CSS Visibility,Visible vs. Hidden in React

Using CSS `visibility: hidden` instead of rendering `null` in React ensures stable layouts and improves UX by maintaining consistent UIs, showcasing precision.

Lessons Learned Using ChatGPT for React Programming

Using ChatGPT for React programming offers valuable insights but requires careful management of component size, adherence to code optimizations, clear instructions, and regular review. It's crucial to balance AI assistance with manual oversight to ensure performance and maintain coding standards.

Enhancing Security in Next.js with NextAuth, A Guide to Protected Pages

Integrating the WithAuth component in Next.js applications fortifies pages against unauthorized access, enhancing user experience by ensuring sensitive content remains invisible to unauthenticated users, leveraging TypeScript's type safety and React's best practices for a robust development approach.

Building a Multilingual Static Site with Next.js 14

Learn to build a fast, multilingual site with Next.js 14. Preload translations for instant switches and improved SEO. Full guide and code on GitHub.

Converting Blog From jekyl to astro

Just an a public service announcement that I've converted my blog peterkellner.net from Jekyl to AstroBuild,still on Github Pages

Can ChatGPT Reason? A Real-Life Example, You Decide

This blog post provides a concise yet informative overview of ChatGPT's reasoning abilities, its applications, and its implications in various fields, tailored for an audience interested in AI and its real-world applications.

My TypeScript Skills Improving and Best Practices

I improved my TypeScript skills by resolving a bug in a REST service, learning the importance of proper type assertions and error handling in Prisma database interactions.

Silicon Valley Code Campfire Software Architecture Event Summary

Silicon Valley Code Campfire Software Architecture Event Summary

Understanding OBS Backup Server Transition and Quick Reconnection Strategy

When streaming with OBS and using a backup server, transitioning back to the primary server can be slow as it doubles the reconnection wait time each attempt. A workaround involves stopping the stream while disconnected, then reconnecting to the internet and resuming the stream, although this method has limitations.

Effective Development Process with Two Branches, Dev and Prod

Transitioning a significant web platform, such as the SiliconValley-CodeCamp.com website, is no small feat. As I delve deep into modernizing the site, I've taken on the challenge of porting it to Next.js 13, leveraging the power of React and the latest addition of server components. The magnitude of this change underscores the necessity of a meticulous and reliable development process. Even as a…

ChatGPT Can Be Lazy And Not Think Out of the Box

Navigating ChatGPT for database queries can be frustrating. In one instance, ChatGPT's solution for counting rows in a Prisma model proved problematic. Despite clarifications, the AI missed the mark, revealing its inability to completely rethink a problem. This behavior highlighted its shortcomings, resembling an approach worse than what one might expect from a junior programmer.

Handling Query Parameters in Next.js 13 React Server Components

Next.js has always been at the forefront of providing streamlined experiences for React developers. With the introduction of React Server Components in Next.js 13, the framework has unlocked even greater potential. One of the standout features of these server components is their ability to manage server-side logic directly, eliminating the need for separate API routes. This integration streamlines…

Redis Explained, Memory Metrics and Performance Insights

Redis is an unmistakable presence in the world of databases, particularly for its blazing speed. But what’s the secret sauce behind its quicksilver performance? Today, we're going to shed some light on Redis's in-memory operations, determine how to gauge its memory consumption, and decipher some of the enigmatic metrics it yields.

ChatGPT for Code Reviews Accurate but Lacks Initiative

ChatGPT can be an asset in code review but lacks the instinct to suggest improvements or identify gaps that a junior developer might easily catch. While it does what it's told, don't expect it to go above and beyond.

Using Prisma with TypeScript for Rapid Database Query Testing

Prisma, paired with TypeScript and Node.js, empowers developers with a swift, direct-to-console query testing environment. This streamlined approach facilitates quick prototyping and refinement, eliminating the need for complex service or web page integration. It's a modern developer's toolkit for effortless database interactions, offering a rapid feedback loop for the perfect query. Dive in and…

Using Prisma to Bridge JavaScript Devs to Databases with Elegance

Confused about Prisma's approach to database joins and when to use raw SQL versus native functions? Dive into this post for clarity. We demystify Prisma's handling of database relationships and guide you on when to leverage the precision of raw SQL within the Prisma ecosystem

Leveraging AI to Iteratively Improve Code Quality

In today's blog, we look at how AI, particularly ChatGPT, can be an invaluable collaborator in the software development process. The case in point? Creating and iteratively improving an email obfuscator for the large-scale event, Silicon Valley Code Camp. This isn't just about generating code; it's a deep dive into enhancing code quality and boosting developer productivity.

Managing Job Queues in Bull While Preventing Log Clutter from Unprocessed Jobs

This blog post explores how to efficiently manage job queues in Bull, focusing on a specific use case, email processing. We delve into the nuances of serial queue processing and discuss strategies to prevent unnecessary log clutter from jobs that find no work to execute.

Managing Redis Memory Limits in Docker-Compose

This blog post serves as a comprehensive guide on managing Redis memory limits using a Docker Compose file. It covers the risks of not setting a memory limit—like uncontrolled memory growth and resource contention—as well as the potential downsides of setting one, such as data eviction. The post provides step-by-step instructions to modify the docker-compose.yml file, allowing for memory…

How to Determine Disk Space Usage in MySQL

This blog post serves as a beginner-friendly guide to understanding disk space utilization in MySQL databases. It provides a step-by-step approach to find the size of individual tables within a specific schema and extends that to summarizing disk space for all schemas. Using simple SQL queries executed in MySQL Workbench, you can acquire both table-level and schema-level size metrics, essential…

Replacing Label Fields with Aria-Label, A Focus on Accessibility

In web forms, both `label` and `aria-label` aim to improve accessibility. However, using `aria-label` can make your code more efficient, reducing 9 lines of uncommented code to just 6. While `label` enhances user experience with clickable areas, `aria-label` offers a streamlined, yet accessible, alternative.

How to Use Google's ReCaptcha V3 with NextJS 13 and the New App Router

Want to enhance your NextJS 13 app's security? Learn how to seamlessly integrate Google's Invisible ReCaptcha V3. We'll walk you through the client and server-side code and explore NextJS 13's new App Router. Say goodbye to spam and hello to a cleaner user experience. Happy coding! 🚀

State Management in React Applications Through URL Hashes

Managing state in React applications can be streamlined using URL hashes. This article explores this concept with two examples—a basic toggle switch and a cookie catalog. We discuss the benefits of this method, including enhanced user experience and compatibility with server-side rendering. Learn how to maintain state effectively across React components.

Resolving TypeScript Import Errors in Next.js

In the realm of modern web development, Next.js combined with TypeScript offers a potent mix of features. However, even this powerful stack can sometimes throw you for a loop with elusive errors. One such issue pertains to import statements, with TypeScript complaining about missing baseUrl during the build process, but giving no warnings in your IDE. This article delves deep into this specific…

Simplifying JavaScript Dictionary Creation with reduce in TypeScript

This blog post explores how to use reduce in TypeScript for efficiently converting an array into a dictionary, comparing it with the more traditional forEach approach. It also discusses coding best practices and cyclic redundancy.

How ChatGPT Scares Me When Writing Code

Discover the risks of using ChatGPT for code generation in TypeScript development. Learn from my experience where seemingly flawless code led to unexpected issues, and why thorough testing is crucial.

Accelerating Data Access with Indexed Arrays in Prisma

Learn how to transform a Prisma table into an indexed array for rapid data access. Perfect for small tables, we deep-dive into using JavaScript's reduce() function to optimize performance. Get hands-on examples, including a custom createIndexedArray() function. Speed up your data game today.

Mastering Prisma Logging with Dynamic Configuration

Master the art of flexible, dynamic logging in your Prisma setup with a powerful function—`getPrismaOptions()`. This function allows you to easily toggle between various logging levels without changing your code, offering a robust, maintainable, and environment-sensitive way to manage database operations. Learn how to set this up using an `.env` file, and understand why this approach can be a…

Converting PascalCase to CamelCase in JavaScript Records Using TypeScript

When you're knee-deep in data transformations, the little things like converting object keys from PascalCase to camelCase can become surprisingly complex. But what if you're working with TypeScript and need to maintain that strong type checking? In our latest blog post, we delve into this very topic. We dissect TypeScript's `Record` type for maximum flexibility and robustness, explain how…

Building, Deploying, and Managing Docker Images with GitHub Actions

This tutorial guides you on how to use Dockerfile, docker-compose, and GitHub Actions for building and deploying applications. It emphasizes the crucial role of DATABASE_URL in the Dockerfile, enabling different connection strings during build and runtime.

Enforcing SSL Connections in MySQL using Docker

In this guide, we secure a MySQL server to accept only SSL connections, minimizing the risk of data exposure. This setup ensures our apps connect securely, protecting sensitive data. By focusing on database connection security, we take a crucial step towards building trusted applications.

Understanding TypeScript's Powerful Type Assertions Through Practical Examples

Leverage TypeScript type assertions for dynamic, adaptable object types.

Creating a Custom React Context Provider

Create a reusable React Context Provider in Next.js for managing a searchable cookie list.

Migrating from useState to useReducer, Building a Counter in a Next.js App

In this tutorial, we migrated from useState to useReducer while building a counter interface in a Next.js app. This helps manage state updates more efficiently and scales better as app complexity grows. Additional tips include extracting the reducer, using the Context API for global state, adding custom middleware, and exploring other hooks.

Understanding useRef and useState for Tracking Component Render Count in React

This post explains useRef and useState usage in React by creating a custom hook to track component render count without extra re-renders. useRef stores render count while useState manages multiple state values independently, allowing efficient updates and improved code readability.

AI-driven Built-in Degradation and Enhancement in Next.js React Apps on Vercel

AI-driven degradation and enhancement in Next.js and Vercel empower developers to create adaptable, cost-effective web apps that seamlessly handle fluctuating loads and maintain a robust user experience.

Using useCallback Correctly in a Simple Next.js 13 Component

This post demonstrates using the useCallback hook in a Next.js 13 component for better performance. It shows how to create a simple Counter component with a button that increments the count, utilizing useCallback to avoid unnecessary re-renders.