This blog is a knowledge base...where I clip cool tricks and urls

How to send email using Gmail SMTP - .NET 2.0

Read this article from code project.
clipped from www.codeproject.com
//Builed The MSG
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
msg.To.Add("reciver@gmail.com");
msg.To.Add("another.reciver@yahoo.com");
msg.From = new MailAddress("dummy@gmail.com", "One Ghost",System.Text.Encoding.UTF8);
msg.Subject = "Test mail using .net2.0";
msg.SubjectEncoding = System.Text.Encoding.UTF8;
msg.Body = "This is my msg Body";
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = false;
msg.Priority = MailPriority.High;
//Add the Creddentials
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential("dummy@gmail.com", "SecretPass");
client.Port = 587;//or use 587
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
client.SendCompleted += new SendCompletedEventHandler(client_SendCompleted);
object userState=msg;
try
{
//you can also call client.Send(msg)
client.SendAsync(msg, userState);
}
catch (System.Net.Mail.SmtpException ex)
{
MessageBox.Show(ex.Message, "Send Mail Error");
}
 blog it

Peter blum :: ASP.NET controls

clipped from www.peterblum.com

ASP.NET comes with validators: controls which detect and report errors
in data entry controls. So why do you need a replacement to them? Since ASP.NET
1.0 shipped, thousands of programmers have confronted numerous
limitations
with the validators forcing them to write custom code,
hacks, or in some cases, drop a planned feature for their user interface.
Professional Validation And More introduces second generation validation that
is so feature rich, you rarely write any custom code, and it gives you
compelling ways to add polish to your user interface.
 blog it

FTP scripts and utils

 blog it

GAC and references

clipped from aspalliance.com
In Depth

First, I recommend you create a shared directory that's easy to remember where you will store all of the assemblies that you want to show up in the dialog. For this I chose C:\Program Files\Microsoft.NET\Third-Party Tools . Although we could argue about the semantics, I think this basically covers anything not included with the .NET Framework, and it is easy to remember and not user-specific.

Next, you'll want to open up that friendly program, RegEdit, and go to \\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders and add a new key, calling it whatever you want. It really doesn't matter what you call this except for when you look it up in the registry. For consistency's sake though, I named it 'Third-Party Tools'.  Then you simply need to change the (Default) string value to be the path to the directory you created for this purpose, which is, in my case, C:\Program Files\Microsoft.NET\Third-Party Tools.  See the screen shot below for the complete picture.

 blog it

FTP commandline with piped parameters

How to run a batch job that connects to ftp with a piped input

ftpfiles.bat

ftp -in serverName < ftpcommands.txt

===========

ftpcommands.txt

user UserName Password
binary
prompt
md test1
cd test1
md test2
quit

==================

run ftpfiles.bat



hec",)
 blog it

Using memory wisely in .NET

Using memory wisely in .NET
clipped from msdn.microsoft.com

The physical memory used by your application is an important performance metric. You should use the least possible memory and resources so there is as much as possible left over for other processes. This is not just about being a good citizen; your application will benefit from a lower memory footprint, and this benefit can be dramatic if your memory usage is big enough to consume available physical memory and push the machine into paging. But even if you are targeting high-end machines and paging is not your main threat, you should use memory wisely. The cost of memory management in the common language runtime (CLR) can be significant for applications that allocate memory carelessly.

 blog it

Nero and Command Line Options

That batch can be easily converted to pure AHK code.
Approach is to burn all files from one folder without using Nero's Frontend.

You've to change ...

a) the drivename
b) the drivespeed
c) the destination folder

Code has been taken from PC-Magazin 08/04 p. 141
clipped from www.autohotkey.com
Quote:
cls

@echo off

C:\Programme\Ahead\Nero\nerocmd.exe --write --drivename d --speed 16 --real --tao --disable_eject --underrun_prot --iso backup --create_iso_fs "F:\downloads\*.*" --recursive --close_session --verify --nero_log_timestamp --no_user_interaction

pause

exit



That batch can be easily converted to pure AHK code.


Approach is to burn all files from one folder without using Nero's Frontend.



You've to change ...


a) the drivename

b) the drivespeed


c) the destination folder


Code has been taken from PC-Magazin 08/04 p. 141
 blog it

Optimizing Memory usage in .NET

Read this article and make sure you follow the best practice steps..
clipped from msdn.microsoft.com
  1. Allocate memory for the type that represents the resource.
  2. Initialize the memory to set the initial state of the resource and to make the resource usable.
  3. Use the resource by accessing the instance members of the type (repeat as necessary).
  4. Tear down the state of the resource to clean up.
  5. Free the memory.
 blog it

Blog Archive