SShortSingh.
Back to feed

Java Engineer Builds Python Countdown Timer CLI to Master Time Control and Exception Handling

0
·1 views

A Java developer documenting their journey learning Python from scratch has built a countdown timer command-line tool as the third project in their Python series. The tool lets users choose a countdown duration from a menu, ticking down one second at a time while overwriting the same terminal line using carriage return characters. The project focused on key Python concepts including time.sleep(), reverse loops with range(), and exception handling using try/except/finally blocks to manage interruptions like Ctrl+C. The developer also explored testing techniques such as mocking time.sleep to deliberately trigger exceptions and capturing standard output with pytest's capsys fixture. The article is part of an ongoing series where the author shares honest reflections on their learning process, clearly distinguishing between self-written code and AI-assisted guidance.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How to Build a Simple CI/CD Pipeline Using GitHub Actions on a VPS

A software developer has detailed how to set up a lightweight CI/CD pipeline using GitHub Actions to automate deployments of a Next.js app to a personal VPS. The pipeline consists of four sequential jobs — lint, security scan, Docker image build, and deployment — where each step must pass before the next begins. Security scanning is handled by Trivy, which checks for critical and high CVEs on every push and blocks the build if a fix is available, using the ignore-unfixed flag to avoid halting deployments over unresolvable vulnerabilities. Once the image passes all checks, it is pushed to GitHub's container registry and deployed to the VPS via SSH using Docker Compose. The author argues this approach delivers the same deployment convenience as managed platforms like Vercel while giving developers full visibility and control over what happens between a git push and a live container.

0
ProgrammingDEV Community ·

Developer Builds GitPulse to Visualize GitHub Activity as Cinematic Animations

A full-stack and AI/ML developer named Rahul Agarwal created GitPulse, a tool that transforms GitHub contribution data into visual, animated experiences rather than static grids. The project uses the GitHub API alongside the Canvas API and GSAP library to render commit history, stars, and pull requests as dynamic visuals. A standout feature called Stellar Duel lets users compare their GitHub activity against a friend's through an interactive, sci-fi-styled side-by-side display. The biggest technical hurdle was performance, which Agarwal addressed by batch-rendering elements on HTML5 Canvas and correctly implementing requestAnimationFrame to pause animations on inactive tabs. GitPulse is available as a live demo, with Agarwal's broader portfolio of AI/ML and computer vision projects hosted at his personal website.

0
ProgrammingDEV Community ·

Developer launches free UAE calculator platform pulling live government data

A UAE-based developer has built Adad, a free online platform offering 15 calculators covering common financial and administrative queries for residents. The tool draws data from official UAE government sources, including GDRFA, ICA, and UAE labour law, and refreshes every 24 hours to stay current. Calculators cover visa fees, zakat, DEWA electricity bills, and end-of-service gratuity, among others. The platform requires no sign-up and is available in eight languages at adad.ae. It was created out of frustration with outdated information typically found through general web searches.

0
ProgrammingDEV Community ·

How to self-host a Next.js app on a VPS and escape Vercel's rising costs

A developer describes migrating Next.js projects from Vercel to a self-managed VPS after finding that costs climbed with traffic and serverless function usage. The approach uses a multi-stage Docker build with Next.js's standalone output mode, shrinking the production image from roughly 1 GB to around 200 MB. The final container runs as a non-root user, and static assets must be manually copied alongside the standalone server.js file or the app will load without CSS or images. Environment variables require careful handling: NEXT_PUBLIC_ values must be baked in at build time as Docker build arguments, while server-side secrets are injected at runtime via an env file. The author maintains a git-push-to-deploy workflow but retains full control over infrastructure costs and configuration.

Java Engineer Builds Python Countdown Timer CLI to Master Time Control and Exception Handling · ShortSingh