Archive

Archive for January, 2010

SEO Moz Tools

January 28th, 2010 1 comment

Technology is becoming really affordable and accessible for small business owners especially when it comes to SEO, there are now few sites that are offering free Tools to help you capitalize on your SEO efforts. One of the most noted one and used by majority of SEO consultants is SEOMOZ.

SEOMOZ.org is a site dedicated to catering valuable tools to small businesses , they provide a lot free one’s too, as a skeptic you can begin with simple tool like the “Linkscape” it is a professional quality inlink tool that uses patent-pending SEOmoz metrics. Inlinks, anchor text distribution and more.  Once you have familiarized yourself with these technologies then you can move on to the advance ones, such as the Pro tools.

Below are the tools you can take advantage for free:

Term Target

Helps determine how targeted a particular page is for a specified keyword by analyzing a variety of factors.

Trifecta

Measures metrics to estimate the relative popularity and importance of Page, Blog or Domain. Trifecta replaces SEOmoz’s Page Strength tool.

SEO Toolbox

A collection of FREE Tools that will give you quick answers and aid in daily SEO activities.

Popular Searches

This tool aggregates and archives popular searches from various sources.

So if you’re serious about taking your SEO effort to the next level, try out these tools from seomoz.org it will help you a great deal and best of all you don’t have to pay for it!

And if you’re a little adventurous and wanted to take a stab at their API’s you are in for great treat, seomoz are adding more and more functionality to help you manage your SEO client or if you are you’re own SEO manager for your company. As long as you know web programming using PHP, Pyhton or Ruby you’re set.

Partial Types ASP.NET

January 25th, 2010 1 comment

There was a time in my web development career when I had to stop doing what I’m doing because I got stucked with a question in my mind, like anyone of us we get this nagging feeling when we have question unless it gets taken care of it will become an imaginary wall in front of us. Simple things like Partial Types.

Partial Types , what is this ? oh you’ve probably seen them a lot of times , it looks something like this :

Namespace MyFamousSoftware{
Partial Class _default { .. methods inside }

yes that partial class, from the word ‘partial’ means that your class is not quite done yet, the author sets up an extension for this class later on, so if you have a partial class you can split your class typically in multiple files, a common scenario is for a partial class to be auto-generated from some other source such as XSD’s and for that class to be augmented with additional hand-authored (you) method you do something like this:

// auto -generated
partial class Ticketing { …..}

// you
partial class Ticketing {…..}

Take note though that each time you have to declare ‘Partial’ or else you will have a nasty error for instance
you can’t do this

partial class Ticketing {….}

and do another

class ticketing {….} get it?

the participants of this class CANNOT have conflicting members ie., constructors with the same argument cannot be repeated, and Partial Classes are resolved entirely by the compiler, this means that participants (each partial class) must be available at compile time and must reside in the same assembly.

Another thing you can do also is to specify a base class on one or more partial classes just as long as there’s no disagreement in base class name.

Partial Methods (Implemented since 3.0)

A partial type may also contain Partial Methods. Partial methods lets auto-generated partial types provide customizable hooks for manual authoring (if you are the author of the object and someone’s using your object)
here is an example:

//auto-generated
partial class PrintTicketForm {

partial void TicketAmount(decimal amount);
}

// you can customized further
partial class PrintTicketForm {

partial void TicketAmount (decimal amount)
{
   if(amount < 1)
   throw new ArgumentException('Not yet Paid');
 
  }
}

Keep in mind that Partial methods consist of two pairs: a definition and an implementation the difference is that a definition is normally auto-generated while the implementation is hand-authored (you) , in the absense of definition the partial method is compiled away, this will allow auto-generated code to be liberal in providing hooks without having to worry about code bloat, one last thing partial method must be void and must be implicitly private.

Well, now that wasn’t too hard was it? important thing to remember is that you now know the inner workings of partial types, so in your next project you can be more creative in implementing them.

Categories: ASP.NET Tags: , ,

Creating User Controls ASP.NET

January 25th, 2010 No comments

One of ASP.NET’s strongest point as a framework are its handy controls that are available to web developers, these are smart little modules that you can easily drag and drop on to your page or inside another control. Although ASP.NET especially the 3.5 provide more controls than one could use for a project, you still find a need to make your own custom one, and in this article I’ll show you how easy it is to create a user controls.

An obvious part you can easily spot is it’s file extension, ie., user controls has .ascx extension and not aspx this is to prevent user control’s file to not be executed as a standalone Web Forms page.

It’s very easy to create one, first you need to ‘add new item’ on your solution(usually when you right click on your solution name it will give you this option), then once a window pop-up you would need to select ‘Web User Control’ icon to create a new user control you can always rename your file later on.

For instance you decided to create control that displays google maps after coding your google api’s in this control you can include this to any page using the Register Directive like this:

<%@ Register TagPrefix=”GoogleMapControl” TagName=”Message” Src=”LoadGooglemap.ascx” %>

TagPrefix serves as your unique namespace for your user control, this avoids clashing with your other controls inside the page. The Src attribute is the virtual path to the user control – like in our example “LoadGoogleMap.ascx” or “/MyApp/Include/LoadGoogleMap.ascx”. After registering the user control, you may place the user control tag in the Web Forms page just as you would an ordinary server control (including of course the runat=”server” attribute), like this :

This is how it will look like on your page:

<%@ Page Language=”C#” %>
<%@ Register TagPrefix=”GoogleMapControl” TagName=”Message” Src=”LoadGooglemap.ascx” %>

A Simple User Control

Your LoadGoogleMap.ascx looks something like this :

This is a simple message user control!

———————————————–

Another Simple way to include your user controls is to drag and drop them
on your page from your solution window (don’t forget to turn on your ‘design’
view on your solution page’)

Exposing User Control Properties for use in other web forms

Take note that everytime a Web Form page is treated as a control, its public fields and methods (Web Form) becomes public properties (that is, tag attributes) and methods of the control as well. In the next example I will show how an extension of the previous user control adds two public String fields.
Notice also that these fields can be set either declaratively or programmatically in the containing page.

This is how your aspx would look like:

<%@ Register TagPrefix=”GoogleMapControl” TagName=”Message” Src=”LoadGoogleMap.ascx” %>

A Simple User Control w/ Properties

And this is how your control would look like:
<script runat=server language=C# >
public String Color = "red";
public String Text = "This is a google map title text!";
</script >

And if you want to have a full control on your coding you might want to consider
as it can also be done Programmatically create your user controls just as an ordinary
server control.

here it is.

Control Con1 = LoadControl(“LoadGoogleMap.ascx”)
CType(Con1, (GoogleMap)).Category = “business”
Page.Controls.Add(con1)

And you can access it like this

<%@ Control ClassName=”GoogleMap” %>

notice that you just have to pass the object GoogleMap since you used the object Page.Controls.Add

Hope this helped you understand how the ASP.NET user control works.