Development
As of late I have gotten a chance to use the ASP.Net AJAX extenders and script controls, and so far am really liking how they work, though it would be nice if adding the .js was a little cleaner then manually adding them to the assembly wether in the AssemblyInfo.cs or the controls cs file. I have to say I really like the extender and script controls that come with the ASP.NET AJAX. They really are so much nicer to work with then building up Javascript strings in the CS file of the server control. I do...
posted @ Monday, July 07, 2008 4:09 PM |
I have been following Rob Conery's posts on the MVC Storefront, and trying the repository/pipes-filters for data access that he has been using. While trying out the implementation of a LazyList he was using, I had noticed that the example table was being joined onto the category table. At the time however, I really had not thought much of it, until I read MVC Storefront: Brainbender Intermission which got me thinking. Admittedly, I don't really have to much of a problem with it loading all of the examples for all the categories at one time at the moment. However,...
posted @ Wednesday, May 21, 2008 12:34 AM |
I had a whole post about this, in my mind, but as I was typing, I kept poking holes in my points as to why I hope that in the end IHttpContext stays around.
However, since am trying get into the habit of actually sleeping at night I'm just going to put a couple of sentences in.
In Abstract Base Classes Have Versioning Problems Too Haacked gave an example that of a problem with ABCs, that at some point later a virtual method would be added, and throw a not implemented exception. This in itself seems to be a breaking...
posted @ Saturday, March 15, 2008 7:32 PM |
I figured out what I was missing in I think I'm missing something. It was using ".Join" instead of ".Where".
And it turns out that it is a much cleaner implementation then I had done in Got my nice Urls working. So here it is.
var cats = this.Categories.Where(c => c.Name == navList.First().Value);
foreach (var item in navList.Skip(1))
{
string name = item.Value;
cats = cats.Join(this.Categories.Where(c => c.Name == name)
,c=>c.Key,c=>c.ParentKey.Value,(c,p)=>p);
}
cat = cats.First();
Which generates the correct Sql bellow
Edit:
Does anyone know if there is a book for LINQ (to SQL in...
posted @ Tuesday, February 05, 2008 11:02 PM |
I finally found time to work on DevExamples.com again and thought I would check on the suggestion that Richard had left on Got my nice Urls working about using incremental LINQ. Overall I found that I liked the following syntax much better var cats = this.Categories.Where(c => c.Name == navList.First().Value);
foreach (var item in navList.Skip(1))
{
string name = item.Value;
cats = cats.Where(c => c.Name == name);
}
cat = cats.First();
Unfortunately this only works for the first parent in the hierarchy. After the first parent, it continues to simply work off of the single join. The problem...
posted @ Tuesday, February 05, 2008 10:30 PM |
Its amazing how fast things can be done when not fighting bad assumptions. In this case it was that my admin URLs needed to use the nice descriptive URLs, instead of just /[Controller]/[Action]/[id] type routing. Once I realized I was making things overly complicated I, I ended up with a set of routing functions that are actually a bit less complicated then what I would have come up with if I had been able to extend the RouteTable the way I had planned originally. I also decided that I didn't like the idea of having the make every category and...
posted @ Monday, December 24, 2007 3:44 AM |
Well, Bill Pierce in his post about making the HttpContext wrapper use the application as a service provider got me to a good enough solution for the script service I had wanted in my previous post.
While not quite as clean as adding it to the HttpContext, I think an extension method on HttpApplication like this will work well for now.
public static object GetService(this HttpApplication application,Type service)
{
IServiceProvider provider = application as IServiceProvider;
if (provider == null)
return null;
return provider.GetService(service);
}
Then add/implement the IServiceProvider...
posted @ Tuesday, December 18, 2007 11:06 AM |
I was trying to determine the best way to secure my admin* actions when I thought of something I had only really seen while studying for my MCSD.Net exams, or maybe it was the MCPD upgrade exams I haven't gotten round to taking.
I decided to secure the admin controller actions using.
[PrincipalPermission(SecurityAction.Demand,Role="<Role>")]
Which I had never used even though I started programming .Net in during the beta of 1.0. And I have to admit that each time I run into something like this, it makes me feel that my thought in a previous post is right.
This works for my immediate...
posted @ Tuesday, December 18, 2007 1:22 AM |
After working on the login usercontrol, I decided that I wanted to add similar functionality to the navigation sections of the site for accounts/roles that didn't get ads displayed. So I needed a standard way to put dynamic sections into a page. I liked the syntax used by the form HtmlHelper methods, so decided to base it off of the SimpleForm class and ended up with this//Based on the SimpleForm class in MvcToolkit //Wish I believed I would have ever thought to use//IDisposable to do thispublic class SimpleWrappingTag : IDisposable{
protected string _beginTagFormat = "<{0} {1}>";
...
posted @ Sunday, December 16, 2007 12:32 AM |
Since administration was the next part I wanted to work on.
I decided that for the moment I just want a little login for in the upper corner like
I decided to put the login screen view logic into a user control, and added the following user control named Login.ascx and placed it into the Shared
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%if(!Page.User.Identity.IsAuthenticated) {%>
<form action="/Home/Login" method="post" id="LoginForm">
<span id="EmailLabel">Username:</span><br />
<%=Html.TextBox("Username")%><br />
<span id="PasswordLabel">Password:</span><br />
...
posted @ Friday, December 14, 2007 12:16 AM |
It turned out to be a lot easier to work around not being able to override the route parsing method then I had thought it would be last night. Though when they allow me to override that method I will be changing over. By setting up the following routes I was able to get almost the effect that I was looking for:RouteTable.Routes.Add(new Route
{
Url = "Example/[id]/[action]",
Defaults = new { Controller = "Example" },
RouteHandler = typeof(MvcRouteHandler)
});
RouteTable.Routes.Add(new Route
{
Url = "Example/[Category1]/[id]/[action]",
Defaults = new {...
posted @ Thursday, December 13, 2007 12:12 AM |
My first thought is, I really wish I could use this at work, but it is working nicely so far for my rewrite of my web site. Writing Classic ASP style again is taking a little getting used to again though, the visual preview from the designers made styling the page a lot nicer. The lack of control designers also seem like it would hinder having a graphics guy using Expression Web do the UI with MVC based web applications. But I have never worked with a graphics guy on a project that way anyway so I am could...
posted @ Wednesday, December 12, 2007 1:32 AM |
I just committed the changes to provide 3 administrative rss feeds: Comments Needing Moderation Referrals Errors The change also uses the HttpModule that will convert forms authentication into basic authentication so that the feeds can be viewed in an Rss reader. After seeing http://msdn2.microsoft.com/en-us/library/Aa479391.aspx I had thought about changing over to use it instead of the simple module I wrote. I decided not to however because it would have meshed well with Subtexts security model. This was one of the more interesting things I have worked on in a while, though I am already thinking of several improvements that...
posted @ Wednesday, September 19, 2007 12:51 AM |
I decided to implement Admin Rss Feeds after a particularly draining Friday. For the most part it went pretty smoothly, and learned something about working with a different team too ;). I Implemented an HttpModule that looked for FormsAuthentication redirects for rss feeds and changed it over to use basic authentication so rss readers could authenticate.
And for a while all was good. In fact other then unit tests I had thought I was done.
Then just to be thorough I set up several subfolder blogs off of localhost, and everything stopped working. Apparently something in the way that the rss HttpHandlers...
posted @ Sunday, September 16, 2007 3:02 AM |
Well the blog alias feature is in, and the self spam in my referral section has reduced significantly since I started using it last night. Its also nice not seeing Google and Yahoo spidering my blog on 4 different domains (still don't know how they got 2 of them). How To Use Blog edit screen has a list all the domain aliases, and a button to add a new alias. If an alias is found, redirects request to the associated blog. Aliases can be at both the host and subfolder level.Note: Requests are validated against blogs...
posted @ Wednesday, September 12, 2007 2:08 AM |
I was reading IHttpContext And Other Interfaces For Your Duck Typing Benefit over on Haacked. It reminded my of something I did Thursday, which made me wish that .Net 3.5 was already usable. I actually finally convinced my boss to let me try to automate at least some of the testing. So first order of business, change our the SQL installer program we use to allow it run without user interaction. After a good amount of refactoring of the monolithic control function, I get that part working. It can now do everything it needs to do by passing in all...
posted @ Monday, September 10, 2007 1:12 AM |
I doubt I actually had anything direct to do with it but something seems to have clicked with one of the junior developers. I'm pretty sure it wasn't something that I had done, other then figuring out an effective way to make him realize that it is in his best interest to not need me to walk him through things. Nothing threatening, simply reminding him of a couple of thing: I brought up that I had basically reached a plateau at the company, and that I was considering pursuing other opportunities (In fact I'm planing on talking to my boss about...
posted @ Tuesday, August 28, 2007 11:54 PM |
For the last few months I have been trying to figure out how to be able to answer yes to this question. Unfortunately I have also been failing rather spectacularly at it, the junior programmers my boss hired and assigned me as something of a mentor for have shown very little improvement (sometimes even getting worse).
Unfortunately I was "gifted" with the ability to work with other peoples code, at least when I have some clue as to the intent. Now before you start saying "oh how nice for you", it wasn't said to brag, it was an excuse I keep...
posted @ Monday, August 27, 2007 12:08 AM |
I have read most of the Essential Windows Workflow Foundation book by Dharma Shukla and Bob Schmidt. I would definitely recommend it for anyone who is just starting with WF or who is just curious as to the why features were implemented a certain way. This book probably is not for you however if you are looking for a more hands on book.
Which brings me to the next book, which I wish I had started first, Learning WCF: A Hands-on Guide by Michele Leroux Bustamante. While a lot of the information in the book is available on the web, having the...
posted @ Sunday, August 26, 2007 10:31 PM |