Server error: ‘530 SMTP authentication is required.’

Sometimes we get error message – 530 SMTP authentication is required when attempting to send an e-mail through MS Outlook. In this article I will discuss how to resolve this error.

Here I used MS Outlook 2010

1. Go to File -> Account Settings

2. Click Email Tab and double click on you email addresss

3. In Change account settings pop up -> Click more settings

4. Check -> My out going server (SMTP) required authentications and click OK as follows

Screenshot 2015-11-02 21.40.12

Now you can send your email and “530 SMTP authentication is required” is solved.

How to remove special character from Unicode string

Here is the sample code to remove special character from Unicode string.
Sample Input: SG@%@sgs th? g#%@^@#$ chào^#^$#!abc35| _ sgs _35 hello world không gsg
Sample Output: SG%sgs th? g#%^#$ chào^#^$#!abc35 sgs 35 hello world không gsg

    class Program
    {
        static void Main(string[] args)
        {
            string inputString = "SG@%@sgs thể g#%@^@#$ chào^#^$#!abc35| _ sgs _35 hello world không gsg";

            string outputString = inputString.Replace("@", "").Replace("|", "").Replace("_", "");

            Console.WriteLine(inputString);
            Console.WriteLine(outputString);
            Console.ReadKey();
        }
    }

Factorial Calculator using C#

Factorial is a positive number is the product of all number less than or equal to the positive number.
For example:

0! = 1
1! = 1
2! = 2 * 1! = 2
3! = 3 * 2! = 6

n! = n * (n – 1)!

Here is the sample code to calculate Factorial using both loop and recursion using c#.


///

/// Author: Md. Mahedee Hasan
///

class Program
{
static void Main(string[] args)
{
int number = 0;
Console.WriteLine(“Enter an integer number to calculate factorial: “);
Int32.TryParse(Console.ReadLine(), out number);

Console.WriteLine(“Factorial of ” + number + ” is: ” + CalculateFactoial(number));
Console.WriteLine(“Factorial of ” + number + ” is: ” + Factorial(number));
Console.ReadLine();
}

//Calculate factorial using loop

private static int CalculateFactoial(int number)
{
int factorial = 1;
for (int counter = 1; counter <= number; counter++) { factorial = factorial * counter; } return factorial; } //Calculate factorial using recursion private static int Factorial(int number) { if (number == 0) return 1; else return number * Factorial(number – 1); } } [/csharp]

How to check Palindrome word using C#

Palindrome word can be read in both direction. Suppose “level” can be read in both direction, so it is palindrome word. To check palindrome word you can try like following code using C#.


    class Program
    {
        public static bool IsPalindrome(string word)
        {
            int minLength = 0;
            int maxLength = word.Length - 1;
            while (true)
            {
                if (minLength > maxLength)
                {
                    return true;
                }
                char a = word[minLength];
                char b = word[maxLength];
                if (char.ToLower(a) != char.ToLower(b))
                {
                    return false;
                }
                minLength++;
                maxLength--;
            }
        }

        static void Main()
        {
            string[] palindromeWord = {"aibohphobia","Dhaka","alula","cammac","Civic", "deified","deleveled",
                                 "detartrated","devoved","History","evitative","level","","mahedee"};

            foreach (string word in palindromeWord)
            {
                if (IsPalindrome(word))
                {
                    Console.WriteLine(word + " is a Palindrome");
                }
                else
                {
                    Console.WriteLine(word + " is not a Palindrome");
                }
            }
            Console.ReadKey();
        }
    }

How to find prime number between 1 to n


class Program
{
static void Main(string[] args)
{
//int n = 100000;
int n = 0;
Console.WriteLine(“Type an integer number to get prime number between 1 to n”);
Int32.TryParse(Console.ReadLine(), out n);
PrintPrimes(n);
}

public static void PrintPrimes(int n)
{
bool isPrime = false;
for (int i = 2; i < n; i++) { isPrime = true; for (int j = 2; j <= Math.Sqrt(i); j++) { if (i % j == 0) { isPrime = false; break; } } if (isPrime) Console.Write(i + ” “); } Console.ReadKey(); } } [/csharp] [wpdm_file id=51]

Draw star pyramid using C#

Sample input: 5
Sample output:

code-01

Code:


/*Author: Md. Mahedee Hasan*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StarPyramid
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(“Enter a number to draw pyramid: “);
int nRow = 0;
nRow = Convert.ToInt32(Console.ReadLine());

for (int row = 1; row <= nRow; row++) { for (int leftSpace = row; leftSpace <= nRow; leftSpace++) { Console.Write(” “); } for (int star = 1; star <= 2 * row – 1; star++) { Console.Write(“*” + ” “); //Print star and space } Console.WriteLine(); } Console.ReadKey(); } } } [/csharp] [wpdm_file id=50]

Folder permission from windows command line

To give all permission in temp folder for every one, run command prompt with admin privilege and then run the following command.

OS01

Here,
/t means “apply change recursively”
/e means “edit existing DACL”.

Alternative way
You can try with the following command
C:>icacls “C:\Windows\temp” /grant mahedee:(OI)(CI)F
Here,
F= Full Control
CI= Container Inherit
OI= Object Inherit