Skip to content

Instantly share code, notes, and snippets.

View carloswm85's full-sized avatar
🎯
Compiling...

Carlos W. Mercado carloswm85

🎯
Compiling...
View GitHub Profile
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Web.Mvc;
using iText.Barcodes;
using iText.IO.Font;
using iText.IO.Font.Constants;
using iText.IO.Image;
using iText.Kernel.Colors;
@carloswm85
carloswm85 / Program.cs
Created January 17, 2025 12:02
Comprehensive guide for beginners learning ASP.NET Core MVC, covering essential topics like application setup, web server hosting, routing, dependency injection, and page views. It delves into advanced features, including Entity Framework Core, authentication with ASP.NET Core Identity, role and claims-based authorization, error handling, and cl…
// Configuration for netcore 8.0
using EmployeeManagement.Models;
using EmployeeManagement.Security;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.EntityFrameworkCore;
using NLog;
using NLog.Web;

An unhandled exception occurred while processing the request.

AuthenticationException: Cannot determine the frame size or a corrupted frame was received.

System.Net.Security.SslStream.GetFrameSize(ReadOnlySpan buffer)

HttpRequestException: The SSL connection could not be established, see inner exception.

System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, bool async, Stream stream, CancellationToken cancellationToken)

import { Component, OnInit } from '@angular/core';
import { MatTableModule } from '@angular/material/table';
import { BinanceRestService } from '../../../core/services/binance-rest.service';
import {
BinanceData,
BinanceEmac,
} from '../../../core/interfaces/binance.interface';
import { CommonModule } from '@angular/common';
import { EmacPositionEmojiPipe } from '../../../core/pipes/emac-position-emoji.pipe';
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<!--- Note that these columns can be defined in any order.
The actual rendered columns are set as a property on the row definition" -->
<!-- Number Column -->
<ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef> Nº </th>
<td mat-cell *matCellDef="let element"> {{element.position}} </td>
</ng-container>
@carloswm85
carloswm85 / SearchEngine.cs
Created November 15, 2024 23:04
This is what the component should include. I'm not sure how to turn it into a component diagram though (not sure if even necessary either).
public enum RoleEnum
{
Student,
Company
}
public interface ISearchEngine
{
void Search(string query); // General search method
}
@carloswm85
carloswm85 / GetTrackerPaginatedList.cs
Last active November 11, 2024 13:17
For Datatables.
/// <summary>
/// Retrieves a paginated list of trackers for a specified request, supporting sorting, searching, and pagination.
/// Returns a JSON result with paginated data compatible with DataTables.
/// See: <see cref="ListedTrackerDto"/>.
/// </summary>
/// <param name="requestId">ID of the request for which trackers are being retrieved.</param>
/// <returns>JSON result containing paginated tracker data, record count, and error information if applicable.</returns>
[HttpPost]
public virtual ActionResult GetTrackerPaginatedList(int requestId) {
var watch = Stopwatch.StartNew();
@carloswm85
carloswm85 / appsettings.json
Last active November 8, 2024 17:09
Connection string when Entity Framework Core 7 connection certificate trust exception, with NET Core 8.0
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"RazorPagesMovieContext": "Server=localhost;Database=RazorPagesMovieContext-d67b7425-08c7-4b61-ad49-6d9eda3c0a16;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True;Encrypt=False"
@carloswm85
carloswm85 / GetTrackerPaginatedList.cs
Last active October 25, 2024 16:31
Datatables implementation, backend only.
/// <summary>
/// Retrieves a paginated list of trackers for a given request, supporting sorting, searching, and pagination.
/// Returns an object tailored for listing, <see cref="ListedTrackerDto"/>.
/// This method may be used with frontend calls compatible with DataTables.
/// </summary>
/// <param name="requestId">The ID of the specific request for which trackers are being retrieved.</param>
/// <returns>A JSON object containing paginated tracker data, total records, and any error messages if an exception occurs.</returns>
[HttpPost]
public virtual ActionResult GetTrackerPaginatedList(int requestId)
{