Death Ray Vision did it. And now Louis CK did it, and the material is awesome.
I just bought this album yesterday. 5 bucks. They play most of the songs right there on the page. If you like that genre of music, you'll love this album. It's very well done, it just feels good, which sounds weird. But I had no problem forking over 5 bucks after hearing the tunes. It's blatant and obvious that the music was created out of passion and the desire to make something great.
The new Five Finger Death Punch album sucks. Period. There's a track on there called Remember Everything. Had I not known I was listening to FFDP, I would have sworn that Nickelback were the one's sniveling out the stupid lyrics and not a heavy metal band. This song is the opposite of what FFDP would normally produce(or at least I'm hoping so).
I could be entirely wrong, but on the one hand, FFDP produced a whole album. They probably only had a few songs they would have put on the album themselves, if they were the only ones picking, or maybe they had a ton of great tunes and couldn't fit them all on there. You see, the record label is probably thinking, hey, how can we make more money? I know, let's put on a song that sounds completely ridiculous, even like that shitty band Nickelback. Then, we can get radio time so FFDP can attain more fansconsumers, and we can sell more shit.
Unfortunately, Death Ray Vision is probably not going to be played on the local radio stations anytime soon, much less while the sun is up. So. They enter the studio, knowing full well, the shit they are going to produce, is for people who want good music of that genre. They proceed to create awesome, and succeed.
In some circumstances, I just want to execute some sql and get back a strongly typed result. The problem I have is that I hate having to create an intermediate class to hold the results. So I added a little bit of code to SqlTools and viola, no more intermediate classes.
So check it out. Assuming you have an instance of SqlDbHelper declared like so:
var helper = new SqlDbHelper("your connection string here");
You can now run some sql and retrieve the results like so:
var sql = "select firstname, lastname from customer where id = 1";
dynamic customer = helper.ExecuteDynamic(sql);
//properties are case-INsensitive!
Assert.AreEqual("Chris", customer.fIrStNAME);
And requesting lists of things is this easy:
var sql = "select firstname, lastname from customer"; IEnumerablecustomers = helper.ExecuteDynamics(sql); foreach (dynamic customer in customers) { Console.WriteLine("{0}, {1}", customer.LastName, customer.FirstName); }
OK. Well now I know I can post, however, the editing experience is HORRIBLE at best. Adding mobile editing to the todo list.
Finally getting around to adding some image support to the blog editor. Here's the first database backed image:

I'm converting my posts to use PHP Markdown. One of my fail points is the code formatting. I have the stylesheet hardcoded as seen in the image. I need to store my code bits off to the database and convert them on the fly, sort of like i do on tweetsnippet.com.
This is mostly a "remember this for later" post. Sometimes, I need to cleanse source code of the .svn folders. A reg file that I scraped off of the internet some time ago from I think Jon Galloway's post, was a tool for doing just that. The file can be downloaded from here: http://www.chrisjcarter.com/downloads/delete-svn-folders.zip. Essentially it gives you a context menu option in windows explorer to be able to right click on a folder and select Delete SVN Folders; it proceeds to recursively remove all svn garbage in all subdirectories.
Now I've got a separate class representing the stored proc. The first(and probably last) cut of one class per proc has more code in it than I want. Creating an instance of a class just to execute a stored proc seems long winded. Although one of the bennies of doing it this way is that I can leave some arguments off of the constructor, which might result in slighly less code, but not enough less that I want to use it.
Stored procs have their place. Unfortunately, that place is directly in front of my development efforts and they are driving me nuts. It's less about the stored proc as it is a bout the code calling the stored proc. I am running into a lot of code that looks like this:

That fourth to last line reference to SqlHelper is OLD old old. Left over from the early days of working with ADO.NET.
All of that code is used to call a stored proc defined like this:

OK, here's one way we could do this different, not sure it's better, but it's less code. I have one static class that represents a database(sort of), it's mostly just for hanging static methods(each representing a stored proc in the associated database), and centralizing the connection string for that database.

So Rippy is a static class defined like so:

And that pretty much is that, not much to it. However it's very horizontal, the method call takes a ton of args, all of which must be supplied(in the method call) even though only a couple are required. For someone(me!) who doesn't like unneccessary typing, I think I can do better.
Yes, I'm in full rant mode
I type fast. I think fast. When I'm in a caffeine induced trance of programming bliss, I want to see running code. Not in 20 seconds. RIGHT. FUCKING. NOW.
WPF and Visual Studio are not on my team when it comes to speed.
I'm trying to finish up a WPF project, we're in bug fix mode, and performance tuning mode. Unfortunately, part of the performance tuning had to be on our Visual Studio solution.
I don't want to do it. It means having to wait. And wait. And wait. This is all followed by more waiting. After around 45 seconds, if there are no build errors, maybe we get to see a screen. Change the color of text on single label? Press F5 and then? Yup, wait a good 45 seconds before you get to see that change.
In order to get WPF and Visual Studio even close to being as fast as I need for development on this project, I had to create a tool: Slimmer. It helped to have our solution partitioned in such a way that this worked.
Our solution has essentially 25 "features"(think single page apps). Everything to support a feature, has been segregated to it's own logical place in our solution and everything is named according to the feature. For example, if you have something named FeatureX, there will be a FeatureXController[1], a FeatureXService, a FeatureXRepository. And all of the views are located in a directory named Features\FeatureX\Views. So it's easy to pick out a everything that supports a single feature.
Slimmer guts everything out of our solution that is not the feature we're working on, and is not required as infrastructure and needed for the app to run. Slimmer parses the .csproj files, and removes all of the features and supporting code for those features that are not related to what we're working on. Previously I had attempted to do this through Visual Studio, just right click and exclude, right? OMG. It was taking upwards of 10 minutes to exclude, and including back in was a nightmare, it took so long. Editing the .csproj files outside of VS is way faster.
I haven't liked TFS from the beginning. It has done nothing but stand in our way and make developing slower. Want to edit that file? FUCK YOU. TFS wants to go do some thinking(maybe mulling over the fact that it's a huge piece of shit), then if you're lucky, it'll let you edit that file. However, if your VPN accidently lost it's connection, then it means that TFS will spin forever trying to make a connection to the server(remember, we just wanted to edit a file), and then finally it will barf with an exception that it can't connect to the server, to find out if you can be allowed to edit that file that's already on your machine.
Ha! I don't even know where I'm going with this, probably just crazy. Just beware, TFS + WPF + VS2010 = SLOW
[1] Our solution uses Magellan which an MVC framework for WPF, hence the term Controller.
My dad taught me a lot growning up. One of the characteristics I picked up from him, is his perfectionism. This has been both a blessing and a curse at times.
I used to throw the shot put and discus in high school and college. I was a stickler for details. If I threw far, but noticed my foot had slightly touched outside the ring and no one noticed, I would ALWAYS call myself on it; yes, I would purposely foul out and walk out the front of the ring(you have to exit the back of the ring, in control for a throw to be valid).
I was in the minority, however. There were plenty of throwers who were perfectly content with fouling, and if no one noticed, just keeping the throw. Not me, something didn't feel right about that. It didn't feel perfect.
Fast forward to present day. I set out to write a simple ORM-ish type thing. I've written them before, in one form or another, nothing extravagant. This time though, I had a nice thick glop of perfectionism helping me to get nothing done. So this morning I set out to complete my stupid foray into writing some throw away code that more closely resembles what I want out of an ORM.
The code started off as something else I was procrastinating on, it's located here https://github.com/chrcar01/EAR.
The TableOK. I used an amazingly simple table definition to play with. The primary key is an IDENTITY column named ID. Here's what it looks like in the Sql Management Studio table designer(and yes, then ame of my laptop is CLOWNKILLER).
I hesitate to say ActiveRecord, so I'm gonna stick with table wrapper class. Anywho, it's just a POCO, with simple mappings of table/columns to class/properties.(code formatting courtesy of http://csharpindepth.com/CodeFormatterTool.aspx)
<style type="text/css">
table.code, table.spec, table.results, table.compile, table.summary { margin-left: 4em; border: 1px solid #000000; padding: 4px; }
table.code { background-color: #e5e5e5; }
table.spec { background-color: #aaddff; }
table.results { background-color: #aaeeaa; }
table.compile { background-color: #ffaaaa; }
table.summary { background-color: #ffffff; }
div.code, div.output { border-right: white 2px ridge; padding-right: 10px; border-top: white 2px ridge; padding-left: 10px; font-size: 10pt; padding-bottom: 10px; margin: 10px; border-left: white 2px ridge; padding-top: 10px; border-bottom: white 2px ridge; font-family: courier new; background-color: #e5e5e5; }
/* For code snippets */
span.Keyword,span.Linq,span.ReferenceType,span.ValueType,span.Modifier,span.Statement, span.MethodParameter,span.Namespace,span.DataType,span.Function,span.Method, span.Object,span.Operator,span.Property,span.SysTable,span.SysSproc, span.GlobalVariable,span.ReservedKeyword,span.SystemFunction,span.Type, span.PreProcessorDirective, span.Element { color: #0000cc }
span.BlockComment,span.XmlComment,span.InlineComment,span.JavaDoc { color: green }
span.String { color: black }
span.Attention { font-weight: bold; color: red }
span.Entity { color: red }
Obviously, this is the happy path. This code is throw away type code(even though it's in github). It has tons of stuff that I would rather change, but I want to show it sooner than later(even though nobody will probably see this).
On the fly schema synchronization. Testing out a potentially bad idea of reading the database schema prior to generating the necessary sql. The idea being that your code will NEVER be out of sync with the database. No more generating code at compile time to make sure all field lengths are correct. Just do it when you need to execute the code.
I've never tried doing this myself. Changing the state of an instance of something, tracking those changes, then at some point undoing everything that's been done to the instance. I came up with a VERY NAIVE mechanism for doing this. The whole mechnism is based on Object.GetHashCode, which does not guarantee different values for different objects. However, in the scope of throw away code, I don't care. I've implemented IDisposable, and within that is an auto-commit mechanism. It actually works(the rolling back part).
I'm just scratching an itch. Nothing ground breaking, however, the client code is ridiculously simple. No mappings had to be declared by the developer, just a dummy class(which I'm working on removing the need for). By default, everything is in a transaction. Executing sql is even simpler, I'm working on that post right now....
I spent a little time spewing out some words that describe what I want from a "tool" that would help me be successful with a database. Here are a few of those things:
You can always insert into a table, primary key or not. Anything you can do in sql you should be able to do with the framework. The framework goals: 1) saves typing and 2) ensures that you're NOT doing something stupid(like inserting something that's 4000 characters long into a column that's 4 characters long, or inserting null into something that requires a value.). The tool/framework, is NOT smarter than the developer using it, although it might have better "memory". Value errors will always be caught prior to sending even one byte of data across the wire to the database. If your code is going to fail, it will do it sooner than later. The tool/framework will always tell you exactly why "it" failed, and if something failed in the database, it'll pass that info directly to you as an ADO.NET error. The tool/framework will always be accountable for it's actions. To eliminate any sneaky activity, all "features" are turned off by default. Validating whether you're going to insert invalid data is not a "feature", it's a requirement. It should take less than 10 minutes to figure out how to use it. The tool/framework is open sourced. The tool/framework should use the least amount of code possible to achieve it's purpose. The tool/framework should only require the least amount of code from a developer, in order to use it.
The hacker news discussion on the ORM anti-pattern blog post is great. After doing several projects using ORMS(LLBLGen, Castle ActiveRecord, Entity Framework, and Subsonic), I can safely agree with all of the points in the article about ORMs(I haven't gotten into the No-SQL stuff yet, so I can't comment on that).
<p>Except for insanely simple queries(think <b>select * from sometable</b>), <img src="content/article-images/hql.png" style="float:right;margin:15px;" />the ugliest part of ORM's are queries that involve joins or anything even moderately complicated. Recently I had come to the conclusion that I really don't mind writing sql to get stuff out of the database. The part that I hate is typing in the monkey code to create a class to hold the results, and then the code needed to map that class to the results of the query; then when the query changes, changing the mapping code...and so on. That code sucks to have to write. What's worse is the code ofr inserts, updates, and deletes; well, at least the easy ones that do all by primary key and nothing complicated. <b>Querying with HQL is stupid</b>. Just frickin write some sql and let a "tool" map up the results. Done. No learning new language.</p>
<p>Knowing your tools is a tough one too. If I'm using Castle's ActiveRecord, I know there are going to be times when I want lazy loading, eager loading, etc. I know what not to do to avoid situations where ActiveRecord will spin out of control and try and pull everything and the <img style="float:left;margin:15px;" src="content/article-images/sql-profiler.png" />kitchen sink from the database from a seemingly innocent request. However, I think I'm in the minority, because I like learning and knowing all of those things. Most of the people I've worked with who also use ORMs, don't want to learn the tool, they just want the "magic" to happen. I get that, really. That's not how I work, but I get it. On that note, I've run into many cases where devs who didn't learn the tool, write ridiculous code that has horrible consequences in the database...taking a peek at Sql Profiler while this code is executing is usually a good time, pages and pages of queries hammering the database, all from one call to a <b>FindAll</b> method.</p>
<p><b>My new approach to ORMs?</b> If we're working with relational databases, and we're doing inserts, updates, and deletes, then by all means I'm going to use an ORM of some sort to handle the task of modifying data. If it's a query beyond <b>select * from sometable</b>? Straight up sql....</p>
OK. So I found one major bummer with my current blog "engine". I can't start an entry, and not publish it before I put out any other entries. So basically, as soon as I start typing up a blog entry, I absolutely have to finish it prior to posting another entry.
Although, the more I think about it, the more it's kind of a neat little tool for keeping me on track, and consistently posting. I have to constantly keep posting, no rough drafts. This is good, I know my Wordpress blog had probably 20 unpublished posts, just because I was gold plating them.
I decided to mix things up today and start over on this site, well the blog portion anyway. I used to use Wordpress, I think I actually published maybe 5 or 6 posts in total. Every since I took down my PanteraVB.com site at the beginning of the year, I haven't been able to get back into blogging. I do not like Wordpress. I will not conform :)
<p><a href="content/article-images/notepad-plus-plus.png"><img src="content/article-images/notepad-plus-plus-small.png" style="float:right;margin:15px;" /></a>Here's the "engine". I write all of my posts in <a href="http://notepad-plus-plus.org/" target="_blank">Notepad++</a>. All of my posts go in one file, index.php. This file(and the directory it's in) are in a subversion repository. Every time I write a post(so, twice so far), I check in the changes to svn. Then, I use <a href="http://filezilla-project.org/" target="_blank">Filezilla</a> to upload anything that's changed in that directory to the directory containing chrisjcarter.com php content, and voila! My posts are published.</p>
<p>Seem like a pain? It's actually not. I'm only half joking when I put "engine" in quotes. It's such a painfully simple process, that tracks changes in subversion too, that I'm ok with doing it this way for a bit. I have other needs that are not being met with this setup, like code formatting. I like to keep my code in it's original state, and have a separate tool make it pretty, but keep the two forms separate. That'll require a little more than Notepad++ and ftp commands, but for now, good enough.</p>
The Thinkpad is my laptop of choice. I absolutely love the keyboard. I despise the little pointer device, so that's removed. I used to have a 7200 rpm disk too, then upgraded to 256 gig SSD. I'm running 64 bit Windows 7 Ultimate, 2.8 Ghz w/4 gigs ram. It boots insanely fast.
<p>I <b>love</b> my Thinkpad laptop.</p>
<p>Lenovo came out with a Thinkpad tablet. It runs Android 3.1 and has great hardware specs. There is also an optional pen and keyboard folio. The keyboard looks a lot like the Thinkpad laptop keyboard <a href="content/article-images/thinkpad.jpg" title="click to enlarge" style="text-decoration:none;border:0;"><img src="content/article-images/thinkpad-small.jpg" style="float:left;margin:15px;"/></a>that I enjoy typing on. The keyboard and pen really sold me on the tablet.</p>
<p>It was first released for purchase on August 23. On August 22, my credit card company called to let me know that there was a security breach or something, and they had to reissue my card, the new card would arrive on the 24th. Bummer, purchase of the tablet would have to wait a day, fine.</p>
<p>On the 24th I ordered the 32 gig version, the pen, and the keyboard folio. Estimated ship date? 9/12. <b>9/12 ???</b> WTF? It *just* came out, how could it take that long just to ship?</p>
<p>I'm not alone though. The forums are packed with complaints, and with customers who bailed, cancelled their order and went to online retailers, who, somehow had them in stock. I keep checking for status every day, the last status was 9/21. Actually, as of today, there is not even a status. There is no estimated ship date anymore. The message on the site indicates that there may be a problem with the order. The chat rep I communicated with, indicated that this is a good thing, that means it'll be shipping soon.</p>
<p>How can order fullfillment, from the company who makes the frickin device, be that difficult? I'm gonna hang in there though and see what comes through, no cancelling for me...yet.</p>