Since the Microsoft PDC at the end of October, I've been tasked with digging into Windows Azure to see where it might fit into plans for a project we are working on. I've had to merge this responsibility in with the rest of my daily responsibilities designing and building other applications, so I end up starting and stopping a lot on my research. It's great that my job offers me not only the opportunity to do these things, but the flexibility to even consider using technologies that are barely CTP for projects that we need to deliver within the next year.
I've done a lot of research, but I don't think I've even seen the tip of the iceberg yet on what is involved in designing a real, production application for Azure. There are so many things to consider when jumping to a completely new platform, that it's not just almost overwhelming, at times it IS completely overwhelming.
The best suggestion I could give someone who is just starting out, is to do the Hands On Labs for Azure. In fact, there are all kinds of samples to try. The difficult thing is to try to remember which ones you have done, and which ones you haven't. If I could make one suggestion to Microsoft is that they need to pull all the various SDK's and Toolkits and Samples together into one "Cloud Computing Toolkit Package" that a developer can download once, installs into one location, and provides a unified index for finding what you need quickly. I find it quite embarassing to post what I think is a valid question onto the MSDN forums only to find out that topic was well covered in an SDK Sample I just hadn't found yet. I take a lot of pride in not wasting other people's time in having them do my research for me.
Here's a list of the SDK's / Toolkits and samples available regarding The Microsoft Cloud
Azure Services Kit: Contains the Hands On Labs - Installs to c:\AzureServicesKit by default. Start with this one and go through all the labs. Every case is quite simple, but well done, thought here are a few errors in the code
Windows Azure SDK - Samples are included in a Zip file. On my machine, this installed to C:\Program Files\Windows Azure SDK
Microsoft .NET Services - Samples include AccessControl, Service Bus, Workflow and are installed on my machine to C:\Program Files (x86)\Microsoft .NET Services (Nov 2008 CTP) SDK
Microsoft Sync Framework - C:\Program Files (x86)\Microsoft SDKs\Microsoft Sync Framework
Silverlight - C:\Program Files (x86)\Microsoft SDKs\Silverlight
Microsoft SQL Server Data Services SDK - C:\Program Files (x86)\Microsoft SQL Server Data Services SDK
Windows Live ID - C:\Program Files (x86)\Windows Live ID\WebAuth\Sample
Windows Mobile - C:\Program Files (x86)\Windows Mobile 5.0 SDK R2
I'll add more links as I find them.
Wednesday, December 10, 2008
Monday, November 24, 2008
Fun with Entity Framework
So despite spending the first 6 months of the year becoming proficient and LINQ to SQL, the realization that Microsoft was casting aside LINQ to SQL in favor of its grumpy old uncle Entity Framework made me take a serious look at the EF for my latest big project. Luckily, it hasn't had too much of a learning curve, but I haven't gotten to the hard stuff yet either. I'll need to pick up a book on it at some point, but I'm still thrashing my way through WPF at this time and don't need another book to read right now.
One thing that frustrated the crap out of us here last week was not being able to go from a child entity to a parent entity easily. That is, until I learned the trick. And there's always a trick, isn't there.
Say you have a collection of warehouses, and each warehouse has a collection of doors. Given a door id (GUID), get the warehouse it is at. The WarehouseID is foreign keyed to the Door table.
You would think (based on LINQ to SQL), that you could go Door.WarehouseID or at the very least Door.Warehouse.WarehouseID... but alas, no can do. EF hides the relationship through an object called an Entity Key. In my brain, this was a little ridiculous, since I knew what my key was, just give it to me.
But I guess this is why I don't design frameworks for a living. The Entity Key is a dictionary collection, of all the keys that make up the relationship. Thus, if you have more than one column in the key, the EntityKEy collection contains both keys, but you can access it to use those values with a little care.
By adding a property to the Door object in a partial class, you can access the dictionary to extract the value. If you have multiple values in your key, be careful to index the Key properly.
One thing that frustrated the crap out of us here last week was not being able to go from a child entity to a parent entity easily. That is, until I learned the trick. And there's always a trick, isn't there.
Say you have a collection of warehouses, and each warehouse has a collection of doors. Given a door id (GUID), get the warehouse it is at. The WarehouseID is foreign keyed to the Door table.
You would think (based on LINQ to SQL), that you could go Door.WarehouseID or at the very least Door.Warehouse.WarehouseID... but alas, no can do. EF hides the relationship through an object called an Entity Key. In my brain, this was a little ridiculous, since I knew what my key was, just give it to me.
But I guess this is why I don't design frameworks for a living. The Entity Key is a dictionary collection, of all the keys that make up the relationship. Thus, if you have more than one column in the key, the EntityKEy collection contains both keys, but you can access it to use those values with a little care.
By adding a property to the Door object in a partial class, you can access the dictionary to extract the value. If you have multiple values in your key, be careful to index the Key properly.
public Guid WarehouseID
{
get
{
return new Guid(WarehouseReference.EntityKey.EntityKeyValues[0].Value.ToString());
}
set
{
WarehouseReference.EntityKey = new EntityKey("ContextName.Warehouse", "WarehouseID", value);
}
}
Tuesday, November 4, 2008
Back from the Great Beyond
Ok, I haven't been dead, I've just been time travelling. No, really. I jumped back in time to work on a big client project in Visual Studio 2005 using the Microsoft CAB and MVC pattern. While I did learn quite a bit about the client's business (which is not a bad thing), it wasn't technically challenging. In fact I slowed down on my reading of technical stuff, spent more of my free time (ok commute time), reading for fun, and writing for fun. Yes, writing can be fun too.
I also spent a lot more of my nights and weekends doing work for the project, which meant less tech reading as well. A lot of the changes I needed to make to the client systems in preparation for the rollout had to be done off hours to minimize impact on the user.
Sure, I learned a few tricks and tips in the last couple of months. I got very familiar with the Infragistics NetAdvantage Product Set, including the UltraWinGrid (very nice) and UltraWinSchedule (a little buggy in the version I had). But for the most part, I've been just churning code, doing database work, and doing rollouts.
That project is just about over now, with final rollout scheduled for this Saturday. My new project is all new technology, and I'm jumping in with both feet. I've spent the last few days watching videos, reading blogs, and running sample code.
What's got my attention, you ask? Windows Azure. Windows .NET Services. Microsoft SQL Data Services. WPF. Silverlight2. LiveMesh. Yep, 4 of those 6 things are still in CTP, and I'm jumping in with both feet. I'm not just going to be on the bleeding edge, I'm fully stabbed in the chest, in a full out ebola like blood letting.
We'll see how I feel about it in a couple of months, but right now, I'm really excited. My night stand reading is piling up with tech books and blogs. I'm not sure how much I'll be able to post, but I'll try to post hints, tips and other cool things to look at as I learn.
By the way, the current book I'm reading is Pro WPF in C# 2008. I'm just a chapter or so into it, but WPF is something I need to know inside and out for this project, so expect a few blogs on that.
I also spent a lot more of my nights and weekends doing work for the project, which meant less tech reading as well. A lot of the changes I needed to make to the client systems in preparation for the rollout had to be done off hours to minimize impact on the user.
Sure, I learned a few tricks and tips in the last couple of months. I got very familiar with the Infragistics NetAdvantage Product Set, including the UltraWinGrid (very nice) and UltraWinSchedule (a little buggy in the version I had). But for the most part, I've been just churning code, doing database work, and doing rollouts.
That project is just about over now, with final rollout scheduled for this Saturday. My new project is all new technology, and I'm jumping in with both feet. I've spent the last few days watching videos, reading blogs, and running sample code.
What's got my attention, you ask? Windows Azure. Windows .NET Services. Microsoft SQL Data Services. WPF. Silverlight2. LiveMesh. Yep, 4 of those 6 things are still in CTP, and I'm jumping in with both feet. I'm not just going to be on the bleeding edge, I'm fully stabbed in the chest, in a full out ebola like blood letting.
We'll see how I feel about it in a couple of months, but right now, I'm really excited. My night stand reading is piling up with tech books and blogs. I'm not sure how much I'll be able to post, but I'll try to post hints, tips and other cool things to look at as I learn.
By the way, the current book I'm reading is Pro WPF in C# 2008. I'm just a chapter or so into it, but WPF is something I need to know inside and out for this project, so expect a few blogs on that.
Friday, August 22, 2008
Autocomplete Extender Lesson Learned, Part Two
It turns out that the problems with the AutocompleteExtender actually go even deeper than the dispose problem. Or not as deep, depending on how you think about it. At some point in my effort to make my website pretty, the problem of the extender not extending after a partial postback reappeared. After spending a large, large amount of time on this, I found reference to another bug in the AJAXControlToolKit that happens if you programmatically set the focus back to the textbox associated with the extender control after doing a postback (partial or not).
I removed the set focus statement, and I am back in business. Again.
But dude, seriously?
I removed the set focus statement, and I am back in business. Again.
But dude, seriously?
Friday, August 15, 2008
Converting from a Web Project to Web Site
If you've converted from a VS2008 Web Project to a VS2008 Web Site, and tried to bring pages from one over to the other, you may have been stuck with the issue that your code doesn't see the objects created by the aspx. i.e. the text boxes, the drop downs, etc.
After you spend a while trying to match up namespaces, and letting Resharper fix a bunch of issues for you, you may still be stuck.
Here's one thing to check:
In your page directive, check to see that the compile has chnaged the CodeBehind attribute to read CodeFile. That's got me twice now. That's reason enough to blog about it.
After you spend a while trying to match up namespaces, and letting Resharper fix a bunch of issues for you, you may still be stuck.
Here's one thing to check:
In your page directive, check to see that the compile has chnaged the CodeBehind attribute to read CodeFile. That's got me twice now. That's reason enough to blog about it.
AJAXToolKit Autocomplete Extender Lesson learned
I was migrating a series of web pages from a small web project in VS2008 to a large client web site (not a web project, a web site). One of these pages included a predicitve text field which I used the ASP.NET AJAXToolKit to implement. The Tool kit worked almost flawlessly. I say almost flawlessly because there is a major bug which prevents the AutoCompleteExtender from working if you host the control in an update panel and you have already done a partial page postback.
Luckily Aaron Schnieder has already solved this issue.
http://weblogs.asp.net/aaronschnieder/archive/2008/03/11/ajaxcontroltoolkit-autocompleteextender-bug-in-an-updatepanel.aspx
Not sure why they haven't kicked out a new version of the tool kit onto Codeplex yet, but they haven't, so you must apply this change yourself.
So after I finished migrating my pages and my web service into the web site, I went to try to run my page with my autocomplete extender, and viola - WTF? Nothing happened. Crap.
Dork around with the pages. Add break points. Google a lot. Did I recently install any VS2008 service packs? Possibly. Uninstall them. Still nothing. Google some more. Add a new web site to my solution, with code right from the AJAXToolKit (converted to VB.NET of course). Still nothing. Two more hours of trial and error. Call it a night.
Log on this morning. Dig in again. More Googling. Hey, what's that? In the new Web Service code behind file I added?
How come that line is commented out? By default? Yikes.
Remove the comment. Try the app again.
Presto. Back in business.
Luckily Aaron Schnieder has already solved this issue.
http://weblogs.asp.net/aaronschnieder/archive/2008/03/11/ajaxcontroltoolkit-autocompleteextender-bug-in-an-updatepanel.aspx
Not sure why they haven't kicked out a new version of the tool kit onto Codeplex yet, but they haven't, so you must apply this change yourself.
So after I finished migrating my pages and my web service into the web site, I went to try to run my page with my autocomplete extender, and viola - WTF? Nothing happened. Crap.
Dork around with the pages. Add break points. Google a lot. Did I recently install any VS2008 service packs? Possibly. Uninstall them. Still nothing. Google some more. Add a new web site to my solution, with code right from the AJAXToolKit (converted to VB.NET of course). Still nothing. Two more hours of trial and error. Call it a night.
Log on this morning. Dig in again. More Googling. Hey, what's that? In the new Web Service code behind file I added?
' <System.Web.Script.Services.ScriptService()> _
How come that line is commented out? By default? Yikes.
Remove the comment. Try the app again.
Presto. Back in business.
Tuesday, July 22, 2008
UM, um, I mean UML
I'm taking a little break from Windows Workflow to refresh my knowledge of UML and Use Cases. To tell the truth, I never really bought into the whole use case stuff at my previous job. I can give a hundred excuses, all valid of course, for why I didn't believe in UML, but it was mainly because I didn't see my customers buying into the process of software development. They wanted the software. They wanted it now. They didn't want to do any work. Whatever tools we used, whatever diagrams and documentation we drew up, was for our own purposes. They never saw the use in it. By the time the diagrams were done, there was a new crisis du jour, and the last project was already passe.
But I was in a meeting with a new client last week, and one of the reasons I was being brought in to help with this project was to help build an industry standard set of requirement documents which could be handed off to the developers, whether it be my team, or someone else. I was there to do the architecture.
And on the way home that night, it hit me. I might not be there in six months to answer a developer's questions on what was needed. And they might take my name in vain. And they might say that I was incompetent. I can't afford that.
So I picked up my UML book this morning and started re-reading. Realistically, most of the stuff I already knew, but I had never formalized the terminology. I have never put UML / Use Cases on my personal resume because I lacked this formal experience with the process. So with the goal of not looking incompetent, and knowing that I would immediately apply this knowledge to my current daily responsibilities, I am digging in and now seeing the positive side of learning something that I consider 'non-technical'.
In fact, after reading the first 5 chapters this morning, I'm convinced that I can give this book to a project manager I work with, and that with both of us using this style my consitently, we will be better able to understand each other.
Who da thunk it?
But I was in a meeting with a new client last week, and one of the reasons I was being brought in to help with this project was to help build an industry standard set of requirement documents which could be handed off to the developers, whether it be my team, or someone else. I was there to do the architecture.
And on the way home that night, it hit me. I might not be there in six months to answer a developer's questions on what was needed. And they might take my name in vain. And they might say that I was incompetent. I can't afford that.
So I picked up my UML book this morning and started re-reading. Realistically, most of the stuff I already knew, but I had never formalized the terminology. I have never put UML / Use Cases on my personal resume because I lacked this formal experience with the process. So with the goal of not looking incompetent, and knowing that I would immediately apply this knowledge to my current daily responsibilities, I am digging in and now seeing the positive side of learning something that I consider 'non-technical'.
In fact, after reading the first 5 chapters this morning, I'm convinced that I can give this book to a project manager I work with, and that with both of us using this style my consitently, we will be better able to understand each other.
Who da thunk it?
Wednesday, July 16, 2008
Initial Impressions of Windows Workflow Foundation
In my last post, I mentioned I was reading Pro WF Windows Workflow in .NET 3.5 by Bruce Bukovics. I also used the words Whoop-Tee-Doo.
Well, I'm now 335 pages into the book, and into the concept of state machines, and this morning I finally had an 'Aha!' moment. See I've been trying to solve a problem at work, and knew that Workflows would probably help me, but the Sequential Workflows weren't blowing my mind. They just seemed like a lot of overhead to implement something that I could do inmany other ways.
However, the State Machine Workflows are definitely something I can see real possibilities for. I'm going to mock up my problem as a state workflow today, and see if I can get it to work.
I have two concerns:
1. Will I be able to call a .NET 3.5 Workflow DLL from a .NET 2.0 Application. I think so, as long as the .NET 3.5 Framework is installed on the clients (which it is)
2. Should I, as the architect, introduce another new technology into an application which is already difficult to support, even if it makes the problem I am trying to solve easier to solve. I am conciously trying to not alter the core of the application because of the size of it and the cost of fixing stuff that isn't broken, but the framework of the application is really limiting what we can do, and I think I can just peel out some pieces and make the application better. I also don't want to be the only one able to support it going forward, and if the rest of the team doesn't take their education in the new technologies as seriously as I do, I could be painting myself into a corner.
Well, I'm now 335 pages into the book, and into the concept of state machines, and this morning I finally had an 'Aha!' moment. See I've been trying to solve a problem at work, and knew that Workflows would probably help me, but the Sequential Workflows weren't blowing my mind. They just seemed like a lot of overhead to implement something that I could do inmany other ways.
However, the State Machine Workflows are definitely something I can see real possibilities for. I'm going to mock up my problem as a state workflow today, and see if I can get it to work.
I have two concerns:
1. Will I be able to call a .NET 3.5 Workflow DLL from a .NET 2.0 Application. I think so, as long as the .NET 3.5 Framework is installed on the clients (which it is)
2. Should I, as the architect, introduce another new technology into an application which is already difficult to support, even if it makes the problem I am trying to solve easier to solve. I am conciously trying to not alter the core of the application because of the size of it and the cost of fixing stuff that isn't broken, but the framework of the application is really limiting what we can do, and I think I can just peel out some pieces and make the application better. I also don't want to be the only one able to support it going forward, and if the rest of the team doesn't take their education in the new technologies as seriously as I do, I could be painting myself into a corner.
Monday, July 14, 2008
VS2008 Printing Issue
Today, I wanted to print a DBML Document from VS2008. The fact that I've been using VS2008 for 6 months now, and haven't run into this shows how much printing I actually do.
Anyway, I tried to print, and I kept getting an Error 'No Default Printer Istalled', which is bizarre, since I do have a default printer installed. What it really meant was the ID I was running as (admin), had no default printer installed. Even though I am an admin on my box, the admin user itself had to have a default printer set up.
Of course, I don't have the Admin user ID and password for my machine (I've never needed it in the past), so I had to recruit one of our tech support guys to fix this. After setting up the printer, and then switching back over to my id, everything was, whoa... still didn't work. Huh? Switch back over to the admin ID, test the printer. It works. Switch back over, restart VS2008, still nothing.
Close everything, log out, log back on, openup VS2008. Print. Ta-da!
Hoep this helps save someone half an hour.
Anyway, I tried to print, and I kept getting an Error 'No Default Printer Istalled', which is bizarre, since I do have a default printer installed. What it really meant was the ID I was running as (admin), had no default printer installed. Even though I am an admin on my box, the admin user itself had to have a default printer set up.
Of course, I don't have the Admin user ID and password for my machine (I've never needed it in the past), so I had to recruit one of our tech support guys to fix this. After setting up the printer, and then switching back over to my id, everything was, whoa... still didn't work. Huh? Switch back over to the admin ID, test the printer. It works. Switch back over, restart VS2008, still nothing.
Close everything, log out, log back on, openup VS2008. Print. Ta-da!
Hoep this helps save someone half an hour.
Friday, July 4, 2008
Back from where-ever I've been
Not that I've totally forgotten about updating this blog, but it wasn't until I started getting some people posting questions on here did I realize that, hey, someone is actually reading it! I'm going to try to get back into updating it more regularly, though it is difficult to find time to do it when I am at work, and that's when most of my technical tips, tricks, techniques, etc. come to me.
Anyway, since I last updated this site, a lot has changed. I spent pretty much the whole month of May, and most of June, heads down in developing my first major e-commerce web site. I worked with two other developers and a QA, and we started out really far behind the eight-ball due to a number of staffing issues early in the project. I was brought in to 'pound code', which isn't my normal role in projects, but it is something I do enjoy immensely.
When I say we were pounding code, I really mean it. It's been at least eight years since I've been heads down, fully dedicated to doing nothing but coding. We built 80 screens to administer the site, and the front end was over 40. We assembly-lined the project, where I did the admin site and part of the data access layer, one developer focused on CSS and doing the grunt data access layer (99.9999% in LINQtoSQL), and one developer building the security, transaction auditing and credit card processing and the front end screens. Our QA tracked the issues and gave us feedback on every screen as it was completed (and sometimes before we completed it, to our chagrin), and we really made efficient use of time and resources. I didn't think we'd get it all done in time, but we really did, and met all of our customer's expectations, and blew them away with the site over all. Not bad for my first time. Luckily, we did have experience in the office on some of the tricks of the trade (cc processing and auditing), so we didn't have to work that all up from scratch, but still, we're pretty proud of what we got done.
These days, I'm starting to dig into a Windows Forms application which was built 4 years ago in C# using the Microsoft Application Blocks 1.0. We migrated it up to .NET 2.0 earlier this year, and now have some major enhancements to do to it. A lot of the code is auto generated from an XML file which documents the data objects, and while I can see that it kicks out a lot of code in a hurry, it also seems to saddle the application with a lot of code which may never be used. It does everything from creating the database objects and stored procedures to spinning up the Controllers and data objects. There's a lot of cookie cutter code left after that to do, and it makes it fairly easy to build, but it is missing some things, like database side referential integrity and really good error handling.
I've also touched on some Sharepoint development. Sharepoint's a product which is not ready for prime time when it comes to the development environment. It really feels kludged together and is very temperamental. The most often seen comment on Sharepoint support blogs when discussing some weird Sharepoint behavior is 'Welcome to Sharepoint Development'. That's a really bad sign. I was really disappointed because I'd heard such good things about it. Hopefully Sharepoint 2008 improves the situation.
My current reading is Pro WF: Windows Workflow in .NET 3.5 by Bruce Bukovics. I'm only in Chapter 3 right now, and while the content makes sense, I haven't yet figured out how to apply this to the real world. I need to make a leap in my brain, and right now, I'm only getting little hops. I was expecting something that really blew me away. So far, not so much. "Visual If Statements". Whoop-Tee-Doo. I'm sure in 5 Chapters, I'll know it' much more than that, but that's why I read the book. To learn.
The book I'm most looking forward to reading is Microsoft® .NET: Architecting Applications for the Enterprise. Hopefully this helps me to put it all together so I can see the big picture better.
Anyway, since I last updated this site, a lot has changed. I spent pretty much the whole month of May, and most of June, heads down in developing my first major e-commerce web site. I worked with two other developers and a QA, and we started out really far behind the eight-ball due to a number of staffing issues early in the project. I was brought in to 'pound code', which isn't my normal role in projects, but it is something I do enjoy immensely.
When I say we were pounding code, I really mean it. It's been at least eight years since I've been heads down, fully dedicated to doing nothing but coding. We built 80 screens to administer the site, and the front end was over 40. We assembly-lined the project, where I did the admin site and part of the data access layer, one developer focused on CSS and doing the grunt data access layer (99.9999% in LINQtoSQL), and one developer building the security, transaction auditing and credit card processing and the front end screens. Our QA tracked the issues and gave us feedback on every screen as it was completed (and sometimes before we completed it, to our chagrin), and we really made efficient use of time and resources. I didn't think we'd get it all done in time, but we really did, and met all of our customer's expectations, and blew them away with the site over all. Not bad for my first time. Luckily, we did have experience in the office on some of the tricks of the trade (cc processing and auditing), so we didn't have to work that all up from scratch, but still, we're pretty proud of what we got done.
These days, I'm starting to dig into a Windows Forms application which was built 4 years ago in C# using the Microsoft Application Blocks 1.0. We migrated it up to .NET 2.0 earlier this year, and now have some major enhancements to do to it. A lot of the code is auto generated from an XML file which documents the data objects, and while I can see that it kicks out a lot of code in a hurry, it also seems to saddle the application with a lot of code which may never be used. It does everything from creating the database objects and stored procedures to spinning up the Controllers and data objects. There's a lot of cookie cutter code left after that to do, and it makes it fairly easy to build, but it is missing some things, like database side referential integrity and really good error handling.
I've also touched on some Sharepoint development. Sharepoint's a product which is not ready for prime time when it comes to the development environment. It really feels kludged together and is very temperamental. The most often seen comment on Sharepoint support blogs when discussing some weird Sharepoint behavior is 'Welcome to Sharepoint Development'. That's a really bad sign. I was really disappointed because I'd heard such good things about it. Hopefully Sharepoint 2008 improves the situation.
My current reading is Pro WF: Windows Workflow in .NET 3.5 by Bruce Bukovics. I'm only in Chapter 3 right now, and while the content makes sense, I haven't yet figured out how to apply this to the real world. I need to make a leap in my brain, and right now, I'm only getting little hops. I was expecting something that really blew me away. So far, not so much. "Visual If Statements". Whoop-Tee-Doo. I'm sure in 5 Chapters, I'll know it' much more than that, but that's why I read the book. To learn.
The book I'm most looking forward to reading is Microsoft® .NET: Architecting Applications for the Enterprise. Hopefully this helps me to put it all together so I can see the big picture better.
Thursday, April 3, 2008
Another book completed
I finished reading Code Complete 2 today, another book in my quest to bring my technical skills into the 21st century. Definitely a worthwhile book to read, especially for the beginning programmer, though it is already 4 years old. I worked a long time in C and C++ and I've seen many of the debates which the author discusses actually happen.
That said, I found myself wanting something different at this point in my reading life. I want to read more about projects in industry which have failed, and ones that have succeeded. I want to read about the post mortems which are done on those projects. At my previous job, the developers always wanted to do post mortems, but they never happened, for one reason or another. I think the view was that management thought they would turn into massive bitch sessions, whereas developers didn't expect things to actually ever change, so they never pushed the issue very hard. I am going to reread The Mythical Man Month sometime in the near future. I first read it back in 1994, just out of college and into the workplace. It will be interesting to see how I relate to it now.
The other thing I wanted was a book that got into the design issues specifically surrounding C#. I've still got more searching to do to find that book. I'm not sure if I'm looking for a design patterns book, a Nutshell book, a recipes book, or something else entirely, but I know I still have a lot to learn about application development in the .NET world.
I am starting my reread of ASP.NET 3.5 with C# 2008, and I figure that will take me till the end of the month. Sure I only finished it a month and a half ago, but I'm knee deep in a major ASP.NET project, and it's the perfect time to reinforce the skills I learned earlier.
I plan to get back to writing more frequently here again. It's not that I'm not working hard, it's that I kind of got into the flow of my new job, and for a brief period, thought I knew what I was doing. Now that I'm back into ASP.NET, there are all new mistakes to make and lessons to learn, so expect more posts, soon.
That said, I found myself wanting something different at this point in my reading life. I want to read more about projects in industry which have failed, and ones that have succeeded. I want to read about the post mortems which are done on those projects. At my previous job, the developers always wanted to do post mortems, but they never happened, for one reason or another. I think the view was that management thought they would turn into massive bitch sessions, whereas developers didn't expect things to actually ever change, so they never pushed the issue very hard. I am going to reread The Mythical Man Month sometime in the near future. I first read it back in 1994, just out of college and into the workplace. It will be interesting to see how I relate to it now.
The other thing I wanted was a book that got into the design issues specifically surrounding C#. I've still got more searching to do to find that book. I'm not sure if I'm looking for a design patterns book, a Nutshell book, a recipes book, or something else entirely, but I know I still have a lot to learn about application development in the .NET world.
I am starting my reread of ASP.NET 3.5 with C# 2008, and I figure that will take me till the end of the month. Sure I only finished it a month and a half ago, but I'm knee deep in a major ASP.NET project, and it's the perfect time to reinforce the skills I learned earlier.
I plan to get back to writing more frequently here again. It's not that I'm not working hard, it's that I kind of got into the flow of my new job, and for a brief period, thought I knew what I was doing. Now that I'm back into ASP.NET, there are all new mistakes to make and lessons to learn, so expect more posts, soon.
Thursday, March 13, 2008
Type inference in .NET 3.0
One of the things I am having a hard time wrapping my head around is why one of the recommendations of Resharper 4.0 is to implicitly type all local variables. It goes against my anal retentive nature for clean, easy to read code.
The following article tries to explain the benefits of this practice, though I’m not sure they have me convinced though I have, at times, found myself annoyed with the redundant declarations of a new variable
i.e.
Can be shortened to
I guess that makes the code less cluttered. But is life really that much bad with the previous example that the Resharper folks found the need to suggest that it is now best practice?
http://www.programmersheaven.com/2/CSharp3-1
The following article tries to explain the benefits of this practice, though I’m not sure they have me convinced though I have, at times, found myself annoyed with the redundant declarations of a new variable
i.e.
Dictionary<SearchCriteriaType, SearchCriteriaDisplay> criteriaDisplays = new Dictionary<SearchCriteriaType, SearchCriteriaDisplay>();
Can be shortened to
var criteriaDisplays = new Dictionary<SearchCriteriaType, SearchCriteriaDisplay>();
I guess that makes the code less cluttered. But is life really that much bad with the previous example that the Resharper folks found the need to suggest that it is now best practice?
http://www.programmersheaven.com/2/CSharp3-1
Wednesday, March 12, 2008
Visual Studio 2008 Error after upgrade
I needed some capabilities from VS2008 DB Edition to go with my VS2008 TA (Team Architect, not whatever other acronym starts with T&A), so I slapped a copy of that onto my machine this morning.
However, when I fired up VS2008, it started briefly, and then crashed. It did this a few times in a row, and I checked the event log.
Ruh-Roh Shaggy. Time to reboot.
Try it again. Same problem.
We're in trouble now, Scoob.
After searching the web for a bit, I came across starting the app in SafeMode. with the/safemode switch. That worked. I let the app load up, then I closed it back down, removed the /safemode switch, and presto, back in business.
I think it has to do with my recent installation of Resharper 4.0 EAP, since the app was dying trying to load the toolbox items. We'll see if it happens again the next time I do an upgrade.
However, when I fired up VS2008, it started briefly, and then crashed. It did this a few times in a row, and I checked the event log.
.NET Runtime version 2.0.50727.1434 - Fatal Execution Engine Error (79FEC5F0) (80131506)
Ruh-Roh Shaggy. Time to reboot.
Try it again. Same problem.
We're in trouble now, Scoob.
After searching the web for a bit, I came across starting the app in SafeMode. with the/safemode switch. That worked. I let the app load up, then I closed it back down, removed the /safemode switch, and presto, back in business.
I think it has to do with my recent installation of Resharper 4.0 EAP, since the app was dying trying to load the toolbox items. We'll see if it happens again the next time I do an upgrade.
Tuesday, March 11, 2008
SQL Thief - Last Modified Stored Procs
I will admit that what I am about to put here, I stole from Pinal Dave's site. Nonetheless, I use these scripts quite frequently, but have a hard time finding them on line (you have to remember just the right search word, and I always forget to bookmark them). So for my quick reference
Here's how to get a list of all stored procedures modified in the last x days
The following script will provide name of all the stored procedure which were created in last 7 days, they may or may not be modified after that.
Here's how to get a list of all stored procedures modified in the last x days
SELECT name
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,modify_date, GETDATE()) < 7 --Change 7 to any other day value.
The following script will provide name of all the stored procedure which were created in last 7 days, they may or may not be modified after that.
SELECT name
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,create_date, GETDATE()) < 7 --Change 7 to any other day value
Monday, March 10, 2008
Dude, you're such a Tool
Yes, half the fun of blogging is coming up with good titles. This, post, as it so clear states, is about tools.
As a .NET developer, I take no shame in using as many tools as I can to make my day easier. Here are as many as I can think of. Most of them you will know, some you may have heard of, and some you'll think to yourself, why isn't he using xxxxx. Well, I want to know about xxxx, so if you don't see it listed here (and it pertains to something I would need at WORK, let me know.
One of the tools I am going to try soon is called Resharper. I've heard really good things about it, and I'm pretty sure it will save me time, but it is quite expensive, and I just want to make sure I'm going to use it. Time to get the trial licence, and give it a whirl.
Anyway, that's pretty much what I sue on a day to day basis (that, plus google to help me find blogs that fix my bugs).
What am I missing?
As a .NET developer, I take no shame in using as many tools as I can to make my day easier. Here are as many as I can think of. Most of them you will know, some you may have heard of, and some you'll think to yourself, why isn't he using xxxxx. Well, I want to know about xxxx, so if you don't see it listed here (and it pertains to something I would need at WORK, let me know.
- Visual Studio 2008 (of course, and 2005, and ack, sometimes 2003). LINQ in 2008 is quickly becoming my most important coding skill. Frankly, it had me at Hello, and I've been it's query biatch ever since
- SQL Server Management Studio - if you aren't working in SQL server these days, what, are you stuck in 1995?
- NUnit - Test driven development is getting a hold of me, and I like it!
- CruiseControl.NET - To know it is to be the only one in the office who cares, but it makes my life a lot easier in the long run
- NAnt - Part of my suite of build tools
- FireFTP - Mozilla add on for FTP. Great little tool
- FireBug - Mozilla add on for debugging web pages and css files
- Fiddler - Helps for debugging http traffic. Ethereal is another good tool to. I just haven't used it lately
- .NETReflector - Lost the source code for a .NET dll? Run it through Reflector to get it back. Want to compare two versions of a .NET dll to see what changed? Run it through Reflector
- ummm Visual Source Safe - better than nothing I guess. Slightly better.
- asp.net AJAX Toolkit 3.5. I've been really getting into AJAX this week, and it's pretty cool, though it does not seem very forgiving.
One of the tools I am going to try soon is called Resharper. I've heard really good things about it, and I'm pretty sure it will save me time, but it is quite expensive, and I just want to make sure I'm going to use it. Time to get the trial licence, and give it a whirl.
Anyway, that's pretty much what I sue on a day to day basis (that, plus google to help me find blogs that fix my bugs).
What am I missing?
Friday, March 7, 2008
Can I By a Val please Vanna
File this under gosh darn whacky wastes of time
If you have a web service written in VB.NET which has functions which are called by ASP.NET AJAX scripts, don't ever declare the values in the function declaration as ByRef. Use ByVal instead.
ASP.NET AJAX will show a Method 500 error and you'll spend much time trying to find out why that one call doesn't work.
Again, the side effects of relearning VB.NET
Oh joy.
If you have a web service written in VB.NET which has functions which are called by ASP.NET AJAX scripts, don't ever declare the values in the function declaration as ByRef. Use ByVal instead.
ASP.NET AJAX will show a Method 500 error and you'll spend much time trying to find out why that one call doesn't work.
Again, the side effects of relearning VB.NET
Oh joy.
You insensitive bastard
Here's a really simple function that uses LINQ and will throw a bizarre exception when written in VB.NET. The exact same function, written in C# will work perfectly.
First, create a simple class
Then, add the following function to an NUnit test harness using VB.NET
Running that code, results in the following exception
Do you see why? Since it's been a long time since I've done VB.NET, it took me a while to figure this out. Of course my code wasn't that simple, but here's the solution:
It goes back to VB.NET not being case sensitive. Declaring a variable with the same name as the class (albeit a different case), confused the hell out of the runtime engine.
This is just one of the many reasons I prefer C# to VB.NET. But the client wants the development done in VB.NET, so I get to (re)learn another language.
First, create a simple class
Public Class SearchCriteria
Public GroupName As String
Public Keyword As String
End Class
Then, add the following function to an NUnit test harness using VB.NET
Public Sub BadList()
Dim searchCriteria As New List(Of SearchCriteria)
Dim distinctSearchCriteria As New List(Of SearchCriteria)
distinctSearchCriteria = searchCriteria.Distinct()
End Sub
Running that code, results in the following exception
System.InvalidCastException : Unable to cast object of type 'd__80`1[SearchCriteria]' to type 'System.Collections.Generic.List`1[SearchCriteria]'.
Do you see why? Since it's been a long time since I've done VB.NET, it took me a while to figure this out. Of course my code wasn't that simple, but here's the solution:
Public Sub BadList()
Dim searchCriteriaList As New List(Of SearchCriteria)
Dim distinctSearchCriteria As New List(Of SearchCriteria)
distinctSearchCriteria = searchCriteriaList.Distinct()
End Sub
It goes back to VB.NET not being case sensitive. Declaring a variable with the same name as the class (albeit a different case), confused the hell out of the runtime engine.
This is just one of the many reasons I prefer C# to VB.NET. But the client wants the development done in VB.NET, so I get to (re)learn another language.
Thursday, March 6, 2008
Book on Pre-Order
I don't think I have ever put a technical book on Pre-Order before, but I did just that this morning for LINQ Object Relational Mapping
I can honestly say that I spend hours every working day thinking about ORM. In fact, a large percentage of my time over the past 4 years has been trying to map database tables to usable objects and to try to find a good architecture for applications that really works in the real world.
I have really high hopes for this book, and deep fears as well. I'm hoping I read it and think "I can just tweak a little bit of my design here and there and I'll be right on track."
I'm fearing that I'll read it and either a) not know what the hell they are talking about and realize I am still in way over my head, it's time to start flipping burgers, b) OMFG, this is better than what I have by a huge factor. I have to rebuild everything, or c) WTF, do none of these guys who write these books ever spend time in the real world? With most books, it's a little of all of these at one point or another.
I guess I'll just have to wait and see. The book is scheduled to be released April 28, 2008.
I can honestly say that I spend hours every working day thinking about ORM. In fact, a large percentage of my time over the past 4 years has been trying to map database tables to usable objects and to try to find a good architecture for applications that really works in the real world.
I have really high hopes for this book, and deep fears as well. I'm hoping I read it and think "I can just tweak a little bit of my design here and there and I'll be right on track."
I'm fearing that I'll read it and either a) not know what the hell they are talking about and realize I am still in way over my head, it's time to start flipping burgers, b) OMFG, this is better than what I have by a huge factor. I have to rebuild everything, or c) WTF, do none of these guys who write these books ever spend time in the real world? With most books, it's a little of all of these at one point or another.
I guess I'll just have to wait and see. The book is scheduled to be released April 28, 2008.
Wednesday, March 5, 2008
NAnt and .Net Framework 3.5
When I went to build my first LINQ application on our build server running CruiseControl.NET, the first message I got was:
I figured all I needed to do was to force NAnt to use the .NET 3.5 Framework, so I added a line to the NAnt Script as follows:
However, then I got the following message
So after a little digging on the net, I found that the version of NAnt we were using (0.84) did not yet handle the .NET 3.5 Framework. However there is a Beta version of the 0.86 NAnt tool available, so I downloaded that and installed it to my build server (copied it actually, there is no installer)
The I got the following error
Hmmm. I cleaned up my build server, removing all previous versions of NANT, copied the files from 0.86 back into my NAnt directory, and tried again. Same problem.
Next, I downloaded the latest nightly build from SourceForge and tried my build again
WTF!? Where the hell did my msbuild task go? Panic strikes. OMG, I just killed our build server! My boss is gonna kill me!
After a little digging, it turns out that when I cleaned up my server, I'd also removed the latest NAntContrib bin directory, where the msbuild task comes from. So I downloaded the latest NAntContrib package, copied the files to the NAnt directory.
And.... PRESTO! Project building! Well at least it would have been if I hadn't had a path error in my NUnit task. A quick fix, recheck the file into (gah) Visual Source Safe, and a green build light made me feel all warm and fuzzy inside.
All that took me a good chunk of my morning. It would be really nice if SourceForge offered a standard install with the latest NAnt and NAntContrib packaged together for us lazy asses who don't really have 4 hours to blow on getting a build running.
I think that's the number one argument against build servers is how long it takes to set them up. The time they end up saving is tremendous, but you have to be really determined to get it done, and then cross your fingers that you have accurately documented every step in the setup so it doesn't take so freaking long the next time.
My next task... upgrade CruiseControl 1.2.1 to 1.3, though I have heard rumors circulating about CCNET 1.4. Maybe I'll wait till then, and get some real work done.
Solution file error MSB5014: File format version is not recognized. MSBuild can only read solution files between versions 7.0 and 9.0, inclusive
I figured all I needed to do was to force NAnt to use the .NET 3.5 Framework, so I added a line to the NAnt Script as follows:
<property name="nant.settings.currentframework" value="net-3.5"/>
However, then I got the following message
Target framework could not be changed. "net-3.5" is not a valid framework identifier. Valid values are: net-2.0, net-1.1.
So after a little digging on the net, I found that the version of NAnt we were using (0.84) did not yet handle the .NET 3.5 Framework. However there is a Beta version of the 0.86 NAnt tool available, so I downloaded that and installed it to my build server (copied it actually, there is no installer)
The I got the following error
Object reference not set to an instance of an object.
Hmmm. I cleaned up my build server, removing all previous versions of NANT, copied the files from 0.86 back into my NAnt directory, and tried again. Same problem.
Next, I downloaded the latest nightly build from SourceForge and tried my build again
Invalid element . Unknown task or datatype.
WTF!? Where the hell did my msbuild task go? Panic strikes. OMG, I just killed our build server! My boss is gonna kill me!
After a little digging, it turns out that when I cleaned up my server, I'd also removed the latest NAntContrib bin directory, where the msbuild task comes from. So I downloaded the latest NAntContrib package, copied the files to the NAnt directory.
And.... PRESTO! Project building! Well at least it would have been if I hadn't had a path error in my NUnit task. A quick fix, recheck the file into (gah) Visual Source Safe, and a green build light made me feel all warm and fuzzy inside.
All that took me a good chunk of my morning. It would be really nice if SourceForge offered a standard install with the latest NAnt and NAntContrib packaged together for us lazy asses who don't really have 4 hours to blow on getting a build running.
I think that's the number one argument against build servers is how long it takes to set them up. The time they end up saving is tremendous, but you have to be really determined to get it done, and then cross your fingers that you have accurately documented every step in the setup so it doesn't take so freaking long the next time.
My next task... upgrade CruiseControl 1.2.1 to 1.3, though I have heard rumors circulating about CCNET 1.4. Maybe I'll wait till then, and get some real work done.
ThinqLinq
I'm not exactly reading a book a week, but it is close. This morning, I finished the Pro-LINQ C#2008 book by Joseph Rattz. A lot of it is a reference manaul which I will be frequently breaking open while coding LINQ, but I definitely feel more comfortable in using LINQ now than I was a couple of weeks ago. I haven't gotten to the point of ThinqLinq (I just coined that term, I should copyright it.) *Note: I just found a website that already uses the term ThinqLinq. Guess I won't be getting rich on that one.
I'll define ThinqLinq as being able to code database queries directly in LINQ without first thinking in SQL. I think it actually works to my advantage that I am relatively new to SQL Server, with most of my database experience being in Informix and Oracle, so the transition to SQL Server is being done at the same time as I am learning LINQ.
One of the dangers of learning a new language (and that's what LINQ is to me), is that you can become proficient at the language, but it may take a while to learn how to architect an application properly using it. LINQ removes months of development effort for the data access layer, and that speed may encourage bad design. Not because you want to make a bad design, but because you aren't in the code long enough during the development cycle to know it is bad design.
To me, bad design has two definable results:
1. Poor performance. In some cases this is obvious right away,in some cases it isn't until much further down the road when you see your database load go up unexpectedly as your app reaches critical mass
2. High code maintenance costs. The idea behind a good design should be that future changes should take much less time than the original effort. But if your original effort on an application was less than a day, is there really a long term payback of spending three weeks doing a huge design effort to extract ten lines of code into another class? Purists will say yes, always. Realists, working with real deadlines and real customers will say it depends.
I think what it comes to is that only experience with a new language will tell you what is and what isn't a good design. Start simple. Don't try to out guess the code or the user. Prioritize optimization based on the critical nature of the code and the size of the project. As you learn a better technique, keep a list of places where you may want to refactor existing code using that technique, and check your list frequently to see if any of those tips apply to what you are doing.
Here are my current best practices for LINQ
1. Don't try to write a best practice until you tried something at least twice
2. Never alter the autogenerated code created by SQL-Metal. Use the partial classes instead
3. Always implement your data relationships on your database. If it doesn't have any, you will save time by going inand adding them as you need them in your LINQ applications. Undoubtedly you will need them later, and the foreign key relation ships defined on the database make it easier for new developers to navigate through a large database.
4. Don't try to do everything in one query. If you need to break things out into more than one query for readability or speed, do it. Even if it seems that multiple queries will result in a lot of extra database traffic, give it a try. You may be suprised at how much better the split queries acually perform, especially if you can cache the results of one of the queries.
5. NUnit is your friend. Write lots of test cases. Write them before you write your LINQ code. You'll need every case you can get your hands on.
My next LINQ goal is to understand how it fits in with tools like SubSonic and the Entity Framework, but for now, I'm just going to focus on mastering LINQ, and learning to ThinqLinq
The next book on my reading list is Programming SQL Server 2005. I need to brush up on the SQL Server basics, and fill in some of my knowledge gaps. I don't think there will be anything earth shattering in it, just a lot of 'Oh, that's cool' things that I could never have done in Informix.
I'll define ThinqLinq as being able to code database queries directly in LINQ without first thinking in SQL. I think it actually works to my advantage that I am relatively new to SQL Server, with most of my database experience being in Informix and Oracle, so the transition to SQL Server is being done at the same time as I am learning LINQ.
One of the dangers of learning a new language (and that's what LINQ is to me), is that you can become proficient at the language, but it may take a while to learn how to architect an application properly using it. LINQ removes months of development effort for the data access layer, and that speed may encourage bad design. Not because you want to make a bad design, but because you aren't in the code long enough during the development cycle to know it is bad design.
To me, bad design has two definable results:
1. Poor performance. In some cases this is obvious right away,in some cases it isn't until much further down the road when you see your database load go up unexpectedly as your app reaches critical mass
2. High code maintenance costs. The idea behind a good design should be that future changes should take much less time than the original effort. But if your original effort on an application was less than a day, is there really a long term payback of spending three weeks doing a huge design effort to extract ten lines of code into another class? Purists will say yes, always. Realists, working with real deadlines and real customers will say it depends.
I think what it comes to is that only experience with a new language will tell you what is and what isn't a good design. Start simple. Don't try to out guess the code or the user. Prioritize optimization based on the critical nature of the code and the size of the project. As you learn a better technique, keep a list of places where you may want to refactor existing code using that technique, and check your list frequently to see if any of those tips apply to what you are doing.
Here are my current best practices for LINQ
1. Don't try to write a best practice until you tried something at least twice
2. Never alter the autogenerated code created by SQL-Metal. Use the partial classes instead
3. Always implement your data relationships on your database. If it doesn't have any, you will save time by going inand adding them as you need them in your LINQ applications. Undoubtedly you will need them later, and the foreign key relation ships defined on the database make it easier for new developers to navigate through a large database.
4. Don't try to do everything in one query. If you need to break things out into more than one query for readability or speed, do it. Even if it seems that multiple queries will result in a lot of extra database traffic, give it a try. You may be suprised at how much better the split queries acually perform, especially if you can cache the results of one of the queries.
5. NUnit is your friend. Write lots of test cases. Write them before you write your LINQ code. You'll need every case you can get your hands on.
My next LINQ goal is to understand how it fits in with tools like SubSonic and the Entity Framework, but for now, I'm just going to focus on mastering LINQ, and learning to ThinqLinq
The next book on my reading list is Programming SQL Server 2005. I need to brush up on the SQL Server basics, and fill in some of my knowledge gaps. I don't think there will be anything earth shattering in it, just a lot of 'Oh, that's cool' things that I could never have done in Informix.
Monday, March 3, 2008
Log4Net in VS2005 Web Application
Here's a link to a blog post on setting up log4net in a Visual Studio 2005 web application.
The real trick to this is to make sure that there is a global.asax file in the applciation and to add the following line to the Application_Start method
The rest of the configuration is pretty straight forward.
The real trick to this is to make sure that there is a global.asax file in the applciation and to add the following line to the Application_Start method
log4net.Config.XmlConfigurator.Configure();
The rest of the configuration is pretty straight forward.
Thursday, February 28, 2008
.NET Extensions Anyone?
If you haven't seen .NET extension methods in action, they're pretty interesting. What are they, you ask? Let's say you have an existing .NET class provided by an external vendor. Let's say that vendor is Microsoft. You want to add a new function to, I don't know, lets say the string class. There's not a hope in hell that you'll get Microsoft to add it for you.
Of course, you could build your own string class, override one of the existing functions, or add a new one, but that seems like a lot of work. Here's an easy way to add a new function to the class, without having to use inheritance at all. And the best part is that within seconds, this class will show up in your Intellisense.
This function must be in a static class, and part of your own project / namespace or compiled into a DLL while you include in your project.
I wrote this function as I have been trying to find an efficient way to build dynamic Lambda queries for LINQTOSQL, but unfortunately, this won't work as 'FindWickedString' is not a function which can be interpreted by SQL Server, and the lambda function I am building executes on SQL Server. So I'll keep digging on the dynamic lambdas, but this is fun as an exercise. Wait. Did I say coding was fun. Egads. I meant work.
Of course, you could build your own string class, override one of the existing functions, or add a new one, but that seems like a lot of work. Here's an easy way to add a new function to the class, without having to use inheritance at all. And the best part is that within seconds, this class will show up in your Intellisense.
This function must be in a static class, and part of your own project / namespace or compiled into a DLL while you include in your project.
I wrote this function as I have been trying to find an efficient way to build dynamic Lambda queries for LINQTOSQL, but unfortunately, this won't work as 'FindWickedString' is not a function which can be interpreted by SQL Server, and the lambda function I am building executes on SQL Server. So I'll keep digging on the dynamic lambdas, but this is fun as an exercise. Wait. Did I say coding was fun. Egads. I meant work.
public enum WildcardMethod { Contains, StartsWith, EndsWith, Exact }
static class Extensions
{
public static bool FindWickedString(this string value, string checkValue, WildcardMethod method)
{
switch (method)
{
case WildcardMethod.Contains:
{
if (value.Contains(checkValue))
return true;
break;
}
case WildcardMethod.StartsWith:
{
if (value.StartsWith(checkValue))
return true;
break;
}
case WildcardMethod.EndsWith:
{
if (value.EndsWith(checkValue))
return true;
break;
}
case WildcardMethod.Exact:
{
if (value == checkValue)
return true;
break;
}
default:
break;
}
return false;
}
Wednesday, February 27, 2008
PredicateBuilder
One of the really cool LINQ tools out there is PredicateBuilder by Joseph Albahari. http://www.albahari.com/nutshell/predicatebuilder.html
His book is next on my reading list, but I am already using PredicateBuilder as part of my current project with is a dynamic query engine for a billing systm.
The only difficulty I am having is passing in column names dynamically. The consensus is that this can't be done, but that doesn't stop me from trying (or at least whining about it)
His book is next on my reading list, but I am already using PredicateBuilder as part of my current project with is a dynamic query engine for a billing systm.
The only difficulty I am having is passing in column names dynamically. The consensus is that this can't be done, but that doesn't stop me from trying (or at least whining about it)
Fun with LINQ
I've really been getting into LINQ these days. I'm currently reading Pro LINQ by Joseph Rattz. The writing style is not a good as the Pro ASP.NET 3.5 book I've previously raved about, but there is a chance that this book is just covering a muchmore difficult topic.
If you haven't ready about LINQ yet, do so. It is coming to a Visual Studio near you. Even if you don't use SQL Server, you can still use it for XML, DataSets and anything that inherits from IEnumerable.
But I do fear that the downside of LINQ is that Microsoft is about to lose a lot of developers because of it. As easy as it is, it is also very, very difficult. 75% of the developers will look at the syntax, the ridiculous numbers of < and >, and run back to hand coding SQL statements and returning plain old data readers. The problem lies in the fact that LINQ Expressions are extremely difficult to read. They're powerful, yes, but the numbers of function delegates and advanced concepts of the .NET Framework that LINQ requires you to know in order to go beyond the most simple queries is a little frustrating.
I'm sure that with time, we will grow use to reading Lambda expressions just like we read regular code, but I think a large percentage of developers will be scared off from the syntax and will never try. They will stay with their tried and true methods of data access, and count the days to retirement. I don't blame them. A new concept like LINQ or NHibernate or The Entity Framework comes along every year. I skipped a whole generate of these tools, and here I am, now working in LINQ.
If you haven't ready about LINQ yet, do so. It is coming to a Visual Studio near you. Even if you don't use SQL Server, you can still use it for XML, DataSets and anything that inherits from IEnumerable
But I do fear that the downside of LINQ is that Microsoft is about to lose a lot of developers because of it. As easy as it is, it is also very, very difficult. 75% of the developers will look at the syntax, the ridiculous numbers of < and >, and run back to hand coding SQL statements and returning plain old data readers. The problem lies in the fact that LINQ Expressions are extremely difficult to read. They're powerful, yes, but the numbers of function delegates and advanced concepts of the .NET Framework that LINQ requires you to know in order to go beyond the most simple queries is a little frustrating.
I'm sure that with time, we will grow use to reading Lambda expressions just like we read regular code, but I think a large percentage of developers will be scared off from the syntax and will never try. They will stay with their tried and true methods of data access, and count the days to retirement. I don't blame them. A new concept like LINQ or NHibernate or The Entity Framework comes along every year. I skipped a whole generate of these tools, and here I am, now working in LINQ.
Visual Studio Tip - TODO
Here's a tip that seems pretty obvious, but I've never used it before, and it's really useful, especially if you are going to hand code off to someone else to finish
Add a comment line to your code as follows
// TODO - Add a task to complete here
Then, go to the main menu bar, and select View - Task list. In the task list Window, there si a drop down list that says either Comments or User Tasks. Switch to comments. TADA! TODO!
Quick, easy, and professional! No more sticky notes or long emails about what is left to do. And it gets tracked with your source control so you can see who made the change and when. You are use isource control, right?
Add a comment line to your code as follows
// TODO - Add a task to complete here
Then, go to the main menu bar, and select View - Task list. In the task list Window, there si a drop down list that says either Comments or User Tasks. Switch to comments. TADA! TODO!
Quick, easy, and professional! No more sticky notes or long emails about what is left to do. And it gets tracked with your source control so you can see who made the change and when. You are use isource control, right?
Wednesday, February 20, 2008
Recent Reading
I recently finished my first pass of ASP.NET 3.5 in C#2008 by MacDonald and Szpuszta. What an amazing book. I learned something new on just about every page. It's a pain in the but to lug this monster around every day (it's 1500 pages), but I learned so much that I consider it required reading for developers trying to get caught back up with technology if you've been stuck in a rut.
I've also almost completed reading Head First HTML with CSS and XHTML. The first half of this book wasn't anythingnew to me, but the second half really helped get me up to speed with CSS and since that is exactly what I am working in this week, it is really helping. It's a very quick read. I'm getting through about 200 pages a day (there are a lot of graphics). The Head First series isn't for everyone, and I thought I'd give it a try. It's great for doing catch up on technology, but I wouldn't use it to try to learn some huge new concept.
I'm debating what will be my next work topic to read about. It may be Code Complete 2 or perhaps Programming SQL Server 2005, or maybe a book specializing on LINQ.
I can't believe how much reading I am able to get done while riding the Sounder back and forth to work. It would have taken me a year to work through ASP.NET 3.5 at home. I'm definitely in the learning groove, and on track to get caught back up on the technology I need to do my job.
And the writing bug is hitting again. YAY!
I've also almost completed reading Head First HTML with CSS and XHTML. The first half of this book wasn't anythingnew to me, but the second half really helped get me up to speed with CSS and since that is exactly what I am working in this week, it is really helping. It's a very quick read. I'm getting through about 200 pages a day (there are a lot of graphics). The Head First series isn't for everyone, and I thought I'd give it a try. It's great for doing catch up on technology, but I wouldn't use it to try to learn some huge new concept.
I'm debating what will be my next work topic to read about. It may be Code Complete 2 or perhaps Programming SQL Server 2005, or maybe a book specializing on LINQ.
I can't believe how much reading I am able to get done while riding the Sounder back and forth to work. It would have taken me a year to work through ASP.NET 3.5 at home. I'm definitely in the learning groove, and on track to get caught back up on the technology I need to do my job.
And the writing bug is hitting again. YAY!
CSS Path Lesson Learned
Situation:
A graphic I was trying to display in the main page header on a website was not showing up. The header was build via a CSS page. All other graphics on the page were working.
Solution: CSS background:image links must be specified with the path from the css file, not from the page using it. (DUH)
A graphic I was trying to display in the main page header on a website was not showing up. The header was build via a CSS page. All other graphics on the page were working.
Solution: CSS background:image links must be specified with the path from the css file, not from the page using it. (DUH)
Monday, January 14, 2008
Recent Reading
I just finished reading Microsoft SQL Server 2005 Reporting Services 2005 by Brian Larson. It's a pretty good introductory book, and after reading the first 11 chanpters, and skimming the last couple, I think I've got a pretty good idea on how to get started with SSRS2005. Unfortunately, by the time I actually get to use any of this, we'll probably be on SSRS2008, and I'll have to get the next version, but hopefully there won't be a lot of changes.
I'm currently digging into SQL Server Free Text searching and other search engines to be used for searching relational databases. The SQL Free Text search has a few major downsides:
1. It can only index one database
2. You need to actively update the database indexes on a schedule, or the search will not get accurate information
3. You need to specify the columns to include in your searches through your indexing.
This may still work to do what I need, but there will be a lot more effort than originally planned.
I am also researching and comparing LINQ, CSLA, NHibernate and the Microsoft Entity Frameworks for use in my data layers. No winners yet, as they all offer benefits. The biggest loser in using these tools is WCF, since using WCF removes a great deal of the capabilities built into each of these tools for CRUD operations.
Finally, I've been cracking open Visual Studio 2008, mainly to look at LINQ and new ASP.NET functionality.
More to learn, always more to learn.
I'm currently digging into SQL Server Free Text searching and other search engines to be used for searching relational databases. The SQL Free Text search has a few major downsides:
1. It can only index one database
2. You need to actively update the database indexes on a schedule, or the search will not get accurate information
3. You need to specify the columns to include in your searches through your indexing.
This may still work to do what I need, but there will be a lot more effort than originally planned.
I am also researching and comparing LINQ, CSLA, NHibernate and the Microsoft Entity Frameworks for use in my data layers. No winners yet, as they all offer benefits. The biggest loser in using these tools is WCF, since using WCF removes a great deal of the capabilities built into each of these tools for CRUD operations.
Finally, I've been cracking open Visual Studio 2008, mainly to look at LINQ and new ASP.NET functionality.
More to learn, always more to learn.
Subscribe to:
Posts (Atom)