Sharing my thoughts, discussing my projects, and traveling the world.
Contact: @borz
Last updated 1 week, 2 days ago
Telegram stands for freedom and privacy and has many easy to use features.
Last updated 1 week, 3 days ago
Official Graph Messenger (Telegraph) Channel
Download from Google Play Store:
https://play.google.com/store/apps/details?id=ir.ilmili.telegraph
Donation:
https://graphmessenger.com/donate
Last updated 5 months ago
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
Telegram
Programming Tips Resources
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
? 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
Telegram
Programming Tips Resources
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
https://ardalis.com
5 Rules for DTOs
These are 5 rules for writing better DTOs.
Theguide 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
Telegram
Programming Tips Resources
AlgorithmSeries ??
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
Telegram
Programming Tips Resources
?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
Telegram
Programming Tips Resources
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
YouTube
How To Pass ANY Azure Certification in 2024 | Complete Guide
As 2023 winds to a close, you may want to consider 2024 to be the year that you get your first Cloud certification or add another certification to your resume. And while Azure is not quite as popular as AWS, it’s right behind it and is used by many companies…
IntroducingWireMock.NET: Master HTTP API Testing ?
WireMock.NETsimulates 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 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
Telegram
Programming Tips Resources
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
Telegram
Programming Tips Resources
Sharing my thoughts, discussing my projects, and traveling the world.
Contact: @borz
Last updated 1 week, 2 days ago
Telegram stands for freedom and privacy and has many easy to use features.
Last updated 1 week, 3 days ago
Official Graph Messenger (Telegraph) Channel
Download from Google Play Store:
https://play.google.com/store/apps/details?id=ir.ilmili.telegraph
Donation:
https://graphmessenger.com/donate
Last updated 5 months ago