I’ve always greatly enjoyed batting practices as they provide “the problem” to learn a new platform. I recently received a batting practice as a pre-requisite for a job interview. They also provide great basics for a tutorial, so here we go!
Lets say you have a Model. The name of the model is stored in a string somewhere, and you want to get a reference to do something with that model. How do you do it?
Type.GetType(<string>) is the advertised way, but there are a lot of limitations on that. Primarily assembly location, and FullName versus Name. I ran into this conundrum in a small C# application, and wound up with this solution:
I know this topic has been done to death on StackOverflow, Ninject.Extensions created to solve it, and a million other things. But what if I wanted to use vanilla Ninect in a small solution and didn’t want to use Ninject.Extensions, but still wanted to Bind a bunch of classes at once? I couldn’t find an easy answer, so it’s possible someone else wouldn’t find an easy answer. So here’s an answer using simple reflection. The lazy person in me is going to limit sanitizing code, so pardon the specificity of the variable names, but chances are you’ll need it for the same things.
Creating lists programmatically can be useful in many scenarios. The scenario we run into most often are lists for waterfall projects that aren’t well thought out. Need to define 30 e-mail templates? Forgot a column? Want to easily reset content to a base state? Dealing with these scenarios by deploying list definitions/instances in a package rather than content restores can restore sanity, but does offer some drawbacks. Namely – custom security and content query web parts.
Inevitably, right-click-deploy will fail you. It’s not if, it’s when. And if you’re as lucky as I am, SharePoint is not your primary technology; you don’t bath in it daily. You visit it like the angry aunt who pinches your cheeks too hard and gives you wormy apples as a gift. It means well, it just don’t know any better because it’s had a rough life. This blog has served as my “reference” point for annoying things I have to remember. Here’s another one: Deploying Packages. If you right click deploy and Visual Studio gives various errors (timeouts, locked files, etc), it might be time to nuke the package from your farm and do it the right way. So lets crack open that SharePoint Administration PowerShell and navigate to a directory containing your wsp.
Through various blog posts and contributions by colleagues that I have mostly stolen, butchered, and maybe improved upon, I bring to you a simple Caching utility. DISCLAIMER: The title “Lazy” is meant only for amount of effort, not actual “lazy loading.”
A quick tutorial on how to enable/disable FTP daemon on OS X lion. This simple feature had eluded me for quite awhile, figured I’d (hopefully) help this guy’s SEO ranking.