26 Feb 2026 #csharp #sql #bugoftheday
A subtle detail easy to forget when working with legacy applications that use stored procedures.
Stored procedures swallow long strings
If you’re inserting a long string into a shorter column, SQL Server truncates the parameters with no complaints,
USE Movies;
GO
CREATE TABLE Movies (
Id INT PRIMARY KEY IDENTITY(1,1),
Name NVARCHAR(10) NOT NULL /* <-- A 10 here */
);
GO
CREATE PROCEDURE InsertMovie
@Name NVARCHAR(10) /* <-- Notice the "10" here */
AS
BEGIN
INSERT INTO Movies (Name)
VALUES (@Name);
END;
GO
/* @Name is a NVARCHAR(10), but the value is longer than 10 */
EXEC InsertMovie @Name = 'ThisMovieNameIsWayTooLongForTheColumn';
GO
The stored procedure “swallowed” that long parameter. No complaints! But wait to see what Entity Framework does.
Entity Framework doesn’t validate or truncate
Now, if we try to do the same inside a unit test,
using Microsoft.EntityFrameworkCore;
namespace LookMaWhatEntityFrameworkDoes;
public class Movie
{
public int Id { get; set; }
public string Name { get; set; }
}
public class MovieContext : DbContext
{
public MovieContext(DbContextOptions<MovieContext> options) : base(options)
{
}
public DbSet<Movie> Movies { get; set; }
}
[TestClass]
public class MovieTests
{
[TestMethod]
public async Task TruncateItPlease()
{
const string connectionString = $"Server=(localdb)\\MSSQLLocalDB;Database=Movies;Trusted_Connection=True;";
var options = new DbContextOptionsBuilder<MovieContext>()
.UseSqlServer(connectionString)
.LogTo(Console.WriteLine)
.Options;
using (var context = new MovieContext(options))
{
context.Movies.Add(
new Movie
{
Name = "RememberThatNameInTheDBHasSize10"
}
);
context.SaveChanges();
// ^^^^^
// Test method LookMaWhatEntityFrameworkDoes.MovieTests.TruncateItPlease threw exception:
// Microsoft.Data.SqlClient.SqlException:
// String or binary data would be truncated in table 'Movies.dbo.Movies', column 'Name'. Truncated value: 'RememberTh'.
}
using (var context = new MovieContext(options))
{
var movies = context.Movies.ToList();
Assert.IsNotNull(movies);
}
}
}
Entity Framework Core blows in your face. At least, it tells you the table and column names, and the value being truncated.
Another subtle detail worth remembering. Et voilà!
Here’s another Entity Framework gotcha: Nullable foreign keys
25 Feb 2026 #writing
TV show are a great source of writing devices.
I’ve been binged watching Slow Horses, season 5. An espionage series in present-day London about a team of problematic MI5 agents, relegated to a forgotten office.
Even though, they’re labeled as poor performers—slow horses—they always end up saving the day.
After watching the first three episodes of season 5, I realized each one has ended in a dramatic way.
The second episode ends with a text message that makes you rush to click on “Next episode.” One of the protagonists, against all odds, is dating a pretty hot woman. Or that’s what he thinks. The text message reveals the girl’s true intention in a “wait, what” moment right at the end of the episode.
It reminded me of one of James Altucher’s writing tricks: start with blood or drama, end with a cliffhanger.
24 Feb 2026 #wellness #selfgrowth
One LinkedIn post pushed me to quit social media for a week.
I’ve been writing on LinkedIn (and other social blogs) for two years. And to “grow” my account as a creator, I’ve been following common advice: “be your own case study” and “engage after posting.” I questioned that advice, yet still spent an hour a day engaging.
I had two wake-up calls:
- Noticing my phone time. 2h18min on average the week before.
- Finding a post inviting people to disappear from the Internet without apologies, announcements, or guilt. I did that—kind of.
For a week, I stayed away from anything with a feed: Medium, LinkedIn, dev.to, YouTube, Reddit…But I still scheduled my weekly content for the platforms where I write.
You need an intention and a replacement
Ignoring my own productivity advice, I checked my email and socials before work.
When planning my feed-free week, I thought I needed an app/website blocker. But starting the first day with an intention was enough. “No social media today.”
Instead of scrolling, I read.
That week, I finished Papyrus by Irene Vallejo and got halfway through Financial Freedom by Grant Sabatier. In fact, I’ve been replacing my phone time with books in the last month.
Lesson #1: Don’t simply ban social media, replace them with conscious activities instead.
I hadn’t realized how scrolling had changed my behavior.
On day two, I was on a weekly meeting with a contracting client. “Another meeting that could be an email” kind of meeting. Nothing unusual until I noticed I wanted to fire up my LinkedIn account to make it until the end. I wanted a feed to scroll, like an addict.
Those moments made me realize scrolling was my default response to boredom.
Lesson #2: When procrastination comes, start with an easy task and sustain for 5 minutes. That’s enough to keep things moving forward.
Lesson #3: Find a boring activity instead of scrolling on social media. I’m doodling on the back of old receipts.
Even with an intention, books, and doodling, my monkey brain often popped up trying to trick me back to social media:
- “What if my account got suspended for lack of engagement?”
- “Did my posts generate visits to my book landing pages?”
To quiet the monkey brain, I learned to distance from it and refute my thoughts with rational ones:
- “You received a notification of your scheduled posts going live. The system is working.”
- “Let your content system run. You don’t need to refresh stats every 5 minutes. Let the Internet do its magic.”
Lesson #4: Social media tricks (whistles, notifications, bells) work. We need a lot of effort and intention to fight back.
“Warming up” the algorithm isn’t worth the time
To finish the experiment, earlier today I logged into my social media accounts.
In some platforms, my impressions suffered. Maybe it was just coincidence. In another one, one of the two scheduled long-form posts was a hit.
As usual, my best posts still spiked in views and thoughtful comments.
“Warming up” the algorithm with hacks (engaging before posting, like and reshare your own posts) isn’t worth the time and the addiction it creates.
Lesson #5: Good posts stand out without hacks.
Handling them with care
After my feed-free week, here are some long-term changes I’m adopting, both as a reader and writer:
- No email notifications from social media.
- Zero feeds before creative work. Timer on socials for conscious use.
- Weekly posts scheduled in advance. Have 2 or 3 weekly slots for engagement.
- Feed-free mode when working on creative projects or experiments.
I thought I wasn’t an addict. I thought I used social media consciously. I thought I was a dealer who didn’t use their own drug. Stepping away showed me I was just another dopamine junkie. Social media, like every billion-dollar industry, thrives on keeping us hooked.
24 Feb 2026 #misc
Here’s the hack:
- Make sure everybody at home has copies of all keys, like every door and lock.
- Give a trusted friend spare keys and a backup with your password manager’s recovery key.
Not that I had to break into my own apartment…Wink, wink! It sounds funny until it happens.
22 Feb 2026 #books
When you hear the word “book,” what comes to mind?
A cover, back cover, and spine? Sheets of paper bound to flip from left to right? Printing machines?
Books are recent, but their fascinating origins stretch back thousands and thousands of years. That’s precisely what Irene Vallejo tells us in Papyrus: The Invention of Books in the Ancient World.
Here are 7 lessons I took away from this book:
#1. Kids didn’t learn with easy books.
My dad bought my sister a book with Franklin the turtle every time she won an exam. Like her, we grew up reading books for kids: easy sentences filled with images.
But kids in Ancient Greece didn’t have easy books. They learned with the Iliad and Odyssey by Homer. To make things worse, ancient Greek didn’t have spaces, paragraphs, or punctuation marks…and teachers were ruthless.
#2. Book copyists worked for centuries.
In Athens, getting a book meant sending someone to Alexandria, Egypt to copy it. Sometimes I complain when it takes a month to receive a book.
#3. Titles, binding, and pocket books are recent inventions.
For centuries, we had rolls instead of books.
To read a scroll, you rolled it with your left hand while unrolling it with your right one. When finished, you rolled it back up as a courtesy for the next reader. Instead of titles, librarians categorized books by their opening sentences.
#4. Books were read out loud.
In school, I learned to read sitting in a circle taking turns to read a passage from an easy story. Then, we had to do it in silence.
But in ancient times, reading out loud was the norm. Reading a book was like a small prayer, a soft monologue.
#5. Iliad and Odyssey were best-sellers.
Probably every educated citizen in Ancient Times knew about them. Even kids learned to read with them.
#6. Education included the body as well as the mind.
Apart from reading, men had to work on their bodies as part of their education. A privilege reserved for higher classes and free men. Slaves were meant only for manual labor.
To strengthen their bodies, men trained outdoors or in gymnasiums showing off their bodies…while naked. Next time you see some “bros” posing and taking selfies in front of a mirror after lifting some weights at the gym, remember it used to be worse in ancient times.
#7. Books won’t die.
Books haven’t always looked the same: clay, stone, leather, papyrus, codices, paper… But they have endured the test of time. eBooks, summaries, TikTok, or AI aren’t a real threat for books. We’ve had them for centuries. And we will for more.