# Wednesday, August 12, 2009
Some tools I downloaded today which appear VERY useful, and touching on the ORM topic.
Wednesday, August 12, 2009 6:31:11 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, August 11, 2009

Tonight I didn't get as much time to work on the site as I would have liked, so I focused on getting the admin pages up on the production server so I could do some "behind-the-scenes" work remotely. This required some security, which I started last night, but the data migration for that was a bit more daunting, so I needed to finish it tonight. While the authentication providers and controls do handle a LOT, it has an interesting learning-curve, and deployment can be a challenge as well. All-in-all, it sure beats writing all that code by myself.

I tried to use a lot of caching and cached settings to help improve the performance on certain pages, especially my client list. On my admin pages, I made sure to create a means to reset that cache without having to do a complete server reset. Actually, the same approach I took would work well for high availability sites, as the method I used to complete this would not require a server reset to re-load systems. When I was int he banking industry, high-availability was a huge issue, and simple config changes meant waiting for a scheduled system outage or worse, an emergency outage. When I redesigned that site, that was one of the top priorities I had.

It occurred to me how much time it takes to set up the infrastructure of a site: master pages, common libraries, configuration files, CSS, etc. Once those are done, if done properly, the rest of the site should go fast. One thing I have found to speed that up was the use of Visual Studio Project Templates. Combined with code generation like CodeSmith, you can really generate web sites extremely fast, and get on to coding the "fun" items. I will write about both of those in the future (CodeSmith and Project Templates) once the site is stabilized.

Tomorrow night may not have a lot of development, as my parents will be in town. Later this week, I will be coding my next control: the activity feed. When posts and feeds are made or read, this control will snag it, and place a brief "teaser" on the home page.

Tuesday, August 11, 2009 6:05:59 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, August 10, 2009

I finally managed to get my client list online today. From a technological standpoint, it was pretty straight forward. I store the information in the database, and use my CodeSmith templates to create a class for extracting the data, and then use a Repeater to present the information in a table format. I still need to make some changes to it, but all in all, it works well. Since the data won't be changing often, I did cache the data to make it come back faster.

I started working on security for my Administration pages. I need to get that set up before I can activate the admin pages, but I have run into some issues getting it all configured. I ran into this once before with the ASP.Net forms authentication security provider, but this time is a little different, as I only want to secure one folder. Certainly not too difficult to do, but not as easy as I would have hoped either.

Once I get the security and login page worked out, I'll begin working on my "links" page. The idea here is that when I blog, or post to twitter, or a few other ideas I have, it will update the dark blue control on the home page with a summary and hopefully someone will click through to get the rest of the details. This should be fairly straightforward to do. Since most of the services respond in XML, I'll just use a factory method to instantiate the proper object, which will know exactly what information I want to extract from the XML feed. As I add more items I want to track, I will simply have to implement the same interface and it will plug right in to my "updater". For the items which return XML (e.g. RSS or Twitter), I will use LINQ for XML to grab just want I want and populate the data right into my classes.

Which brings up a point...

I could probably do this almost as easy with XPath. When does it make sense to move to the more "sexier" technology as opposed something proven and works well? For example, a lot of times, when a new technology is rolled out, it tends to be buggy and some of them historically have not performed well (e.g. early XML for those who have been around a while). All things equal, when does it make sense? Just a rhetorical question, but one I got hit with recently.

I was in a technical interview for a job I wasn't planning on taking (drive was too far -- the company I was representing knew this as well, they just wanted me to be on their radar for the future). I was asked about a particular implementation of the new List object. Honestly, I know how to use the List object, and he was asking about some of the internals I really hadn't needed to know.

If I was having performance issues, I would want to know, and then I would look into it further. In this case, I was able to provide at least 4 other reasonable implementations based on the criteria I was given, yet, I still couldn't get the "sexy" answer he was looking for. At what point does it really matter? For my part, I didn't like NOT knowing, and I did look it up when I left, but in the big picture, when does it become relevant? In my book, the practical solution to a relevant problem always supercedes technical "sexiness".

All Things | ASP.Net | C# | CSharp | Design | General
Monday, August 10, 2009 5:58:40 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
# Friday, August 07, 2009
A plug for my company, Rubicon Computing Solutions, LLC.
Friday, August 07, 2009 6:02:11 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, August 05, 2009
Using LINQ to XML to work with the Twitter response, and modifying the Yedda Twitter API wrapper.
Wednesday, August 05, 2009 6:34:05 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, August 04, 2009

Note: For visitors of your site, this entry is only displayed for users with the preselected language English (United States)/English (United States) (en-US)

How the VS2008 IDE is very helpful to conditional compilation, and also how the site is coming along

Tuesday, August 04, 2009 6:15:10 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Sunday, August 02, 2009

As the main site is developed, I'll detail what decisions I used to create the site, then a high level overview of how I designed it. Just a warning though, some of the decisions will seem very arbitrary, as they were. I made them simply because working on your own site gives you a luxury of trying things you normally can't do with a client. In my case, a lot of my decisions will be over-engineered, because I may want to re-use them later.

Of course, the first thing I had to come up with was an overall site layout. I won't go into that here, as one thing I will never profess to be is a layout guru. I got a decent design, and I set them up as a master page so the rest of the site development will go easy. I used VS2008 and C#, and began implementing AJAX where it made sense. For example, there's a control which updates the current time every 30 seconds or so, so I could use the update panel and timer control.

The first real functionality I wanted to add was a link to this blog. So I created a user control, and placed it on the front page. However, I do plan on posting a lot more here, so I knew it wouldn't be feasible to show every post, so I decided to limit it to the latest three posts. I wanted to display the title, the date and the first bit of the post to hopefully catch a reader's attention.

But reading from a feed from sites at two different hosting providers can be tricky. Not from a security standpoint, as RSS feeds are open, but more from a performance standpoint. Anyone coming to my portal site should be able to see the latest posts, and quickly. The fastest way of doing this would be to create a Windows service which periodically reads the feed, and stores the information in a database. However, I am not sure I would be able to install a Windows service on my service provider's server. So......

What  I can do however is read the feed, and place it in cache. Periodically, I can expire the cache and re-load it, and unless you are the unlucky soul to have to wait while it loads, the majority of the users will have a quick response. For that poor soul who waits while cache is refreshed, I used Ajax and the UpdateProgress control to provide some visual feedback that the page is doing something.

The rest was pretty straightforward. I either request the XML from the RSS feed (or cache), and use XSLT to display it. It's been a while since I have used XSLT, but there is a lot of potential there, I expect I will be using a lot more of it in future controls. I created the class generically so that I could pull any RSS feed I wanted from it as well.

One great use I found for XSLT was on a high-availability web site which sent a lot of emails. We wanted to be able to change the email format frequently without bringing the site down. Using XSLT, we could change the email template files any time to create very nice HTML based email messages. I read a great article recently about calling C# functions in your XSLT templates using extension methods, which I plan to use extensively, as C# is my main domain. Maybe I will use them... I say that as I really would like to improve my XSLT skills, as I think the technology is highy underused in the .Net world.

So now I am playing with Twitter feeds and getting the rest of the site content set up. I also used the AJAX popup control to help prevent any 404 errors as I complete the functionality. If you've been putting off using the AJAX Control Toolkit for some reason.. STOP! The amount of functionality these controls offer is amazing, and you can't beat the price.

That's it for now! If you want more details on how I accomplished this or some sample code, just send me a comment. Upcoming posts will address the development of the rest of the site, along with some major wins recently using CodeSmith.

 

All Things | ASP.Net | C# | Design | General
Sunday, August 02, 2009 3:54:16 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 

The past three years have been spent more managing teams of developers than actually doing development. On my current gig, I have gotten more of an opportunity to get back into the code, and I have to say, I mhave missed it immensely.

As a result, I have started doing coding purely for myself, and I have to say it has been immeasuably enjoyable. So I put my company's website back online, but this time it uses AJAX, RSS feeds, and soon, Twitter!

It's been an interesting and fun hiatus from pure coding, but now I am really looking forward to updating my skills again, and writing about it along the way.

This post will be the first "real" test of my onsite RSS reader. So in a bit, it should appear on the front page of my all new company portal site... Rubicon Computing Solutions!

Sunday, August 02, 2009 1:30:11 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, June 13, 2006
New Data property of the Exception class is quite useful!
Tuesday, June 13, 2006 4:42:38 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
# Tuesday, May 16, 2006
Get the name of the current db in t-sql
Tuesday, May 16, 2006 4:38:30 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
# Friday, April 28, 2006
A new blog...
Friday, April 28, 2006 4:38:06 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, March 27, 2006
A humorous story I remember from my adventures as a consultant...
Monday, March 27, 2006 4:49:48 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, March 22, 2006
Easy solution..
All Things | C# | General | Tools
Wednesday, March 22, 2006 11:00:20 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [1]  | 
Re-inventing an outdated but very useful wheel....
All Things | ASP.Net | C# | CSharp | General | Tools
Wednesday, March 22, 2006 3:44:55 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, March 21, 2006

Is it just my installation, or is WinCV missing from the latest version of .Net? Granted, I can still use the old WinCV by changing the config file, but why was such a useful tool pulled from VS2005?

If you've never used WinCV, check it out for VS2003 and prior version. It essentially lets you search the framework for a certain keyword. For example, if you want to find out which namespace "Registry" is in, type it in, and see the entire implementation. By using the configuration file, you can add additional assemblies for WinCV, to search your own libraries or those of third party vendors.

 

Tuesday, March 21, 2006 1:48:01 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Friday, March 17, 2006

I've been playing a bit of poker recently, and having mixed results. Earlier this year, I was on a tear, and couldn't lose. Lately though, it's been a bit dry. I played in a tournament on Sunday at a local casino, and finally made the final table again, and even did ok in te cash game leading up to it.

Tonight was a humorous night though. I decided to play again, as I am in the running for a finals tournament at the casino I placed on Sunday. First, I played against a handicapped player, and we came up with a device to help quadraplegics to play poker with less assistance than it normally takes. Now I just have to find the parts and see if I can put it together, as it looks like a very viable solution to help him. But secondly, I have to say tonights tournament was the "worst" I have ever had. Although I managed to stay alive for 2.5 hours (mainly due to the lack of playable hands or situations), I did not win a single hand. However, I DID manage to chop one, so I will count that as 1/2 of a hand, but all I won were half the blinds. If you count the cash game I played prior to the tournament, I think you could take that losing streak to 4 hours of not winning one hand. Fortunately, losses were minimal, as the hands I was starting with were poor quality, and I just rode out the blinds. I think that is the longest I have ever gone. What a test of patience!

Such is poker...

Friday, March 17, 2006 5:39:58 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, March 16, 2006

Previously, I discussed how I worked around a firewall issue where the HTTPS port was re-mapped, and the return URL was different than the request URL as a result of that remapping. So I trudged on, and hit a real stumper. Here’s the new issue:

 

The underlying connection was closed: Could not establish secure channel for SSL/TLS. Inner Exception: The function completed successfully, but must be called again to complete the context

 

I ran across Jan Tielen’s blog post (http://weblogs.asp.net/jan/archive/2004/05/08/128394.aspx) where he provided a code snippet to override the GetWebRequest method in the Reference.cs file. I implemented it, and it worked great --- on my development machine! However, when rolled out to the same test environment, the problem remained. However, I modified it futher, and got it to work..

 

/// <summary>

/// Set web request properties here

/// </summary>

/// <param name="uri">uri </param>

/// <returns></returns>

protected override System.Net.WebRequest GetWebRequest(System.Uri uri)

{

   System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)WebRequest.Create(uri);

   webRequest.AllowWriteStreamBuffering = true;

   webRequest.KeepAlive = false;

   return webRequest;

}

 

Sort of. When I tried to use DIME with the above code, it gave me an error “Client found response content type of '', but expected 'text/xml'”. That was not going to work. I found some more code, and it seemed to work great once again, until I tried to make a DIME call. Here was that attempt.

 

protected override System.Net.WebRequest GetWebRequest(System.Uri uri)

{

     WebRequest request = base.GetWebRequest(uri); ;

     if (requestPropertyInfo==null)

         requestPropertyInfo = request.GetType().GetProperty("Request");

     

     HttpWebRequest webRequest = (HttpWebRequest)requestPropertyInfo.GetValue(request,null);

     

     webRequest.KeepAlive = false;

     webRequest.ProtocolVersion = System.Net.HttpVersion.Version10;

     return request;

}

 

Once again, it worked fine during my WSE calls, but failed when trying to use DIME attachments with the following error:  found response content 'application/dime', but expected 'text/xml'

 

To save any readers some time, I will go through everything I tried to resolve the problem, and finally, how I ended up resolving it. Here’s the items which didn’t work:

 

-- tried setting the SoapActor

-- tried turning off the Document protocol

-- tried setting the request and return URI

-- tried overding the GetWebRequest function a few different ways

-- tried using wsdl instead of asmx in setting up the Web Reference

-- tried setting the URI target/destination seperately

-- moved web service to the same machine as the calling web site (but still had to make an external call)

-- turned on tracing input and output and analyzed the logs created by WSE 2.0

 

So what finally worked? I ended up abandoning DIME, and encoded the file as a string, and passed it as an element of my XML. Here’s the code to encode the file as a string.

 

/// <summary>

/// Encodes the file in a Base64 string format.

/// </summary>

/// <param name="file">Name of the file.</param>

/// <returns></returns>

private string EncodeFile(HtmlInputFile file)

{

      try

      {

            if (file.PostedFile.ContentLength > 0)

            {

                  byte[] fsBytes = new byte[file.PostedFile.ContentLength];

            System.IO.Stream fileStream = file.PostedFile.InputStream;

            fileStream.Read(fsBytes, 0, file.PostedFile.ContentLength);

 

            return Convert.ToBase64String(fsBytes);

            }

            else

                  return String.Empty;

      }

      catch (Exception ex)

      {

            //Handle the Error

            return String.Empty;

      }

}

 

What a trip it was to get there, but the resulting service has performed well, and I don’t have the issues I had with DIME. Don’t get me wrong, DIME worked great. But deployment of the web service in a secure environment proved to be quite a challenge. If you need more detail in resolving your issue, feel free to leave a comment or shoot me an email, and I will be glad to save you some of the pain I had to go through!

Thursday, March 16, 2006 5:19:42 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  |