Programming Tips πŸ’‘
54.5K subscribers
65 photos
8 videos
30 files
338 links
Programming:
Tips πŸ’‘
Articles πŸ“•
Resources πŸ‘Ύ
Design Patterns πŸ’Ž
Software Principles βœ…

πŸ‡³πŸ‡± Contact & Ads: @MoienTajik
Download Telegram
Media is too big
VIEW IN TELEGRAM
πŸš€ For those aiming to manage web & mobile apps in their .NET project, discover Bit. Experience seamless integration, PWA, SSR, SEO-friendly, optimized project templates, and a set of standard components. An open-source gem with an MIT license, tailored just for C# .NET enthusiasts.

Love it? Check out their GitHub repo and give them a ⭐!

Repository Link
Introducing .NET Aspire: Simplifying Cloud-Native Development with .NET 8 πŸ”₯

.NET Aspire is an opinionated stack for building resilient, observable, and configurable cloud-native applications with .NET. It includes a curated set of components enhanced for cloud-native by including service discovery, telemetry, resilience, and health checks by default. πŸ‘


Sample Usage:
var builder = DistributedApplication.CreateBuilder(args);

var cache = builder.AddRedisContainer("cache");

var apiservice = builder.AddProject<Projects.AspireApp_ApiService>("apiservice");

builder.AddProject<Projects.AspireApp_Web>("webfrontend")
.WithReference(cache)
.WithReference(apiservice);

builder.Build().Run();



[ Article ] : https://devblogs.microsoft.com/dotnet/introducing-dotnet-aspire-simplifying-cloud-native-development-with-dotnet-8

〰️〰️〰️〰️〰️〰️
#DotNET #AspNetCore #CSharp #Aspire
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
The System Design Primer βœ”οΈ

System design is a broad topic. There is a vast amount of resources scattered throughout the web on system design principles. 🎨

This repo is an organized collection of resources to help you learn how to build systems at scale.

Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards. πŸ†’

[ GitHub ] : https://github.com/donnemartin/system-design-primer


〰️〰️〰️〰️〰️〰️
#SystemDesign #Design #Scale #Interview
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ” Challenge: Create a compact Maze Game in C# under 2KB without .NET Runtime, Small enough to fit in a QR Code πŸ€”

πŸ‘¨β€πŸ’» Process:
β€’ Self-Contained: Includes all necessary components to run on any OS. βœ”οΈ

β€’ Game Type: A graphical maze, utilizing Win32 APIs, avoiding WinForms. ⭐️

β€’ Size Reduction Steps:
1- Initial Size: 64MB (with CoreCLR)
2- Post-Compression: 35.2MB
3- IL Trimming Applied: 10MB
4- Native AOT Compilation: 1.13MB
5- Removing Unused Features: 923KB
6- Using bflat Compiler: 882KB
7- bflat with Zerolib: 9KB
8- Direct PInvoke: 8KB
9- Eliminating Debugging and Relocations: 7KB
10- Targeting x86 Architecture: 6.5KB
11- Final Step with Crinkler Linker: 1,936 Bytes

πŸŽ‰ Outcome: Achieved a C# game small enough to fit in a QR code!


[ Full Article πŸ”— ] : https://migeel.sk/blog/2024/01/02/building-a-self-contained-game-in-csharp-under-2-kilobytes

〰️〰️〰️〰️〰️〰️
#CSharp #DotNet #Optimization #LowLevel
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
MeiliSearch: The Fast, Open-Source Search Engine πŸ”πŸš€

MeiliSearch is a powerful, open-source search engine written in Rust. Designed for speed and ease of use, it's the perfect choice for developers looking to implement search capabilities in their applications. πŸ”

Key Features:


β€’ Lightning-fast search responses ⚑️
β€’ Typo-tolerance for better user experience βœ”οΈ
β€’ Simple to set up and integrate πŸ› 
β€’ Customizable ranking rules for tailored search results πŸ”§
β€’ Open-source and fully documented πŸ“š


[ GitHub ] : https://github.com/meilisearch/meilisearch

〰️〰️〰️〰️〰️〰️
#MeiliSearch #SearchEngine
@ProgrammingTip
Spotube 🎸

Open source Spotify client that doesn't require Premium nor uses Electron! Available for both desktop & mobile! 🎧

Features βœ”οΈ:
β€’ 🚫 No ads
β€’ ⬇️ Downloadable tracks
β€’ πŸ–₯ πŸ“± Cross-platform support
β€’ πŸͺΆ Small size & less data usage
β€’ πŸ•΅οΈ Anonymous/guest login
β€’ πŸ•’ Time synced lyrics
β€’ βœ‹ No telemetry, diagnostics or user data collection
β€’ πŸš€ Native performance
β€’ πŸ“– Open source/libre software
β€’ πŸ”‰ Playback control is done locally, not on the server


[ GitHub ] : https://github.com/KRTirtho/spotube

〰️〰️〰️〰️〰️〰️
#OpenSource #Spotify
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
The ultimate guide for making the best career choices in Tech πŸ§‘πŸ»β€πŸ’»

Denilson Nastacio shares a structured framework for career success, likening it to Maslow's Hierarchy of Needs. He highlights the importance of aligning one's career with personal values and market demands, offering insights into the tech industry's evolving landscape. βœ”οΈ


Key Takeaways πŸ”‘:

β€’ Employability is foundational, emphasizing education, skills, and market relevance.

β€’ Compensation & Stability ensure job adequacy and a supportive environment.

β€’ Growth & Development demand continuous learning and skill enhancement.

β€’ Work-Life Balance & Well-Being focus on mental and physical health.

β€’ Purpose & Meaning represent the pinnacle, aligning personal values with professional careers.


[ Article ] : https://medium.com/@dnastacio/c18768d32598

〰️〰️〰️〰️〰️〰️
#Tech #CareerPath #Growth
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
Browserless | Headless browser automation, without the hosting headaches πŸ†’

Browserless allows remote clients to connect and execute headless work, all inside of docker. It supports the standard, unforked Puppeteer and Playwright libraries, as well offering REST-based APIs for common actions like data collection, PDF generation and more. βœ”

Sample 🐞:
import puppeteer from "puppeteer";

// Try changing this! πŸ‘‡
const URL = "https://t.me/s/ProgrammingTip";

const main = async () => {
const browser = await puppeteer.connect({
browserWSEndpoint: `wss://chrome.browserless.io`,
});
const page = await browser.newPage();
await page.goto(URL);

return page.screenshot();
}



[ GitHub ] : https://github.com/browserless/browserless
[ Website ] : https://www.browserless.io

〰️〰️〰️〰️〰️〰️
#E2E #Testing #Browserless #Docker
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
Vuestic Admin 3.0 πŸ”‘

Vuestic Admin is an open-source admin template based on Vue 3, Vite, Pinia, and Tailwind CSS, developed and supported by the Epicmax Team. It’s no longer just a collection of components; now, it’s packed with engaging, interactive pages designed to enhance your projects. πŸš€

What pages do developers most often need? Dashboard, Settings Page, Profile, User and Project List, Login, Billing, Pricing Plans β€” they are all already in Vuestic Admin. βœ”οΈ


Features πŸ”§:
β€’ Vue 3, Vite, Pinia, and Tailwind CSS - Fast and efficient development
β€’ Dark Theme - Modern and eye-catching
β€’ Global Configuration - Effortless customization
β€’ Accessibility - Inclusive and user-friendly
β€’ i18n Integration - Easy localization for global reach
β€’ Educational Resource - Ideal for learning and improving skills
β€’ Responsive Design - Adapts seamlessly to all devices
β€’ Professional Support - Reliable help from the experts
β€’ Highly Customizable - Tailor to your project’s style


[ Live Demo ] : https://admin.vuestic.dev
[ GitHub ] : https://github.com/epicmaxco/vuestic-admin

〰️〰️〰️〰️〰️〰️
#Vue #Vuestic #AdminPanel #Dashboard
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
Bloom Filters πŸ†’

Imagine ensuring web safety by identifying malicious links without storing massive data. Traditional methods involve keeping a huge list of bad links, consuming substantial storage and bandwidth. Enter Bloom Filters - a genius method allowing us to significantly reduce storage needs (up to 82% smaller) with a minimal error rate. πŸ‘Ύ

For instance, instead of a 20MB list for 1,000,000 links, a Bloom Filter achieves this with just 3.59MB, accepting a tiny error chance (0.0001%). Even more impressive, with a 0.1% error tolerance, the size shrinks to 1.8MB. This technique was even utilized by Google Chrome until 2012. βœ”οΈ

Bloom Filters offer a balance between efficiency and accuracy. For critical checks, it pairs with a database API for zero false positives. A practical, space-saving solution for modern web browsers! ⚑️


[ Article ] : https://samwho.dev/bloom-filters

〰️〰️〰️〰️〰️〰️
#Algorithm #BloomFilters
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
Amazon Interview Questions: The Ultimate Preparation Guide πŸ”–

Getting an interview at Amazon is a major accomplishment. With thousands of applicants every year and intense competition, securing an interview slot is an achievement in itself. Now you need to put in the work to make sure you ace the interview process. βœ”οΈ

In this comprehensive guide, we will cover everything you need to know to crush your Amazon interviews. ⚑️


[ Article ] : https://www.designgurus.io/blog/amazon-interview-questions-guide

〰️〰️〰️〰️〰️〰️
#Interview #Amazon
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
Introducing WireMock.NET: Master HTTP API Testing πŸš€

WireMock.NET simulates HTTP API behaviors, enabling seamless integration and testing for developers.

πŸ‘Œ Ideal Use Cases:

β€’ HTTP Dependencies Not Ready: Leap over the hurdle of incomplete HTTP APIs in microservice architectures by mimicking their behavior with WireMock.Net.

β€’ Unit Testing HTTP-Dependent Classes: Test classes that rely on HTTP APIs as a cohesive unit, ensuring your code communicates effectively with the actual APIs.

β€’ Integration/End-to-End Tests: Overcome the challenges of testing with external HTTP APIsβ€”like variable data, slow responses, and network restrictionsβ€”by employing WireMock.Net for consistent and swift testing.


public class ExternalService(HttpClient httpClient)
{
public async Task<string> GetAsync()
{
var response = await httpClient.GetAsync("/ping");
response.EnsureSuccessStatusCode();

return await response.Content.ReadAsStringAsync();
}
}

public class ExternalServiceTests
{
[Fact]
public async Task GetAsync_WhenCalled_ReturnsString()
{
// Arrange
var fakeServer = WireMockServer.Start();

fakeServer
.Given(Request.Create().WithPath("/ping").UsingGet())
.RespondWith(Response.Create()
.WithStatusCode(200)
.WithBody("pong")
);

var fakeClient = fakeServer.CreateClient();
var externalService = new ExternalService(fakeClient);

// Act
var response = await externalService.GetAsync();

// Assert
response.Should().Be("pong");
}
}



[ GitHub ] : https://github.com/WireMock-Net/WireMock.Net

〰️〰️〰️〰️〰️〰️
#DotNet #WireMock #IntegrationTest
@ProgrammingTip
Embarking on Your Cloud Certification Journey in 2024: A Guide to Azure Certifications πŸš€ πŸŒ₯

β€’ An overview of the certification options available.

β€’ Introduction to the new open-book policy.

β€’ Recommendations for courses based on firsthand experience with these exams.

β€’ Essential tips for the exam day and the preparation leading up to it.


[ YouTube ] : https://www.youtube.com/watch?v=d59nAwmdoLk

〰️〰️〰️〰️〰️〰️
#Azure #CareerDevelopment #MicrosoftAzure #CloudCertification
@ProgrammingTip
πŸš€Ready to Track Your Application with Metrics? πŸ“Š

Looking to keep a close eye on your ASP.NET Core applications? With the latest update in .NET 8, you can now easily track various aspects of your application's performance and health through built-in metrics.

Here's why it's exciting:

β€’ HTTP Request Insights: Get a detailed view of your HTTP requests, including counts, durations, and more.

β€’ Real-time Alerts: Set up alerts to notify you if your app's performance exceeds predefined thresholds.

β€’ Error Handling Diagnostics: Pinpoint and address issues faster with detailed error handling diagnostics.

β€’User-friendly .NET Aspire Dashboards: Access a user-friendly dashboard through .NET Aspire, making it easy to visualize and understand your app's metrics.

β€’ Customizable Grafana Dashboards: Dive deep into your app's performance with customizable Grafana dashboards, tailored specifically for ASP.NET Core metrics

Excited to learn more? Dive into the details and revolutionize your app monitoring experience! πŸ’»πŸ’‘

[ Article ] : https://devblogs.microsoft.com/dotnet/introducing-aspnetcore-metrics-and-grafana-dashboards-in-dotnet-8/

〰️〰️〰️〰️〰️〰️
#DotNet #Metrics #Grafana #Dotnet_Aspire #Monitoring
@ProgrammingTip
Algorithm Series πŸ–πŸ“„

Name: Bubble Sort

Type: Comparison sort

Best For: Small datasets

Complexity: O(nΒ²) average and worst-case

How It Works: Repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted.

〰️〰️〰️〰️〰️〰️
#Algorithm #BubbleSort
@ProgrammingTip
The guide to Git I never had 🎯

Understanding Git is crucial for any developer. Often overlooked in CVs, mastering Git's capabilities enhances your coding proficiency significantly. This guide covers everything from basic commands to advanced techniques, ensuring you can manage and track your code effectively. βœ”οΈ

In this comprehensive guide, we delve into branches, commits, merging, rebasing, and more to help you master this essential tool. ⚑️

[ Article ]: https://medium.com/@jake.page91/the-guide-to-git-i-never-had-a89048d4703a

〰️〰️〰️〰️〰️〰️
#Git #VersionControl
@ProgrammingTip
5 Rules for Writing Better and Cleaner DTOs 🧹

Crafting clean and maintainable DTOs is essential for keeping your codebase healthy and scalable. But let's face it, sometimes DTOs can morph into these complex beasts that leave you scratching your head.  ‍

Fear not, fellow developers!

This article (or the accompanying video!) dives into 5 key principles to help you write simpler, more understandable DTOs.

You'll learn about:

β€’ Keeping things clear and concise
β€’ Utilizing properties effectively ✨
β€’ Crafting descriptive names that make sense

And also other tips to transform your DTOs from chaotic to crystal clear! By following these principles, you'll be well on your way to writing cleaner, more maintainable DTOs that make your code easier to understand for you and your team.

Ready to up your DTO game? Check out the full article or watch the video for examples and take your codebase to the next level!

[ Article ] : https://ardalis.com/5-rules-dtos

[ YouTube ] : https://www.youtube.com/watch?v=W4n9x_qGpT4

〰️〰️〰️〰️〰️〰️
#Dto #Dotnet #csharp #programming
@ProgrammingTip
πŸ”— Explore URL Shorteners: A Deep Dive

Curious about URL shorteners like TinyURL or Bitly? Dive into the fascinating world of system design with this comprehensive breakdown:

🎯 Scope & Requirements: Understand the functional and non-functional demands, from creating short URLs to ensuring low latency and high availability.

πŸ”’ Estimation & Scaling: Learn how to calculate the ideal URL length and anticipate storage needs for projected growth.

πŸ—οΈ Architecture Overview: Explore key components of a robust URL shortener system, from load balancers to database layers.

πŸ”§ API Design: Uncover essentials of designing a REST API, including endpoints for creating short URLs and seamless redirection.

πŸ’Ύ Database Management: Discover best practices for storing and retrieving shortened URLs efficiently.

Eager to deepen your understanding? Read the full article below.

[ Article ] : https://levelup.gitconnected.com/system-design-interview-question-design-url-shortener-c3278a99fc35

〰️〰️〰️〰️〰️〰️
#SystemDesign #URLShortener
@ProgrammingTip
OpenAI .NET πŸ‘Ύ

The OpenAI .NET library provides convenient access to the OpenAI REST API from .NET applications. βœ”οΈ

The full API of this library can be found in the api.md file, and there are many code examples to help. For instance, the following snippet illustrates the basic use of the chat completions API:

ChatClient client = new(model: "gpt-4o", "OPENAI_API_KEY");

ChatCompletion completion = client.CompleteChat("Say 'this is a test.'");

Console.WriteLine($"[ASSISTANT]: {completion}");


The library is organized into several namespaces corresponding to OpenAI feature areas. Each namespace contains a corresponding client class:

β€’ AssistantClient
β€’ AudioClient
β€’ BatchClient
β€’ ChatClient
β€’ EmbeddingClient
β€’ FineTuningClient
β€’ FileClient
β€’ ImageClient
β€’ ModelClient
β€’ ModerationClient
β€’ VectorStoreClient


[ GitHub ] : https://github.com/openai/openai-dotnet

〰️〰️〰️〰️〰️〰️
#AI #OpenAI #DotNet #CSharp
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
Designing APIs for humans: Object IDs πŸ§‘πŸ»β€πŸ’»

Ever wondered why Stripe uses foloowing format to generate unique IDs? Let’s dive in and break down how and why Stripe IDs are structured the way they are:

pi_3LKQhvGUcADgqoEM3bh6pslE
β””β”˜β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
└─ Prefix └─ Randomly generated characters


You might have noticed that all Stripe Objects have a prefix at the beginning of the ID. The reason for this is quite simple: adding a prefix makes the ID human readable. βœ”οΈ

Without knowing anything else about the ID we can immediately confirm that we’re talking about a PaymentIntent object here, thanks to the pi_ prefix. This helps Stripe employees internally just as much as it helps developers integrating with Stripe.

$pi = $stripe->paymentIntents->retrieve(
$id,
[],
['stripe_account' => 'cus_1KrJdMGUcADgqoEM']
);


The above snippet is trying to retrieve a PaymentIntent from a connected account, however without even looking at the code you can immediately spot the error: a Customer ID (cus_) is being used instead of an Account ID (acct_). πŸ”–

Without prefixes this would be much harder to debug; if Stripe used UUIDs instead then we’d have to look up the ID to find out what kind of object it is and if it’s even valid. πŸ‘¨β€πŸ’»


[ Read More ] : https://dev.to/stripe/designing-apis-for-humans-object-ids-3o5a

〰️〰️〰️〰️〰️〰️
#UUID #Stripe
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM