Sunday, September 28, 2003

EventLog.SourceExists Problems

to solve the problems if you hadnt permission to write into the event viewer try ms kb article.

Saturday, September 27, 2003

"camelCase" and "PascalCase" Guidelines

The following table should provide you to use those rules:

Type Case Additional Information
----------------------------------------------------------------------------------------------------------------------------------------------
Class PascalCase Ex.: MyClass, Utility, DataHelper

Enum value PascalCase Ex.: Colors.Red, PossibleValues, ValueOff

Enum type PascalCase Ex.: Colors, PossibleValues

Event PascalCase Ex.: MouseClick, ButtonDown

Exception class PascalCase Ex.: MyCustomException, XxxException etc.

Interface PascalCase Ex.: use always "I" as prefix like: ICar, ISerializable etc.

Method PascalCase Ex.: GetItemData, SetItemInfo etc.

Namespace PascalCase Ex.: Company.NewApplication.DataTier

Property PascalCase Ex.: ItemValue, DataParameter etc.

Parameter camelCase Ex.: itemArray, valueData, purchasePrice etc.

===============================================================================
Private member camelCase Ex.: Microsoft makes no recommendation on this, however
variable its make sense to distinguish private member variables from
other identifiers.

very good site for patterns

http://www.dofactory.com/Patterns/Patterns.aspx#list

Thursday, September 25, 2003

SmtpMail.Send(), MailMessage, MailAttachment

use those Classes in the .Net Environment you should include

Namespaces:
using System.Web.Mail;
using System.Web.Util;

Assembly:

System.Web.dll




You can call the Send method in two ways.

1. By passing MailMessage as a parameter

public static void Send(MailMessage);

Here MailMessage is a class.

MailMessage mailMsg = new MailMessage();
mailMsg .From = "from@fromServer.com";
mailMsg .To = "to@toServer.com";
mailMsg .Cc = "cc@ccServer.com"";
mailMsg .Bcc = "bcc@bccServer.com";
mailMsg .Subject = "SubjectOfTheMailString";
mailMsg .Body = "BodyOfTheMailString";
SmtpMail.Send(mailMsg );

2. Direct method.
public static void Send(string from , string to, string subject, string messageText);

Prameters Description
from Email address of sender
to Email address of recipient
subject Email subject line.
messageText Body of Email message

Example:

SmtpMail.Send("mcb@mindcracker.com", "webmaster@mindcracker.com", "Subject", "Message body");




The MailMessage Class

The MailMessage class can be used to send mails with cc, bcc or attachments. The MailMessage constructor initializes a new instance of the MailMessage class. It doesn't take any parameters.

MailMessage mail = new MailMessage();
Members Description
Bcc Specifies a semicolon-separated list of email addresses that will receive a private copy of the email message.
Body Indicates the body content of the email message.
BodyEncoding Indicates the encoding type of the email message.
BodyFormat Indicates the type of the email message body (text or html).
Cc Specifies a semicolon-separated list of email addresses that will receive a copy of the email message.
From Indicates the email address of sender.
Priority Indicates the priority of the email message.
Subject Indicates the subject line of the email.
To Indicates the email address of the recipient
UrlContentBase Indicates the base of all relative URLs used within an HTML-encoded message.
Attachments List of "MailAttachments" to be transmitted with the message. This property is read-only.
Headers Indicates the dictionary of custom headers to be transmitted with the message. This property is read-only.


Each member of this class are pretty easy to understand. Say you want to send an attachment with the mail.
You use Attachment member to attach the mail. Say I want to attach mcb.jpg with the mail.

mail.Attachments.Add(new MailAttachment(@"C:\mcb.jpg"));

Each member of this class are pretty easy to understand. Say you want to send an attachment with the mail. You use Attachment member to attach the mail.

Other MailMessage members have been used in the above example.

Wednesday, September 24, 2003

some language dictonories . . . .

dic hebrew - english: http://milon.morfix.co.il/MorDictFirstPage.htm

dic deutsch - englisch: http://dict.leo.org/

int.Parse() vs. Convert.Int32()

the following i found on the internet:

Everytime I have to convert a string to an integer I use int.Parse() instead of Convert.Int32(). Until today, I basically recommended it because it looked more O-O to me (besides, I get the chance to pick my Java pals because int behaves more like a real class in C# ;-). But today Clemens Vasters, a fellow RD, gave me a really sound reason for doing so: int is a higher level abstraction than Int32 and, by default, higher level abstractions are friends of the (business) developer. Nice one, Clemens.


My friend luiz wrote :

I agree... At first look they look quite the same but using int.Parse() seems to be the better approach... If one of these days the pattern changes and the int becomes a Int64 for example you dont need to worry about it.

Cheers,

Luiz

You should pass XmlResolver to Transform() method

protected override void Render(HtmlTextWriter writer)
{
XPathDocument xDoc = new XPathDocument(Context.Server.MapPath(sourceFilePath) );

XslTransform xslt = new XslTransform();
xslt.Load( Context.Server.MapPath(transformFilePath) );
xslt.Transform(xDoc,null,writer);

}

now i got on "xslt.Transform(xDoc,null,writer);" those informations:

E:\Extend\Controls\Navigator.cs(67):
'System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.IXPathNavigable,
System.Xml.Xsl.XsltArgumentList, System.IO.TextWriter)' is obsolete: 'You
should pass XmlResolver to Transform() method'


It seems you are using version 1.1 or higher of .Net Framework.

This way of calling Transform method of XslTransform class
is indeed obselete in the new versions.

Visit the following url for the latest info in this regard

http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemxmlxslxsltransformclasstransformtopic17.asp?frame=true


and one more article:

http://www.xmlforasp.net/CodeSection.aspx?csID=103

Constants in .Net Environment during debugging. . . .

its not a failure, you'll get it as Value if you watch over a constant variable during debuging.

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge