This is based on an email I send my .NET team at work
It’s been a while. I got lazy over the holidays. Few quick things this week.
Bezier Curves from the Ground Up
If you’ve done any photoshop, or vector graphics work, or even messed with CSS animation timings you’re probably familiar with Bezier curves. Usually those tools have a line with some simple grab points you can drag around to change how quick a line curves.
I always wondered in the back of my mind how the math worked: how does the
algorithm know exactly what pixels to draw? A straight line is easy
y = mx + b
from algebra, but a curve seemed like magic.
I never cared enough to look it up, I feared it would be math well above what I can remember from school.
Anyway, this article came around a few weeks ago and I thought it was an eye opening explanation. It goes through the math and has a bunch of really helpful animations.
Refactoring Production Code With Experiments and Scientist.NET
In Ruby, the GitHub team released a gem (think NuGet package) called Scientist for help testing refactorings. The premise is that you run both the new version of the code and the old version and compare the results. The result of the old code actually gets used until you are sure your refactoring is safe.
You can read about it in depth on their engineering blog
Check out this brief article for a sample of how it works.
Webforms Without a Code-Behind
So I needed a debugging tool in Sitecore to fire an event and kick off a long
process that rebuilds the sitemap.xml. An easy way to do that is to drop an ASPX
page into the
sitecore/admin folder on the webserver. But what about the code
behind? I didn’t want to bother having to deploy and compile two files just for
this temporary debugging page.
I figured you could write the entire webform codebehind code right in the ASPX but it took a bit of Googling to recall how.
Now obviously you wouldn’t generally do this for production work, but I think its a useful trick for things like debugging pages. It has the advantage that you can just change the file and reload: no compile & deploy step.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
The trick is that goofy
<script runat="server" language="C#"> block. Just put
your handlers in their and they’ll get compiled into a backing class for the