Programming Tips 💡
51.6K subscribers
67 photos
10 videos
30 files
354 links
Programming & AI:
Tips 💡
Articles 📕
Resources 👾
Design Patterns 💎
Software Principles

🇳🇱 Contact: @MoienTajik

🎯 Buy ads: https://telega.io/c/ProgrammingTip
Download Telegram
GitHub Copilot X: The AI-powered developer experience 🏳️

GitHub Copilot is evolving to bring chat and voice interfaces, support pull requests, answer questions on docs, and adopt OpenAI’s GPT-4 for a more personalized developer experience. 🆒


[ Article ] : https://kutt.it/CopilotX

〰️〰️〰️〰️〰️〰️
#GitHub #AI #ChatGPT
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
WireMock.NET 😮

WireMock.NET is a .NET library for stubbing and mocking HTTP services. With WireMock.NET, you can define the expected responses for particular requests, and the library will intercept and manage those requests for you. ✔️

This allows for easy testing of the code that makes HTTP requests, without having to rely on the actual external service being available and without hacking HttpClient. 🆒

Sample code snippet:

[Test]
public async Task sample_WireMock_usage()
{
// Setup WireMock.Net server
using var wireMock = WireMockServer.StartWithAdminInterface(port: 1080, ssl: false);

// Setup WebApplicationFactory
await using var appFactory = new WebApplicationFactory<Program>().WithWebHostBuilder(builder =>
{
builder.ConfigureAppConfiguration(configurationBuilder =>
{
// Override downstream service addresses pointing to WireMock address
configurationBuilder.AddInMemoryCollection(new Dictionary<string, string>
{
["ExternalServices:WeatherService"] = "http://localhost:1080"
});
});
});

// Prepare stub for outgoing request
wireMock
.Given(
Request.Create()
.WithPath("/api/v1.0/weather")
.WithParam("lat", "10.99")
.WithParam("lon", "44.34")
.UsingGet()
)
.RespondWith(
Response.Create()
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json; charset=utf-8")
.WithBodyAsJson(new
{
temp = 298.48,
feels_like = 298.74,
temp_min = 297.56,
temp_max = 300.05,
pressure = 1015,
humidity = 64
})
);

// Automate tested app
}


[ Blog ] : https://cezarypiatek.github.io/post/mocking-outgoing-http-requests-p1

〰️〰️〰️〰️〰️〰️
#UnitTest #DotNet #CSharp
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
Check out new C# 12 preview features! ⚡️

Three new features for C# 12 😮 :

1️⃣- Primary constructors for non-record classes and structs :
public class Student(int id, string name, IEnumerable<decimal> grades)
{
public Student(int id, string name) : this(id, name, Enumerable.Empty<decimal>()) { }
public int Id => id;
public string Name { get; set; } = name.Trim();
public decimal GPA => grades.Any() ? grades.Average() : 4.0m;
}


2️⃣- Using aliases for any type:
using Measurement = (string, int);

public void F(Measurement x)
{ }


3️⃣- Default values for lambda expression parameters:
var addWithDefault = (int addTo = 2) => addTo + 1;
addWithDefault(); // 3
addWithDefault(5); // 6


[ Article ] : https://devblogs.microsoft.com/dotnet/check-out-csharp-12-preview

〰️〰️〰️〰️〰️〰️
#CSharp #DotNet
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
Raycast 🔥

Raycast is a blazingly fast, totally extendable launcher for MacOS. It lets you use AI (ChatGPT) directly from your launcher, complete tasks, calculate, share common links, and much more. 🔝

[ Website ] : https://www.raycast.com

〰️〰️〰️〰️〰️〰️
#MacOS #Launcher #RayCast
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
.NET 8 - Keyed service dependency injection container support 🔝

Keyed services are useful when you have an interface/service with multiple implementations that you want to use in your app. What's more, you need to use each of those implementations in different places in your app. ☄️

Sample:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddKeyedSingleton<INotificationService, SmsNotificationService>("sms");
builder.Services.AddKeyedSingleton<INotificationService, EmailNotificationService>("email");
builder.Services.AddKeyedSingleton<INotificationService, PushNotificationService>("push");


[ Article ] : https://andrewlock.net/exploring-the-dotnet-8-preview-keyed-services-dependency-injection-support

〰️〰️〰️〰️〰️〰️
#DotNet #DotNetCore #AspNetCore #CSharp
@ProgrammingTip
Please open Telegram to view this post
VIEW IN 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