“Any sufficiently advanced technology is indistinguishable from magic” - Arthur C. Clarke Today I’d like to talk about LLMs. But first, I’d like to talk about an impressive invention from the late 1700s. The Mechanical Turk The Mechanical Turk - or “The Turk” as people called it - was an autonomous chess-playing machine. Built in 1770, it went on tour across parts of the world for 84 years as an automaton that could play a highly-skilled game of chess against human opponents.| David Haney - Blogging About .NET Core & Engineering Management
Have you heard the news? AI is replacing all developers next week - or in 3 or 6 or 12 or 18 months! And somehow at the same time, AI is helping developers get jobs by “cheating” in tech interviews! Don’t those two things directly oppose and contradict each other? But I digress. The thing is, AI replacing developers is straight up impossible, at least in the currently deployed LLM architectures. The idea is nonsensical. I need to write a blog post detailing both why it’s impossible an...| David Haney - Blogging About .NET Core & Engineering Management
Recently in CodeSession I encountered the following logged warning: No XML encryptor configured. Key {6848a46f-d0d6-49a6-b035-0f30f5448f9d} may be persisted to storage in unencrypted form. This was totally new to me, so I started Googling. There I learned all about .NET Core’s Data Protection API. After reading the MS docs, this was still confusing. The documentation states that this API is used for things like .NET Authorization, but CodeSession doesn’t use that functionality. So why was...| David Haney - Blogging About .NET Core & Engineering Management
It’s amazing how quickly 4 years can go by. But I’m back to blogging, and promise to follow this post with more regular entries going forward. In fact, I already have a technical topic scheduled for later this week, and plan to return to Engineering Management topics in the coming weeks as well. So what have I been doing since my last blog post over 4 years ago? LOTS. Let’s talk about it.| David Haney - Blogging About .NET Core & Engineering Management
Hi, I’m David Haney. I currently live in the Detroit Metropolitan Area of Michigan with my family. We moved here in late 2023. Prior to Michigan, I lived in Florida for 14 years. Prior to that, I was born and raised in Canada. I have been programming most of my life. We didn’t have a lot of disposable income, but my dad was given a home computer for his day job which was quite the luxury. It was a Macintosh SE/30 with an 80 MB HDD. I can still remember all the unique and quirkly sounds it...| David Haney - Blogging About .NET Core & Engineering Management
As you may or may not know, static methods are usually faster than instance methods. This alone should be a good enough reason to use the static string.Equals method in .NET, but if that doesn’t do it for you, allow me to present a simple example. string a = "hello"; string b = "hi"; bool result = a.Equals(b); What is the expected result of these lines? A boolean value of false, of course. And it’d be true if the strings were identical. It’s also false if b is null. But what if a is null?| David Haney - Blogging About .NET Core & Engineering Management
Well, once again I’ve fallen off of the blogging wagon. And once again I am now getting back on said aforementioned wagon. Let’s try and make this a more regular thing than once a year or so, shall we? I recently built a quick little hobby site / side project with .NET Core MVC. I have a lot of experience with ASP.NET MVC but I was totally new to .NET Core MVC.| David Haney
Sabbatical week one is complete, and I’m finally finding some time to blog about it! I had a pretty active week. It started with hurricane preparations as Dorian burled toward Florida, however in the end we suffered a very light glancing blow. In short, we got off easy. The Bahamas did not get so lucky, however, and got pretty messed up. I’d love for you to take a moment to donate to their recovery here: https://www.| David Haney
One of the most amazing perks of working at Stack Overflow is the sabbatical. After 5 years of FT employment, you are entitled to 20 paid days off (outside of normal vacation) that you can spend however you please. My sabbatical officially begins on Tuesday (as Monday is a holiday). Practically speaking, I am out from Aug 31 - Sept 30, returning to work Oct 1st. This is an amazing opportunity and benefit, and I can’t thank Stack Overflow enough for how well they treat employees.| David Haney
In this post I’d like to show you how I ported an Azure Classic Cloud Service application (which cost me $16 USD a month by the way) to a .NET Core Azure Function, and now host it in Azure for $0 a month! That’s right - Azure Functions are both awesome and (usually) free! Introducing realDonaldTron So back in late 2016, when our dear leader was elected president, I decided to have a little fun at his expense.| David Haney
It’s been a while since I changed things up, so I decided on a new Twitter handle and blog domain. This site is now hosted at davidhaney.io and called “David Haney” which in my opinion is a much better (and more descriptive and maybe even more egotistical) domain than haneycodes.net and the old name of “Haney Codes .NET” Don’t worry - haneycodes.net deep links will redirect properly for years to come, so you won’t miss anything at all. I’ve told Google’s search engine all ab...| David Haney - Blogging About .NET Core & Engineering Management
A few weeks back I wrote this tweet: I did a presentation / speaking thing last week that got me thinking: would it be useful to blog about how to build a resume as someone new to tech, from the perspective of a hiring manager? I might whip that up today or tomorrow if people like the idea. — David Haney hachyderm.io/@haney (@haneytron) July 9, 2018 43 likes later, it’s clear to me that this topic is in-demand.| David Haney
Well I failed badly in my mission to blog every week of 2017. I guess life and stuff just got in the way in the end. I’ll try to be more consistent in the second half of 2018. Anyway, I bring some news: I have a new blog engine, and we are hiring at Stack Overflow! New blog engine I was previously using WordPress but had many issues and concerns with it.| David Haney
This post is for those of you who hire developers, and also junior developers who want to be hired. Let’s talk about how developers are just like individual stocks in the stock market. Time for a little role-playing: you’re now a stock market investor. As a financial advisor, your company has given you $2,000,000 USD to invest in the stock market. It’s made very clear that the future of the company depends on the return on investment (herein called ROI) – “gains” – that your inv...| David Haney
In case you missed the big news in the industry this week, a GitLab employee accidentally deleted a ton of production data and took their platform down for hours. It was only when everything was on fire and they were in deep trouble that they turned to their backup systems… only to find that none of them actually worked. Backup Prod Data Regularly Not exactly a groundbreaking statement, right? Everybody knows this.| David Haney
In part 2 of my series on dev team interactions, I’d like to talk about conducting good code reviews. Most dev teams will find themselves in a situation where code reviews are necessary, and in my experience many do them very poorly. I’ve even worked in companies that had such a negative code review culture that people left the review sessions upset, even considering quitting. With a few easy adjustments, you can quickly learn to conduct excellent and positive code reviews with your team.| David Haney
As a developer working for a company, you probably work on a team. The interactions on these teams are sometimes pleasant, and other times hostile. What’s interesting to me is that a lot of the time, a hostile interaction could have been a pleasant one if only approached differently. Hostile teams are created by the actions of the people on them, not by the situations they encounter. One such hostile action is blame.| David Haney
If you’re working on an application built using ASP.NET MVC, you’re hopefully aware of the OutputCacheAttribute attribute which can be used to statically cache your dynamic web pages. By adding this attribute to a controller or action method, the output of the method(s) will be stored in memory. For example, if your action method renders a view, then the view page will be cached in memory. This cached view page is then available to the application for all subsequent requests (or until the...| David Haney
Well, I’ve utterly failed to blog at regular intervals, writing only three posts in 2016. Ouch. To be fair, one of those posts is insanely famous (the one about NPM and left-pad.js), but still, I’ve really let my readers – and myself – down. So, I resolve to write a blog post every single week of 2017, starting today. This will probably mean that I write slightly shorter posts, and maybe even multi-part series posts.| David Haney
On Plumbers Picture this situation: you woke up this morning to find that there’s no water coming through your valves and taps. No sink water. No shower water. Having no plumbing experience, you call around for a plumber. Plumber #1 Plumber #1, let’s call him Mario, tells you he can’t be bothered to come check out your issue because it’s minor and he’s very important and too busy for it. You explain that you really need a plumber, and he explains he’ll do it for 1.| David Haney
Are Developers Good Negotiators? Developers come from all walks of life, and have many unique interests, passions, and hobbies. Often the only thing that developers have in common is their love for programming. It follows that some are good negotiators; others get the double digit percentage finance rate at the dealership when they go in to buy that new car. How Does Your Company Determine Compensation? When you hire developers, how do you decide on their salary?| David Haney
Background I’m going to discuss an important topic that affects everybody in tech: diversity. No, this won’t be some preachy post about how diversity is great and how you should be a better human being. Rather, I’m going to tell you about the things I’ve experienced working on diversity – particularly the interesting events of the last few days that happened internally at Stack Overflow. It’s no secret that the tech industry is not that diverse.| David Haney
In February of 2015, I was promoted to Engineering Manager at Stack Overflow. This has made a lot of people very angry and been widely regarded as a bad move. There are tons of things I’ve learned so far, some of which I’ve learned the hard way. There’s also a world of difference between managing code, and managing people who code. Your day to day work routine changes completely. You define success differently.| David Haney
I was working on my fireplace this past weekend. Specifically I had just finished ripping down the old surface to the red brick, and then preparing the brick surface with a layer of thinset for tiling. I spent all of Saturday cutting tiles and then placing them on the fireplace surround and hearth. Even with help it took 11 hours to do, and about 8 hours of it was measuring and cutting tiles.| David Haney
Today an article was brought to my attention. One that, at the time of writing this post, had hit the front page of various sites (including Hacker News) and had been shared over 2,600 times. The article is On Secretly Terrible Engineers, which is a criticism of the tech industry and the mentality which it holds towards hiring both new and experienced developers/engineers. Spoiler: I strongly disagree with most of this article.| David Haney
A Job Listing Let’s say you were walking down a street one day and noticed an ad for help wanted. It is posted in the window of a bakery. It reads: HELP WANTED: Need a baker for FT work. Must be familiar with modern baking methods such as ovens, barbecuing, and deep fryers. 5+ years experience with the Super 6 commercial baking oven required (aside: came out in 2014). Nice to haves include experience with butcher’s blocks, chopping meat, and making candles.| David Haney
Intro We’re just two days from a brand new year and yet the primary measurement of a developer’s skill seems to be the same as it was 20 years ago. The most important classification to most companies is job title, as I talked about in great detail in my last post. The job title is acquired via working for a veritable slough of credentialist companies whose HR departments break it down very simply:| David Haney
Intro I’ve had a good career so far. I began working full-time as a programmer in 2008. At that time my title was Junior Developer. I had a decent boss and cool co-workers, and I cut my teeth on Java and .NET. It was a good experience. After 2 years at that gig, I felt that it was time to move on. I contacted recruiters, and one eventually found me a promotion: Systems Analyst.| David Haney
Intro Like many of you, today I watched the Apple media event in which they announced both the iPhone 6 and Apple Watch. I’m not going to talk about the watch, but instead about the phone. For years Apple has been a true cachet brand. They are a luxury item that is sought after for status and image. I don’t blame anyone for owning an iPhone: they’re reasonably sexy and you get to show off the Apple branding.| David Haney
Intro Almost exactly 1 month ago today I found myself on a video call with Joel Spolsky. It feels insane to write that, even now, as it was a banner moment in my career. For me it was the equivalent of meeting a movie star who I had idolized since I was old enough to know what movies were. There had always been this Joel Spolsky guy throughout my career that I regularly read about and whose opinions on software development agreed with mine, and suddenly I was talking with him face to face.| David Haney
The Problem I think that most devs would agree when I state that the definition of success in the corporate world of development places less emphasis on “good” code and more emphasis on “working” code. Working code is code that can be released to production on or before the deadline, regardless of performance or even bugs in most cases. As a developer, you ultimately feel as if you’ve failed when you toil for nights on end to meet steep deadlines and churn out crappy code.| David Haney
Intro Node.js – it has rapidly become the “new hotness” in the tech start-up realm. With each passing day, the fan base of Node lovers grows larger, spreading their rhetoric like a religion. How do you spot a Node.js user? Don’t worry, they’ll let you know. One day you’re at a regular user group meeting, sipping soda and talking with some colleagues, when the subject turns to Node. “Have you guys tried Node.| David Haney
It looks as if the Visual Studio dev team may be implementing a new operator in a future .NET release. This is due in large part to community demand, which is pretty cool because it shows that the VS team is listening to their customer base; a key part of a successful product. This new operator is likely going to take the syntax of ?. and is known as the Safe Navigation Operator.| David Haney
I recently came across an ASP.NET MVC issue at work where the validation for my Model was not firing correctly. The Model implemented the IValidatableObject interface and thus the Validate method which did some specific logic to ensure the state of the Model (the ModelState). This Model also had some DataAnnotation attributes on it to validate basic input. Long story short, the issue I encountered was that when ModelState.IsValid == false due to failure of the DataAnnotation validation, the I...| David Haney
Jonathan Allen of InfoQ conducted an interview with me about one of my open source initiatives, SimplSockets. We discussed the value of TCP over HTTP and why Sockets are still relevant to programming. I’d like to thank Jonathan and InfoQ for the opportunity – it was a great discussion. Check it out here: http://www.infoq.com/news/2013/12/SimplSockets| David Haney
MVC4 made one simple and yet awesome improvement to View rendering that I don’t think many people are aware of. Have you ever had to conditionally add an attribute to an HTML element in your MVC View based on the presence of a variable? The typical use case is applying a CSS class to a div. Most of the time that code looks something like this:| David Haney
The T4 template engine is insanely powerful. I didn’t really realize just how powerful it was until I had a use case for it today. I stood up a database with about 40 tables in it, and planned to use an ORM to access the database. To use the ORM, I needed POCOs (Plain Old C# Objects) that represented my database. Some of these tables had 30-50 or so columns and I didn’t want to code all of this by hand – it would take literally days.| David Haney
If you’re using the Web API as part of the MVC4 framework, you may encounter a scenario in which you must map parameters of strange names to variables for which characters of the name would be illegal. That wasn’t very clear, so let’s do this by example. Consider part of the Facebook API: Firstly, Facebook servers will make a single HTTP GET to your callback URL when you try to add or modify a subscription.| David Haney
Have you ever had to write a comparer for a specific type, only to be frustrated when you needed to write a second and third comparer for other types? Fear not, a generic comparer can take care of this for you! /// /// Compares two objects of any type. /// /// The type to be compared. public class GenericComparer : IComparer { // The compare method private readonly Func _compareMethod = null; /// /// The constructor.| David Haney
I wanted to point people to this link at DotNetPearls: http://www.dotnetperls.com/binarysearch They do an excellent, quick demonstration of List.BinarySearch and show a graph that really drives home how much faster it is for large lists than a regular traversal!| David Haney
One of the many things that I do at work is run a full-blown Search Engine which I also developed from scratch. This Search Engine feeds all product related information to our websites. A search index consists of a pre-computed collection of products, their properties, a list of words that are correctly spelled, and some pre-computed faceted/guided navigation. A search index, until this week, took up approximately 10.7 gigs of memory.| David Haney
In the interest of self-improvement and sharing knowledge, I felt that I should share an update to my last post. I discovered a slightly better way to create the GetMimeMapping delegate/method via reflection that involves less casting and overhead, and is more Object Oriented in a sense. It allows the signature of the reflected method to be Func instead of MethodInfo. Code below, note the use of Delegate.CreateDelegate(Type, MethodInfo):| David Haney
I recently had a need, in an ASP.NET MVC3 application, to read raw HTML, CSS, JS, and image files from disk and return them to the user… A sort of “pass-through” if you will. Normally I’d have simply routed to a custom HTTP handler per file type or just allowed MVC3 to map existing files to supply its own .NET HTTP handlers and do all of this work for me, but in this case I needed the mapped “directory” to switch behind the scenes based on Session settings… So I ultimately had t...| David Haney
As of today I’ve been published in an e-Book offered for free by Red Gate! It is called 50 Ways to Avoid, Find and Fix ASP.NET Performance Issues and contains many useful performance tips which have been contributed by various members of the .NET community. Many tips are ASP.NET MVC specific which is also a plus. My tip is #3 and has to do with debugging Microsoft symbols. Get a free copy here – it has already taught me a few things I had never thought to consider!| David Haney
Most of us have been there: you’ve written a fantastic application that performs perfectly in your Development and/or QA environments, but in Production something goes wrong. Your application spins out of control, utilizing 100% of your CPU. Maybe it simply stops responding as if it were deadlocked. Or maybe it simply crashes randomly. What now? Logic tells you that you have a problem in the code somewhere that is only encountered in a Production-like environment… and if you could JUST ge...| David Haney
So, this post is about our beloved IDE instead of actual code. I recently upgraded my home PC from Visual Studio 2010 and 11 Beta to Visual Studio 2012. The very first thing I noticed was that after about 10 minutes of programming my Intellisense quit working and never came back. I thought to myself “what the hell Visual Studio? 2010 didn’t have these problems?!” and then, after a swig of beer, proceeded to exercise my Google-Fu to solve this issue.| David Haney
A friend of mine commented on my last post asking about how much faster the static string.Equals method is than the instance string.Equals method. To satiate both of our curiosities, I have created this benchmarking application: static void Main(string[] args) { var stopwatch = new Stopwatch(); string a = "hello"; string b = "hi"; stopwatch.Start(); for (int i = 0; i < 10000000; i++) { a.Equals(b); } stopwatch.Stop(); Console.WriteLine("Instance string.Equals over 10,000,000 iterations: " + s...| David Haney
Well, it’s been nearly 2 months since my last post… I’m learning that if you want a blog to be successful, you have to carve time out of your busy life and make it happen. So, with renewed focus, I re-enter the fray. The Joel Test is a curious and honest thing. It has been around since the year 2000 and was invented by a guy named Joel Spolsky, as the name might imply.| David Haney
This isn’t a very technical post, but I was published by Microsoft recently via their MSDN UK Blog! The article is on creating and maintaining a successful User Group. Click here to read the article!| David Haney
Two of my colleagues (one from work and one from a user group) kindly pointed out to me that in my last post I omitted Continuation Tasks as a means of Error Handling for the TPL. As such, I will expand upon my last post with an example of handling errors via a Continuation Task. Continuing where we left off last, the following code will utilize a Task Continuation to handle errors within Tasks.| David Haney
As of .NET 4.0, the TPL or Task Parallel Library is king when it comes to parallelization. It allows for smooth, easy multi-threading for any application. There is a slight learning curve, however, and a major part of this is understanding how Exceptions bubble-up while using the TPL. Let’s partake in a simple example. This code will create and run a task that throws an Exception, and then attempt to catch it:| David Haney
The .NET compiler is a terrific thing… After all, it turns your C# into an executable program! One nice feature of the .NET compiler, which is becoming better each release, is inferred typing. I’d like to lay out a few short examples that might help you develop your programming standards and practices. Inferring a type when creating an array. // Create and initialize an array var myArray = new int[] { 1, 2, 3 }; Becomes:| David Haney
I came across a need at work today to re-implement some of the Output Caching for our MVC3 application which runs under .NET 4.0. I wanted to use standard Output Caching (via the OutputCacheAttribute class, why re-invent the well-working wheel?) but due to some of our requirements I needed more control over how my objects were cached. More specifically, I needed to cache them with a custom Cache Dependency. With a little bit of Google-Fu, I was delighted to learn of the Output Cache Provider ...| David Haney
As of .NET 3.0, LINQ (and the often related Lambda Expressions) have been available for our use and abuse. LINQ stands for Language INtegrated Query, and is a method of modelling OO data in a more or less relational sense that is not unlike databases. And just like databases, it comes with a cost. To offset this cost, LINQ uses Deferred Execution. Deferred Execution means that the code is not executed until it is needed.| David Haney
Sorry for the delay in posts, May has been a very busy month. In order to accurately debug or profile an external assembly or library (AKA one you’re not directly compiling), you need the associated PDB files to accompany each of the DLLs. These files give the debugger some information about the compiled assembly so that your debugger or profiler can become aware of function names, line numbers, and other related meta data.| David Haney
The topic at hand is interning. More specifically, string interning. “What is string interning?” you ask? Good question. As you may or may not know, strings are immutable reference types. This means that they are read-only and a pointer will refer to the string’s location on the heap. Typically, a new string is created and stored within your application’s memory each time that you assign a string – even if the same string is defined repeatedly.| David Haney
Something which I feel carries a lot of confusion in the .NET realm is virtual methods. During interviews, I tend to ask candidates about virtual methods: why and when they’d use one, what the purposes is, how a virtual method “works” under the hood, and how it differs from “shadowing”. Surprisingly, in what has probably been over one hundred interviews with senior-ish candidates, I don’t believe that more than one or two of them have answered anything about virtual methods correc...| David Haney
I’m a bit tipsy at the moment, so hopefully this post goes well. A question that I like to ask while interviewing individuals is: “why would you want to use an interface?” I get a ton of answers that span the supposed gamut of programming; some are good and some are of course terrible, however I’d like to share some input on what I feel is the importance of interfaces.| David Haney
This is my first post. I hope that it doesn’t suck. As of .NET 2.0, Microsoft introduced the concept of generics. Generics is a concept that allow you to “template” methods and types such as classes and interfaces in a (generally) type-safe way. Upon compilation, generic type metadata is stored in IL, and JIT’d as you reference the generic method or class with an actual type at runtime. Value types each get their own “copy” of the JIT’d generic code, whereas reference types shar...| David Haney
Intro Okay developers, time to have a serious talk. As you are probably already aware, this week React, Babel, and a bunch of other high-profile packages on NPM broke. The reason they broke is rather astounding: A simple NPM package called left-pad that was a dependency of their code. left-pad, at the time of writing this, has 11 stars on GitHub. The entire package is 11 simple lines that implement a basic left-pad string function.| David Haney