Posts

Showing posts with the label development

Shrinking node_modules for AWS Lambda (My First “npm shock” and a Practical Fix)

Image
I’m a newbie in Node.js and not really familiar with the whole npm ecosystem. I honestly didn’t expect that a single npm install would explode into ~10MB spread across ~30 different folders. After a few minutes of staring at it, I realized what’s actually inside those folders: not just runtime code. What shocked me Inside node_modules you get everything: README files source files tests examples docs And then the next level of madness: modules inside modules . Duplicated dependencies nested multiple levels deep (e.g. inherits , core-util-is , tedious …), even if they already exist elsewhere in the project tree. Here’s a typical example: I’m in node_modules → package bl , and there’s another node_modules folder inside it, plus test , README and other “junk”… all for a ~10KB JS file. The obvious assumption (that turned out wrong) Once I accepted the chaos, I assumed there must be a “build for production” command that would “compile” depende...

Company Site Update

I make some changes in my site. The most of them is a prototype of universal content localization engine that can be applyed on web content without changes in DB or server-side code. It's a good start for Language Medium platform that is going to be easy and useful. NOTE: not all text content is localized to Russian right now - only menu, first section and few first Projects. It's becasue the engine is without BackOffice right now and all translations I'm adding  directly in DB:-) But don't worry - it will be soon B-) Also there are links to projects pages and some of them are real :-)

Remove Items From One List That Exist in Another List by ID in C#

Sometimes you need to remove elements from one collection if they already exist in another collection. The comparison is usually based on an identifier (ID). After testing several approaches, this turned out to be the cleanest and most readable solution using LINQ: lst1.RemoveAll(itemFromLst1 => lst2.Any(itemFromLst2 => itemFromLst2.ID == itemFromLst1.ID)); What This Code Does The logic can be read as: For each item in lst1 Check if any item in lst2 has the same ID If yes — remove it from lst1 In other words, this removes all elements from lst1 whose IDs already exist in lst2 . Why This Approach Works Well Concise and expressive No manual loops required No temporary collections needed Uses built-in List<T>.RemoveAll method The method RemoveAll modifies the list in place, which is often exactly what you want in filtering scenarios. Performance Consideration This solution uses Any() inside RemoveAll() , which means it performs a nest...

Pluralizing Words in C# (.NET) Using PluralizationService

Today I needed to generate a dynamic page title based on a category name. For example: My Playlists My Libraries My Categories The page receives a categoryID parameter, retrieves the corresponding category object, and then dynamically pluralizes the category name. Using PluralizationService in .NET .NET provides a built-in service for pluralization via System.Data.Entity.Design.PluralizationServices . using System.Data.Entity.Design.PluralizationServices; .... Category category = Category.GetByID(categoryID); PluralizationService ps = PluralizationService.CreateService( new System.Globalization.CultureInfo( "en-GB" )); Page.Title = $"My { ps.Pluralize( category .Name) }" ; ..... Important Note You must add a reference to System.Data.Entity.Design in your project. When to Use This This approach is useful when: Generating dynamic titles Building admin dashboards Creating REST endpoints with plural resource names Displaying catego...

MongoDB Atlas Cloud Cluster Test – Connecting to .NET Successfully

Today I performed an initial test of MongoDB Atlas , the managed MongoDB Cloud Cluster that can run on different cloud providers. The full setup — from cluster creation to a working connection — took roughly one hour. For a managed distributed database platform, that timing is impressive. Environment Setup The goal was simple: Create a MongoDB Atlas cluster Configure network access Create a database user Connect from a .NET application The cluster provisioning itself was straightforward. The UI is clear, and the workflow is linear: project → cluster → security → connection. Connecting MongoDB Atlas to a .NET Application I successfully connected the cluster to a .NET application using the official MongoDB driver. This was particularly satisfying because about half a year ago, in a previous company, we failed to make it work. At the time, the issue seemed complex. Now I know the root cause. It was only an incorrect connection string. No networking issue. No fir...

How to Import SQLite Database into MS SQL Server Using ODBC (Step-by-Step Guide)

Image
This guide explains how to connect a SQLite database file to Microsoft SQL Server using an ODBC driver and Linked Server configuration. The same ODBC DSN can also be used to open the database in MS Access. Overview The core requirement is creating a System DSN using a SQLite ODBC driver. Once configured, SQL Server can access the SQLite file through a Linked Server. Step 1 — Install SQLite ODBC Driver Download and install the appropriate version (match SQL Server bitness): http://www.ch-werner.de/sqliteodbc/ Step 2 — Create a System DSN Open ODBC Data Source Administrator: 64-bit: C:\Windows\System32\odbcad32.exe 32-bit: C:\Windows\SysWOW64\odbcad32.exe Create a System DSN and select “SQLite3 ODBC Driver”. Important: Do NOT use spaces in the DSN name. SQL queries against Linked Servers may fail if spaces are used. Step 3 — Create a Linked Server in SQL Server Run the following in SQL Server Management Studio: EXEC sp_addlinkedserver @server = 'SQ...

AliExpress Extention

Image
This is a first finished and published project today! :-) AliExpress Order Extractor