Tuesday, May 29, 2012

Tips and Tricks in email templates

Tips and Tricks in email templates to the rescue

Periodically, you probably need to send some emails for some standard communications. You probably attach the draft documents to an e-mail message, and you've probably been creating these messages from scratch every month: typing the recipient names, composing the message, and adding the required data. It's easy to make mistakes this way by omitting a recipient, creating an inconsistent message, or forgetting to attach data. There is a better way of handling these repetitive communications using Microsoft Office Outlook. We can use email templates to send messages that include information that does not change often. Standard email recipients can be set. The message is then saved as a template, and then the template can be used every time it is needed. Just amend or add new information before sending it out as an email message.

CREATE AN EMAIL TEMPLATE 1. On the File menu, point to New, and then click Mail Message. You can also start a new e-mail message by clicking the New Mail Message button on the Standard toolbar. 2. When the new message opens, give it an appropriate subject and compose your content. Leave space for variable information that will be added when you send the message. You can set the standard email recipients into the email. 3. On the File menu, click Save As. 4. In the Save as type list, click Outlook Template, and then click Save. 5. If you are planning on sharing your email templates, then take note of the folder where your templates are stored.

USING THE EMAIL TEMPLATE 1. In the Inbox folder in Outlook, on the Tools menu, point to Forms, and then click Choose Form. For Outlook 2010, click on New Items, More Items, Choose Form… 2. In the Choose Form dialog box, click the Look in drop-down arrow, and then click User Templates in File System. 3. Select your template, and then click Open. 4. In the open message, go through the email and add or amend any changes required. Verify if any attachments are needed and attach the necessary.

Tuesday, April 10, 2012

Be careful with non-ascii characters in URLs

ne thing that is rather common, especially on websites whose content is not in English, is URLs that contain unencoded characters such as space, å, ä, or ö. While this works most of the time it can cause problems.

Looking at RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax, characters that are allowed to be used unencoded in URLs are either reserved or unreserved. The unreserved characters are a-z, A-Z, 0-9, -, ., _, and ~. The reserved characters are used as delimiters and are :, /, ?, #, [, ], @, !, $, &, ', (, ), *, +, ,, ;, and =.

In essence this means that the only characters you can reliably use for the actual name parts of a URL are a-z, A-Z, 0-9, -, ., _, and ~. Any other characters need to be Percent encoded.

So what does using an unencoded character like space or å in a URL mean in practice?

■It doesn’t work in all user agents. Recent browsers seem to handle it pretty well, but older browsers may not be able to follow links or load images. It also causes problems for some other software that expects URIs to be valid (Ruby’s URI.parse is one).
■It may make URLs ugly and hard to read since browsers may percent encode some of these characters before displaying them in the location bar. This varies from browser to browser. A URL like http://example.com/å ä ö/ may be displayed as http://example.com/å ä ö/, http://example.com/å%20ä%20ö/, http://example.com/%C3%A5%20%C3%A4%20%C3%B6/, or even http://example.com/√•%20√§%20√∂/.
To keep things simple and predictable, consider sticking to the unreserved characters in URLs unless you have a really strong internationalisation requirement for using other characters.

This post is a Quick Tip. Background info is available in Quick Tips for web developers and web designers.

reference from

Wednesday, March 21, 2012

About Certificates

Please open internet explorer,
Tools > Internet Options >Content >Certificates > click certificates
It is very good.

Monday, March 19, 2012

Programming Directory Services

Programming Directory Services
Once you've got a WindowsIdentity for a user, you can use the classes in the System.DirectoryServices namespace to quickly do a lookup on his user account in Active Directory and discover all sorts of information about him:

•What's his phone number or e-mail address?
•What office is he in?
•Who is his manager?
•Who are his direct reports?
•What's his employee ID number?
You might expect the code for doing this to be really complicated, but it's surprisingly easy:

public string LookupEmail(WindowsIdentity id) {
using (DirectoryEntry user = LookupUser(id)) {
return (string)user.Properties["mail"].Value;
DirectoryEntry LookupUser(WindowsIdentity id) {
string path = string.Format("LDAP://", id.User);
return new DirectoryEntry(path, null, null, SECURE_BINDING);
AuthenticationTypes SECURE_BINDING =
AuthenticationTypes.Secure | // use platform authentication
AuthenticationTypes.Signing | // use integrity protection
AuthenticationTypes.Sealing; // use encryption

The trick is to use a technique called SID binding, where you get the user's security identifier (SID) from the WindowsIdentity.User property, which was introduced in version 2.0 of the .NET Framework. Then you hand that value off to Active Directory and boom, you've got a DirectoryEntry object that represents the user's account. This example looks up the user's e-mail address, but it would be just as easy to get the other properties listed above.

As you learn more about programming directory services, you should also spend some time familiarizing yourself with the schema that Active Directory provides by default. There is a ton of great information here that you can harvest for use in your applications, and the system administrator will be very happy that you're relying on a single source of truth for user data instead of creating yet another identity silo to store these sorts of details! The schema is documented in MSDN.

What about independent software vendors building applications that will be deployed at many different companies? Not all of those companies have Active Directory, you may be thinking. Here's the thing: most companies actually do run Active Directory, and of those that don't, most larger companies store user accounts in a directory service accessible via LDAP. It's a very good idea to build solutions that leverage those identity stores instead of building your own identity silo. If you end up in a situation where there is simply no directory service at all, you should consider deploying ADAM to store user accounts, which allows you to use System.DirectoryServices with the same schema you'd expect in Active Directory. The binding technique you'll use will be different in this case, but the overall programming model is the same.

ADAM is an interesting topic in itself. This is a full-fledged LDAP directory service based on the Active Directory code base, but without all the Network Operating System (NOS) infrastructure that you probably don't care about if you simply need an LDAP enterprise or application directory. It has the same replication features as Active Directory and can run on any machine (not just a domain controller). I'm running it as I write this paper on my Windows XP laptop, which makes it easy for me to program with System.DirectoryServices without having a domain controller around! It's easy to install, as you can see from this paper.

For more information on programming System.DirectoryServices, see The .NET Developer's Guide to Directory Services Programming.

from http://msdn.microsoft.com/en-us/library/aa480245.aspx

Tuesday, February 14, 2012

VBA: Export excel range as image and save as file.

PROBLEM: How to save Excel range into image file. VBA macro in Excel 2007.

SOLUTION: Create an empty chart, paste range image into chart area, and Export as image file.

Modify code to suite to your needs.

from http://snipplr.com/view/54755/