April 2007 - Posts
If you work with a lot of different projects / solutions, you probably like the ease of use, that the VS Start page offers. I end closing the start page, so that it's not in the way after I start working on a project.
In VS2003, the start page was one click away on the help menu.

In 2005, it was moved to the View | Other Windows menu item, two clicks away, and a lot of careful mouse movement.
I'm not sure why I didn't think of this before, but it's easy to move back, and I love the idea, so I thought I'd share. You probably already know how to do this, but if not, right click on any blank toolbar area, and select Customize. You'll see this window.

Simply navigate to View | Show Start Page, and drag that item up to the Help menu. Then close the customize menu. Vwaaaala - you now have your "Show Start Page" on the 2005 Help Menu.
From Scobles Link Blog on Twitter, I found this very cool Bubble Box in WPF, complete with Frames Per Second rendering count.

Today's highlighted Resharper feature.
Optimize Using's. I love this. Love it, Love it, Love it.
A default C# code behind of an aspx page looks like this.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace myKB.CRMServer.Web
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
After you code against the page for awhile, you'll consume some of those "using statements", but mostly not all of them. Resharper has an auto format command with CTRL+ALT+F. That shows this dialog.

Click reformat, and you're left with.
using System;
using System.Web.UI;
namespace myKB.CRMServer.Web
{
public partial class WebForm1 : Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
The System is there for the Parameters in the Page_Load method, and System.Web.UI is left behind, for the Page that WebForm1 is inheriting from.
Does this help any? Yes. Reflection is much faster, without having to look through all the using assemblies that aren't in reference.
Doesn't that make it harder to use objects not referenced, since they won't show up in intellisense? Oh but they can, and they will in my next blog post :)
Thanks Resharper for such a great product.
In the last 30 days, we've started exploring CMS solutions for some of our marketing sites. These sites are very content centric. Multiple people from around the country are responsible for content. Only certain people can see certain things, yada yada, the same CMS concerns everyone else has.
Umbraco is built to take advantage of asp.net, and it's source is available here on CodePlex.
For example, you can easily create a page that renders a server control (datagrids etc), or user controls. Follow this. you need a contact form. It has name / message fields. Here is how I built it, in < 5 minutes. BTW, i'm still using the MVP patterns here I've been teaching for the last few years.
Create a user control, with 3 controls on it. 2 textboxes, and a submit button. In the code behind of the submit button, save the comment to database / web service / whatever. So it's working, and you're ready to push it into Umbraco. Compile your Web Application Project (has to be WAP, not the old school website). Move your website dll, and the acsx file up to the Umbraco installation.
Create a new page in Umbraco, and it asks for the user control path. That's it. You have a custom user control being rendered / posting back inside your CMS.
It also has a really pretty user interface. It's very easy to use.
Over the coming months, I'll write more about how we're interacting with Umbraco, and when our sites go live, I'll update this post so people can take a peek.
If you're looking for an ASP.NET CMS solution, you owe it to your self to check out Umbraco.
If you've ever seen my demo, you've noticed that I use and talk about Resharper a lot. I love it. It does so many things that enhance productivity, it's simply amazing.
Here is my favorite feature of the day.
Open Files. the myKB.com project has over 15 projects, and thousands of files. Navigating to them is a PITA with click, click, click. With Resharper you can turn on a feature called. Use Camel Humps.

With this feature turned on, you can find "things" (files, methods, properties) by just typing the upper case characters of the name. Watch this.
CTRL+SHIFT+N shows my a little data entry window for text input.

Typing SG ( for security group ) shows me, the files that match. With arrow keys, or more typing, it's very easy to get to the file your looking for.

VERY Helpful.
Snag it has "profiles" that can be saved after you get it setup as you like it. These profiles can also be downloaded. TechSmith (owners of SnagIt) have made a set to Flickr Profiles available for download.
The only problem is that they don't work.
Something changed, sometime, somewhere, and they're broken.
So I called support (who were very fast and friendly), and they said, "Yup, those don't work anymore". and pointed me to a new solution.
This is an "output" solution. In Snag it, after you capture the screen, you're taken to a preview application. The Outputs are icons above the screen.

This can be downloaded ...
http://www.techsmith.com/snagit/accessories.asp
Once that's installed, then Flicker4Writer.com is very useful.

I just spent an hour trying to get a remote database schema sync'd up with my local machine. Some sort of relationship wasn't inline. Then, like a lightening strike, I remembered that I have a registered copy of SQLCompare from Red-Gate.com. ( Download Trial )
Start SQLCompare, Compare Remote with Local. It tells my that I have 288 identical objects, and one out of sync. Click sync, and in seconds, I found my fix.
Why is it that sometimes we developers like to do things the hard way?
For anyone interested, my twitter account is
http://www.twitter.com/scottcate
The MVP is used for a lot of reasons, but mainly it does a **VERY** nice job of separating business logic from the UI.
M. = Model
V. = View
P. = Presenter
UX. = User Experience ( Web Form in this case)
In this implementation of MVP, Model will not be used. Only V and P with UX. The Model is where your data activity, and other "stuff" goes. This example is just meant to show how to get business logic out of your UX code.
Here is a basic Contact Us Web Form that we'll build with the MVP Pattern.
The first step of MVP is to create a contract. We're going to use a .Net Interface for that. Create a file called IContactUs.cs and use this code. This is our VIEW in the MVP.
public interface IReaderContactUs
{
string Name { get; }
string Email { get; }
string PhoneNumber { get; }
string Message { get; }
string Result { set; }
}
The interface is like a blue print to a house. No implementation, just directions. This interface says that we have to be able to "GET" Name, Email, PhoneNumber, and Message. And that we have to be able to "SET" a Result string.
Next we need a Presenter. The presenter is the worker bee. The presenter actually does the work. Interestingly, the Presenter knows **NOTHING** about the UX. Repeat **NOTHING**. The presenter is usually in a different class library, and only referenced from the UX code. In order to enforce out contract (the .net interface we just created) we want to only be able to create a presenter, with an instance of the Interface. To do this, notice that our only constructor takes a single param that is the interface. Here is the code for our presenter; named ContactUsPresenter.cs
public class ContactUsPresenter
{
private readonly IReaderContactUs view;
public ContactUsPresenter(IReaderContactUs view)
{
this.view = view;
}
public void ProcessForm()
{
//do something - save it, send it, process it
//in this case, just modify the UI, so we
//know it's running.
//This is where you would normally make a call into the model StringBuilder sb = new StringBuilder();
sb.Append(string.Format("Name : {0}<br />", view.Name));
sb.Append(string.Format("Email : {0}<br />", view.Email));
sb.Append(string.Format("Phone : {0}<br />", view.PhoneNumber));
sb.Append(string.Format("Message : {0}<br />", view.Message));
view.Result = string.Format("<h1>Success</h1>{0}<hr />", sb);
}
}
Finally we get to the code behind of our Web Form. Our web form Implements the Interface. All this means is that our web form has to be able to "GET" Name, Email, PhoneNumber, and Message. And that we have to be able to "SET" a Result string. Notice the appropriate Get / Set routines that wrap around the asp.net server controls.
Notice that we have a private ContactUsPresenter, that doesn't get instantiated until the OnInit event. This is because we have to send in an instance of the interface, which is the this keyword. Then when the button is clicked, the presenter.ProcessForm(); is called to do the work.
public partial class ContactUs : UserControl, IReaderContactUs
{
private ContactUsPresenter presenter;
public string Name { get { return NameTextBox.Text; } }
public string Email { get { return EmailTextBox.Text; } }
public string PhoneNumber { get { return PhoneTextBox.Text; } }
public string Message { get { return MessageTextBox.Text; } }
public string Result { set { ResultLabel.Text = value; } }
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
presenter = new ContactUsPresenter(this);
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SubmitContactButton_Click(object sender, EventArgs e)
{
presenter.ProcessForm();
}
}
I hope this is helpful, and is a good starting point for the pattern.
This is old hat for some of you, but I'm just getting around to it, so I figure others might be as well.
Link : Windows Live Writer Blog : http://tinyurl.com/s77yo
I love the idea of blogging with a smart client. CommunityServer is great software, but I still have to go log in, and use an HTML rich text editor. This is easy to do, but I'm lazy.
I'm excited to see LiveWriter so easy to use.
One thing that I don't like is the resizing of images. I like that it creates thumbnails, but I don't like that the original image isn't preserved. I'm sure this is a setting somewhere.
Pause....
I went searching the Tools | Preferences, and didn't see anything about image resizing. I was looking for something like "Keep Original Size" but didn't find it.
I did however see a "check spelling" and a link to the plug in's on Windows Live and installed ...
Let's try them...
Here is an event
| What: | The Phoenix Web Design April Meetup Welcome. The concept behind our group is to share ideas, resources and to network with like-minded people. There is always something new to learn. Whether you are a HTML newbie or a C# wizard you are encouraged to attend. We will discuss old and new tools, sites, standards, etc. related to web design. Occasionally we will have speakers devoted to specific topics. We are located in the Airport Business Center. North East corner of University and Hwy 143 We are in the first, one story building on your left as you enter from 48th st. |
| When: | Thursday, April 12, 2007 7:00 PM |
| Where: | Postal code 85281, United States Tempe, Arizona 85281 United States |
| Download iCalendar file |
--------------
Here is some source code
<div class="DemoArea">
<input type="button" onclick="toggle();" id="showclose" value="Show Dialog" />
<br />
<br />
<br />
<br />
<br />
</div>
Both seem to format nicely.
So, all in all, I'm very happy I spent a few minutes getting started with Live Writer today. I recommend you give it a shot.
[UPDATE 1]
I don't like LWL Tags. I assume this is the "Categories" drop down. I also assume that these come from the web logging site ( http://weblogs.asp.net ) but if the list is too lung, it runs off the screen, instead of displaying multi columns.
[UPDATE 2]
I'm also really disliking the auto image, as you can (or can't in this case) see in the above thumbnail.
More Posts
Next page »