Advertisements

Outlook: Internet Security Warning


Problem :

When I start Outlook, I get an “Internet Security Warning” dialog box with the message;

The server you are connected to is using a security certificate that cannot be verified.
The target principal name is incorrect.

I clicked on “View Certificate” and installed the certificate, but I still get this dialog each time I start Outlook.

Clicking “Yes” each time allows me to use Outlook as normal but how can get rid of this dialog?

Usually you get this error when you are using a shared hosting account with your own domain and connect via SSL. Another common cause is that your ISP has changed the name of their mail server and is redirecting you from the old server name to the new one and the name of the old server isn’t on their new SSL certificate.

Internet Security Warning - The server you are connected to is using a security certificate that cannot be verified. The target principal name is incorrect - View Certificate - Do you want to continue using this server? - Yes - No
Looking at the certificate usually provides the answer.

Name on the certificate should match the name of the mail server

The solution is quite simple; click on the “View Certificate…” button and look at the “Issued to” name. This is usually the name that you’ll need to specify for your incoming and/or outgoing server in your account configuration.

In some cases, this still won’t work when the certificate holds multiple names. You can then select the “Details” tab and see if the certificate holds a field called “Subject Alternative Name”. If so, then you’ll find other names that you could try behind the “DNS Name=” value.

If none of those names work either, contact your ISP and ask for the correct name of the mail server that you should use. Another (less secure) alternative would be to disable the use of SSL for your mail account.

No need to install the certificate

As long as the name on the certificate doesn’t match the name specified in your account settings, you’ll get this warning message. Installing the certificate will not help in any way and isn’t needed either.

The only case in which installing the certificate is needed, is when the names do match and the certificate isn’t issued (trusted) by a Certificate Authority. These are so called “Self-Signed Certificates”. In that case, only install the certificate if you trust the domain that is specified on the certificate and if the administrator responsible for that domain has instructed you to do so.

Background information

Many shared hosting solutions or ISPs are now offering secure access to your mailbox via Secure Sockets Layer (SSL). In order to make an SSL connection, a security certificate is required on the mail server. The name on this certificate should match the name that you use to connect to this server. For instance; mail.yourdomain.com

With shared hosting solutions, your mailbox is hosted on a mail server which also hosts mailboxes for other people’s/company’s domains. This means that the mail server often can be reached not only via mail.yourdomain.com but also via mail.theirdomain.com.

As SSL certificates usually aren’t free and updating and maintaining them for each shared account in a cost effective way is near impossible, the mail server is usually only reachable via SSL via the name of mail.yourhostingcompany.com. If you use any other name, you’ll get this security warning message.

The issue is similar for other ISPs, especially when they merge or change their infrastructure. This sometimes goes together with a name change of the mail server. They then usually redirect the old name of the mail server to the new name so you still can access your mail, but the SSL certificate of the new server no longer contains the old name. The result is that you get this warning dialog and you’ll have to update your account settings for the new server name.

Advertisements

USAePay Token error: 23 Specified source key not found


Hello friends

If you are facing above error message while testing USAepay payment integration than following is the reason and solution

That error means you are not sending it to the correct URL. If utilizing a sandbox source key make sure you are sending it to a sandbox URL and if using a production source key you have to send it to a production URL.

Hope it helps !

 

Categories: ASP.NET

C Programming Introduction


Importance of Subject 

 

  • ‘C is the base language of any​ other programming language.​
  •  To be a Good Programmer one ​must know fundamentals of C​ programming language.

History of ‘C’

 

  • ​Root of the morden language is ​ALGOL 1960. It’s first ​computer language to use block ​ structure.​ It gave concept of structured​ programming.​
  • In 1967, Martin Richards developed ​a language, BCPL (Basic Combined Programming Language)
  • In 1970,by Ken Thompson created a language called as ‘B’.​ It used to create early version of Unix.
  • In 1972,by Dennis Ritchie introduced new language called as ‘C’ .​

 

Features Of ‘C’

 

  • It is a robust language.​
  • Programs written in ‘C’ are efficient and fast.​(Because of variety of data types and powerful ​operators)​
  • Highly Portable. (related to OS)​
  • Well suited for structured programming.​
  • Ability to extend itself. ​

Program & Programming Language

Program:- A Set of instructions which ​carried out by processor for some ​Specific input, generates specific output. ​​

Programming language:- A specific ​manner of writing a program with some ​Predefined rules, symbols & their use as ​a part of language.​  i.e. Pascal, C, C++, VC++, JAVA, VB.

 

Basic structure of ‘C’

 

[1] Documentation Section 

  • It has set of comment lines(name of program, author details).​

What is Comment line??​

  • To guide a programmer. To write a note for ​function,operation,logic in between a program.​
  • Non-executable statement.​
  • Can’t be nested.

 e.g.    /* Hello /* abc */ Hi */      ​

[2] Link Section

  • It provides instructions to the compiler to link ​function from the system library.
  • # include  Directive
    • To access the functions which are stored in the​ library, it is necessary to tell the compiler , ​about the file to be accessed.​
    • Syntax:-​ #include<stdio.h> // stdio.h is header file

[3] Definition Section

  • It defines all symbolic constants.​
  •  #define instuction defines value to a symbolic constant.​
  •  #define:-​
    • It is a preprocessor compiler directive, not a statement.​
    • Therefore it should not end with a semicolon.​
    • Generally written in uppercase.​

[4] GLOBAL DECLARATION SECTION​

  • Some variables that are used in more than on function, such variables (global variables) declared in the global declaration section.​
  • It also declares all the user-defined function.

[5] Main() function section

  • Every ‘C’ program must have one main() function section.​
  • It contains two parts​
    • Declaration part:​ It declares all variables used in the executable part.​
    • Executable part:​ It has atleast  one statement.​

 

Link Section

Definition Section

Global Declaration Section

main() function section

{

Declaration part

Executable part

 }

 Subprogram section

Function1

Function2 …         

User defined function

 

HOW TO RUN A PROGRAM?

  • There are two ways to run programs written in a high-level language. ​
  • ​The most common is to compile the program​
  • The other method is to pass the program through an interpreter.

Compiler

Why compiler is require ?​

As machine (a processor) can operate​ On binary code instruction only…..​

If we use higher level language then …For execution of the program we must ​Convert it to lower level / machine level​ Code means, ​

A program that translates source code into object code.

The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instructions.​

Advantage of compiler​:

  • Programs produced by compilers run much faster than the same programs executed by an interpreter.

Interpreter:​

which analyzes and executes each line of source code without looking at the entire program. ​

Advantage of interpreter:​

  • It can execute a program immediately. ​
  • Compilers require some time before an executable program emerges. ​

C  Compiler  ​

  • Checks for syntax errors if any​ – on success  coverts ‘C source code​ into object code form –​ which is nearer to machine

Types of languages

 

(1) Lower level languages:-​

Languages which are very near to ​machine…. I.e. machine language, ​

Assembly language.​

(2) Higher level languages:-​

Languages which are very near to ​programmer rather than to machine….​

I.e. C++,Visual C++,Visual basic,Java.

C

Data Types in C

 

Each variable in C has an associated data type. Each data type requires different amounts of memory and has some specific operations which can be performed over it. Let us briefly describe them one by one:

Following are the examples of some very common data types used in C:

char: The most basic data type in C. It stores a single character and requires a single byte of memory in almost all compilers.
int: As the name suggests, an int variable is used to store an integer.
float: It is used to store decimal numbers (numbers with floating point value) with single precision.
double: It is used to store decimal numbers (numbers with floating point value) with double precision.

Different data types also have different ranges upto which they can store numbers.

These ranges may vary from compiler to compiler. Below is list of ranges along with the memory requirement and format specifiers on 32 bit gcc compiler.

 

datatype

We can use the sizeof() operator to check the size of a variable. See the following C program for the usage of the various data types:

#include <stdio.h>
int main()
{
    int a = 1;
    char b ='G';
    double c = 3.14;
    printf("Hello World!\n");
    //printing the variables defined above along with their sizes
    printf("Hello! I am a character. My value is %c and "
           "my size is %lu byte.\n", b,sizeof(char));
    //can use sizeof(b) above as well
    printf("Hello! I am an integer. My value is %d and "
           "my size is %lu  bytes.\n", a,sizeof(int));
    //can use sizeof(a) above as well
    printf("Hello! I am a double floating point variable."
           " My value is %lf and my size is %lu bytes.\n",c,sizeof(double));
    //can use sizeof(c) above as well
    printf("Bye! See you soon. :)\n");
    return 0;
}

Output

Hello World!
Hello! I am a character. My value is G and my size is 1 byte.
Hello! I am an integer. My value is 1 and my size is 4 bytes.
Hello! I am a double floating point variable. My value is 3.140000 and my size i
s 8 bytes.
Bye! See you soon. 🙂

 

Variable

 

  • C variable is a named location in a memory where a program can manipulate the data. This location is used to hold the value of the variable.
  • The value of the C variable may get change in the program.
  • C variable might be belonging to any of the data type like int, float, char etc.

 

Rules for Variable name

  • Variable name must begin with letter or underscore.
  • Variables are case sensitive
  • They can be constructed with digits, letters.
  • No special symbols are allowed other than underscore.
  • sum, height, _value are some examples for variable name

DECLARING & INITIALIZING C VARIABLE:

  • Variables should be declared in the C program before to use.
  • Memory space is not allocated for a variable while declaration. It happens only on variable definition.
  • Variable initialization means assigning a value to the variable.
 Type 
Syntax
Variable declaration
data_type variable_name;
Example: int x, y, z; char flat, ch;
Variable initialization
data_type variable_name = value;
Example: int x = 50, y = 30; char flag = ‘x’, ch=’l’;

THERE ARE THREE TYPES OF VARIABLES IN C PROGRAM THEY ARE,

  1. Local variable
  2. Global variable
  3. Environment variable

DIFFERENCE BETWEEN VARIABLE DECLARATION & DEFINITION IN C:

Variable declaration
Variable definition
Declaration tells the compiler about data type and size of the variable.
Definition allocates memory for the variable.
Variable can be declared many times in a program.
It can happen only one time for a variable in a program.
The assignment of properties and identification to a variable.
Assignments of storage space to a variable.

Input and Output

 

Input

  • scanf(“%d”,&a);
  • Gets an integer value from the user and stored it under the name a (variable)

Output

  • printf(“%d”,a);
  • Prints the value present in variable a on the screen

 

C Programming Operators

 

An operator is a symbol which operates on a value or a variable. For example: + is an operator to perform addition.

C programming has wide range of operators to perform various operations. For better understanding of operators, these operators can be classified as:

  • Arithmetic Operators
  • Increment and Decrement Operators
  • Assignment Operators
  • Relational Operators
  • Logical Operators
  • Conditional Operators
  • Bitwise Operators
  • Special Operators

 

C Arithmetic Operators

 

An arithmetic operator performs mathematical operations such as addition, subtraction and multiplication on numerical values (constants and variables).

Operator Meaning of Operator
+ addition or unary plus
subtraction or unary minus
* multiplication
/ division
% remainder after division( modulo division)

 

Example #1: Arithmetic Operators

// C Program to demonstrate the working of arithmetic operators
#include <stdio.h>
int main()
{
    int a = 9,b = 4, c;
    
    c = a+b;
    printf("a+b = %d \n",c);

    c = a-b;
    printf("a-b = %d \n",c);
    
    c = a*b;
    printf("a*b = %d \n",c);
    
    c=a/b;
    printf("a/b = %d \n",c);
    
    c=a%b;
    printf("Remainder when a divided by b = %d \n",c);
    
    return 0;
}

Read more…

Can not find ConfigurationManager class in class library C#


To use ConfigurationManager class in Classlibrary use following

ConfigurationManager class lies in System.Configuration namespace and assembly System.Configuration.

To use this please add reference of System.Configuration. Go to Framework tab in Add references and select System.Configuration

Adx7N

Hope it helps!

 

UpdatePanel and triggers from a repeater control


If you want to backstop on some controls click you must need to specify triggers in UpdatePanel

For example:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
   <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
     <ItemTemplate>
       <%# Eval("Name") >%>
       <asp:Button ID="Button1" runat="server" Text="Button" />
      </ItemTemplate>
    </asp:Repeater>
 </ContentTemplate>
<Triggers>
   <asp:PostBackTrigger ControlID="Buton1" />
</Triggers>
</asp:UpdatePanel>

You will face following error message with above code

A control with ID ‘Button1’ could not be found for the trigger in UpdatePanel ‘UpdatePanel1’.

Here is simple solution for above problem

 <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
  <ItemTemplate>
 <!--when cick the button1, it will fire the btnDummy-->
   <asp:Button ID="Button1" Text="Click"
   OnClientClick="$get('btnDummy').click();return false;"
   runat="server" />
  </ItemTemplate>
 </asp:Repeater>

 <!--Make a hidden button to treat as the postback trigger-->
 <asp:Button ID="btnDummy" runat="server" Style="display: none" Text="HiddenButton" />

Get Row Number in MySQL


SQL Server

To return a row number with record we have ROW_NUMBER() in SQL which  returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition.

Syntax:

ROW_NUMBER ( )
OVER ( [ PARTITION BY value_expression , … [ n ] ] order_by_clause )

MY SQL

Here I am explaining how to return row number in my sql

For Example we have following table

CREATE TABLE tblSales(
  id     INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  fruit  VARCHAR(32),
  amount DECIMAL
);

INSERT INTO tblSales
VALUES 
(NULL, 'apple', 12.75), 
(NULL, 'orange', 1.89), 
(NULL, 'pear', 19.23),
(NULL, 'banana', 4.25), 
(NULL, 'cherry', 123.75), 
(NULL, 'plum', 23.15);
SELECT fruit, amount FROM tblSales ORDER BY amount DESC;

If we run this query it will result like
+--------+--------+
| fruit  | amount |
+--------+--------+
| cherry |    124 |
| plum   |     23 |
| pear   |     19 |
| apple  |     13 |
| banana |      4 |
| orange |      2 |
+--------+--------+


Now here is the query with ranking

SET @rank=0;
SELECT @rank:=@rank+1 AS rank, fruit, amount FROM tblSales
 ORDER BY amount DESC;

+------+--------+--------+
| rank | fruit  | amount |
+------+--------+--------+
|    1 | cherry |    124 |
|    2 | plum   |     23 |
|    3 | pear   |     19 |
|    4 | apple  |     13 |
|    5 | banana |      4 |
|    6 | orange |      2 |
+------+--------+--------+
Hope it helps!

Create duplicate row in AngularJS


Hello Friends here I am explaining an example of how to add duplicate row in AngularJS

Please check below link for complete example

https://jsfiddle.net/rahulgbhatia/06nda8jo/

Hope it helps !