Topic: C programming

Basic Computer Programming Languages Principles 0

Basic Computer Programming Languages Principles

Today, We want to share with you Basic Computer Programming Languages Principles.
In this post we will show you Programming principles, hear for The Principles Of Good Programming we will give you demo and example for implement.
In this post, we will learn about Basic Programming Principles Every Programmer Must Follow with an example.

Overview

Programming principles have helped me over the years in becoming a better programmer and developer, and I also believe, this article will help every developer become more efficient and able to produce code which is easier to maintain. By following these coding and programming principles, you can save development and maintenance time, and conquer lots of other congestion which may arise in later development phases.

What are Programming principles?

Programming is the complete process, which involves various stages such as coding, testing, debugging and maintaining a system.Programming principles assist you to write good quality of code and maintain a good coding practice.

Why should a developer follow it?

Actually, writing programs is mostly a matter of personal taste but there are certain rules or guidelines that should be followed within your style of code in order to make programs easy to maintain and understand by both, you and others(your team), and also principles guide the creation of Optimized, scalable, easy to maintain, and robust code.

What are the benefits if developer follows Programming principles?

Readability

All developers which are in a team of project able to understand the code.

Extensibility

In the Software world, changes are needed on time to time, If we have followed rule properly then it will become very easy to implement new changes in software.

Maintainability

It becomes easy to maintain by the development team and the production support team too because the application is loosely coupled.

Modularity

Make a whole program into small reusable pieces: functions, modules, libraries,union, structures.

Conclusion

  • You should write a program that is self-explanatory.
  • Use Comment wherever required, It makes documentation easy.
  • You should write a code which should be easy to maintain among your team.
jQuery 15 Powerful Tips and Tricks for Developers and Web Designer

Apart from this properly written program would also be easy to debug.
These principles will help you and others in the team to write or deliver good, clean, and high-quality code.

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Computer Programming Principles.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Simple C Programming Structure Examples 0

Simple C Programming Structure Examples

Simple C Programming Structure Examples

In this Post We Will Explain About is Simple C Programming Structure Examples With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Passing Structure to function in C – Simple C programs Example

In this post we will show you Best way to implement Structure in C programming, hear for Explain the Basic Structure of a C Program with an Example with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Structures – C Programming

A structure is a collection of one or more variables(multiple datatypes), possibly of more or different types, one type of the grouped together under a group name single name for some convenient handling.

#include
#include

struct product
{
	int pno;
	char productName;//It's Pointer Within Structure
	unsigned int rate :10; //It's Bitfield
	struct item  //Structure Within Structure
	{
		int icode;
		char iname[20]; //Array Within Structure
		int qty;
	}itm[3]; //Array of Structure
	int tot;
}*i // Pointer to Structure 

1. Declaring a Structure

struct Students 
{ 
    char name; 
    float age; 
    int info; 
}; 

struct Students b1, b2, b3 ; 

//used

struct Students 
{ 
    char name[10]; 
    float age; 
    int info; 
};
 
struct Students b1 = { "Laravel", 130.00, 550 } ; 
struct Students b2 = { "PHP", 150.80, 800 } ;

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is Structures – C Programming And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

gotoxy function in c++ header file 0

gotoxy function in c++ header file

Today, We want to share with you gotoxy function in c++ header file.
In this post we will show you Gotoxy in Dev c++, hear for gotoxy function in code blocks we will give you demo and example for implement.
In this post, we will learn about gotoxy function in c with an example.

What is gotoxy() function used in c?

Details of the Functions Such as a…

  • Header File : conio.h
  • Function : gotoxy
  • Return Type : Void

Purpose of the Gotoxy in Dev c++

1. text window for Text write in Positions, Moves Cursor of the Positions(x,y),Maximum x Co-ordinate in Text Mode = 80 and Maximum y Co-ordinate 25

Generally, using gotoxy simple function is quiet way more difficult in devc++ so there is defult no such include header file present in best way to dev c++ to use Gotoxy in Dev methods in C++ what I have to simple everythings do is that we have to make the function for relavants positioning cursor in dev c++

#include<stdio.h>
#include<conio.h>
#include<windows.h>
void gotoxy(short a, short b);    //simple here we init declare the gotoxy function
main()
{
 gotoxy(40,25);                      //now where we want to simple call c++ gotoxy function 
 printf("My First Example Gotoxy in Dev c++");
 return 0;
}
void gotoxy(short a, short b)           //Introduction of gotoxy function//                                               
{
 COORD pos ={a,b};
 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}

Note that Programming C++ gotoxy is simple function name here i.e. I am able to modify that it might be any source code except keywords

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about use gotoxy function in c++ Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

How to Open URL in New Tab using c# 0

How to Open URL in New Tab using c#

Today, We want to share with you How to Open URL in New Tab using c#.
In this post we will show you c# open url in new window code behind, hear for how to open page in new tab using response.redirect in asp.net c# we will give you demo and example for implement.In this post, we will learn about Opening a URL in a new tab in C# Asp.NET with an example.

My Paka Knowledgeable Ideas, Tips and Tricks, Useful Content, Jobs, Technology, Earn Money, gmail creation, skype, yahoo and more useful things.

In asp.net,c#, Open new window when target=”_blank”

<Link to="/about" target="_blank">About Pakainfo.com</Link>

asp.net,c# Overview with Features

There are the Following the List of Features For asp.net,c# Pure JavaScript Latest Frameworks.

  • Component oriented
  • Fast speed
  • Interoperability
  • Modern programming language
  • Object oriented
  • Rich Library
  • Scalable and Updateable
  • Simple
  • Structured programming language
  • Type safe

asp.net,c# redirect to a new tab

Response.Write(String.Format("window.open('{0}','_blank')", ResolveUrl(https://pakainfo.com/)));

ClientScript.RegisterStartupScript(this.Page.GetType(), "",
  "window.open('https://pakainfo.com/','Graph','height=400,width=500');", true);

How to code to open new tab in asp.net,c#

//Opening a URL in a new tab

Protected Sub btnReport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReport.Click
      Dim popupScript As String = "<script language="javascript">" + "window.open('https://pakainfo.com/', 'newWindow', 'left=5, top=2,location=no, width=560, height=450, menubar=no, resizable=yes,statusbar=yes,scrollbars=yes');" + "</script>"
      Page.RegisterStartupScript("Google", popupScript)
  End Sub

asp.net,c# Redirects

<asp:Button ID="btnTransfer" OnClick="btnliveTransfer_Click" runat="server" Text="Submit"/>

//on click events
protected void btnliveTransfer_Click(object sender, EventArgs e)
{
    Response.Redirect("~/pakainfo.aspx");
}


asp.net,c# Redirecting To External Domains

public ActionResult PakaLiveAction()
{
    // ...
    return Json(new {url = "https://pakainfo.com/"});
}

$.post("@Url.Action("PakaLiveAction")", function(data) {
    window.location = data.url;
});

jQuery 15 Powerful Tips and Tricks for Developers and Web Designer

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about c# response.redirect new window.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

C# Named Arguments Tutorial with Examples 0

C# Named Arguments Tutorial with Examples

Today, We want to share with you C# Named Arguments Tutorial with Examples.
In this post we will show you Named and Optional Arguments in C#, hear for Named And Optional Parameter In C# we will give you demo and example for implement.
In this post, we will learn about C# Named Parameters with an example.

Introduction: Named Arguments In C#

In this post, we will learn about Named Arguments In C# with an example.

C# Named and Optional Arguments Tutorial with Examples

Now in this post, I will explain about Named Arguments In C# with appropriate example. Normally, In Methods call, arguments are supplied as per the order of parameters defined in the method definition. So, when making a method call, it is important for you to remember the order of parameters before passing the value to the method call. If the number of parameters is large, then it is difficult to remember the order.

To handle this problem, Named arguments are used. When calling a method, arguments are passed with the parameter name followed by a colon and a value. In Named Arguments, we do not need to pass the parameters in order as defined on method definition, so we can pass the arguments in any order on method calling.

Now create Console Application in Visual Studio and write below lines of code in it.

using System;
using System.Collections;

namespace ConsoleDemo
{   
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("pakainfo.com");

            Program.EmployeeDetails(Employee_No: 4, EmployeeName: "Jd patel", Department: "HR", id: 2);

            // Arguments are passed in different order,which is diffrent from method declaration.
            Program.EmployeeDetails(EmployeeName: "Jaydeep", Employee_No: 44, id: 1, Department: "Finance");
            Console.ReadLine();  
        }
        public static void EmployeeDetails(int Employee_No, string EmployeeName, int id, string Department)
        {
            Console.WriteLine(string.Format("Employee_No : {0}, Name: {1}, id: {2}, Department: {3}", Employee_No, EmployeeName, id, Department));
        }
    }   
}

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about how to pass optional parameter in c#.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

C# nested while loops and multiple conditions 0

C# nested while loops and multiple conditions

Today, We want to share with you C# nested while loops and multiple conditions.
In this post we will show you Nested loops in C# programming, hear for c# while true Check we will give you demo and example for implement.
In this post, we will learn about c# while loop multiple conditions with an example.

Nested while Loop in C#

Syntax for Nested while Loop in C#:

while (condition)
{
    while (condition)
    {
        your statements;
    }
    your statements;
}

Nested loops in C# programming

while ((!mystring.Contains("pakainfo")) || (NewData != OldData) || (totalcount < 100))
{
    //while at least more to one those right conditions is true, then  this while loop will work
}

Is logically equivalent to your

while ((v3.IsAlive) || ((v2.IsAlive) || v1.IsAlive))
//do stuff

jQuery 15 Powerful Tips and Tricks for Developers and Web Designer

die when v3 ends or when both v2 and v1 end

while (v3.IsAlive || v2.IsAlive || v1.IsAlive)
//do stuff

Example 1: C# program of Nested while Loop

using System;
namespace loop
{
    class Wprogram
    {
        static void Main(string[] args)
        {
            int startpoint = 5;
            while (startpoint >= 1)
            {
                int j = 5;
                while (j >= startpoint)
                {
                    Console.Write(j);
                    j--;
                }
                startpoint--;
                Console.WriteLine();
            }
            Console.Read();
        }
    }
}

OutPut : C# program of Nested while Loop

5
54
543
5432
54321

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about C Sharp Looping with do and while Statements.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

C# Hash table and Dictionary Tutorial with Examples 0

C# Hash table and Dictionary Tutorial with Examples

Today, We want to share with you C# Hash table and Dictionary Tutorial with Examples.
In this post we will show you Why is Dictionary preferred over Hashtable?, hear for hashtable vs dictionary c# performance we will give you demo and example for implement.
In this post, we will learn about difference between hashtable and dictionary and arraylist in c# with an example.

Why is Dictionary preferred over Hashtable?

In this post, we will learn about Why is Dictionary preferred over Hashtable? with an example.

Now create Console Application in Visual Studio and write below lines of code in it.

Now in this post, I will explain Why is Dictionary preferred over Hashtable? with appropriate example. Dictionary is generic whereas Hashtable is not Generic. We can add any type of object to HashTable, but while retrieving we need to cast it to the required type. So, it is not type-safe. But to the dictionary, while declaring we can specify the type of key and value, so there will be no need to cast while retrieving.

C# Hashtable Example

using System;
using System.Collections;
namespace Pakainfo
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable _SiteList = new Hashtable();
            _SiteList.Add(1, "Pakainfo.com");
            _SiteList.Add(2, "Infinityknow.com");
            _SiteList.Add(3, "pakainfo.blogspot.com.com");
            foreach (DictionaryEntry de in _SiteList)
            {
                int Key = (int)de.Key; //Casting
                string value = de.Value.ToString(); //Casting
                Console.WriteLine(Key + " " + value);
            }          

            Console.ReadKey(); // To hold the console screen.
        }
    }
}

C# Dictionary Example

using System;
using System.Collections;
using System.Collections.Generic;
namespace Pakainfo
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<int, string> _SiteList = new Dictionary<int, string>();
            _SiteList.Add(1, "pakainfo.com");
            _SiteList.Add(2, "infinityknow.comm");
            _SiteList.Add(3, "pakainfo.blogspot.com");
            foreach (KeyValuePair<int, String> kv in _SiteList)
            {
                Console.WriteLine(kv.Key + " " + kv.Value);
            }
            Console.ReadKey(); // To hold the console screen.
        }
    }
}

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about c# hashtable vs dictionary vs hashset.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Access Control Allow Origin http set Headers 0

Access Control Allow Origin http set Headers

Access Control Allow Origin http set Headers

Simple Include headers Uing CORS solution (Cross-origin resource sharing)

Welcome to the In Pakainfo.com website! You will Step By Step learn web programming, easy and very fun. This website allmost provides you with a complete web programming tutorial presented in an easy-to-follow manner. Each web programming tutorial has all the practical examples with web programming script and screenshots available.For Access Control Allow Origin http set Headers

Access-Control-Allow-Origin – Name of the each domain allowed access control all for cross domain requests. * (* means all domain allowed)indicates all domains are allowed.
Access-Control-Allow-Methods – List of (GET, PUT, POST, DELETE, OPTIONS)HTTP methods can be used here domains during request.
Access-Control-Allow-Headers – List of (GET, PUT, POST, DELETE, OPTIONS)HTTP headers can be used here domains during request.

In PHP : “no ‘access-control-allow-origin’ header is present on the requested resource web api”

The Soltution of the no ‘access-control-allow-origin’ header is present on the requested resource web api in PHP.

// here include this three statement
header('Access-Control-Allow-Origin: *');  //all the methods access code
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS'); // all the resource and request get
header('Access-Control-Allow-Headers: Content-Type, Content-Range, Content-Disposition, Content-Description');

simple Below the sample code which handles Cross Domain AJAX POST requests: post.php

CORS works fine in all the latest browsers, but IE8 and IE9 don’t support this.

In order to use XDomainRequest in IE, request must be:
a). Only GET or POST
When Posting, the data will always be sent with a Content-Type of text/plain
b). Only HTTP or HTTPS
Protocol must be the same scheme as the calling page
c). Always asynchronous

Step 1). Add the script in

<script type='text/javascript' src="http://cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.1/jquery.xdomainrequest.min.js"></script>

Step 2). You need to set contentType value text/plain in $.ajax request.

 var contentType ="application/x-www-form-urlencoded; charset=utf-8";
 
if(window.XDomainRequest) //for IE8,IE9
    contentType = "text/plain";
 
$.ajax({
     url:"https://pakainfo.com/php/post.php",
     data:"name=king&age=28",
     type:"POST",
     dataType:"json",   
     contentType:contentType,    
     success:function(result)
     {
        alert("here Display all the Data from Server"+JSON.stringify(result));
     },
     error:function(jqXHR,textStatus,errorThrown)
     {
        alert("Error display :You can not any data send Cross Domain AJAX simple requests: "+errorThrown);
     }
    });
	

Below is the sample code, works in all the browsers.

<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script src="jquery.min.js"></script>
<script type='text/javascript' src="http://cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.1/jquery.xdomainrequest.min.js"></script>

</head>
<body>
 
<input id="get_methoddata" type="button"  value="Data Send X  -> Method GET"/>
<input id="post_methoddata" type="button" value="Data Send X -> Method POST" />
 
<script>
$(document).ready(function()
{
    var data_contentType ="application/x-www-form-urlencoded; charset=utf-8";
 
    if(window.XDomainRequest)
        data_contentType = "text/plain";
 
    $("#post_methoddata").click(function()
    {
        $.ajax({
         url:"https://pakainfo.com/php/post.php",
         data:"name=johan&age=28",
         type:"POST",
         dataType:"json",   
         contentType:data_contentType,    
         success:function(result)
         {
            alert("here Display all the Data from Server"+JSON.stringify(result));
         },
         error:function(jqXHR,textStatus,errorThrown)
         {
            alert("Error display :You can not any data send Cross Domain AJAX simple requests: "+errorThrown);
         }
        });
 
    });
 
    $("#get_methoddata").click(function()
    {
        $.ajax(
        {
         url:"https://pakainfo.com/php/get.php?name=johan&age=48",
         dataType:"json",
         contentType:contentType,
         success:function(result)
         {
            alert("all the Data from here display Server"+JSON.stringify(result));
         },
         error:function(jqXHR,textStatus,errorThrown)
         {
             alert("Error display :You can not any data send Cross Domain AJAX simple requests: "+errorThrown);
         }
        });
 
    });
 
});
</script>
</body>
</html>

post.php source code:

<?php
// here include this two statement
header('Access-Control-Allow-Origin: *'); 
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
 
 //check condition headers set or not
if(isset($HTTP_RAW_POST_DATA)) {
  parse_str($HTTP_RAW_POST_DATA,$arr); 
  $arr['data_extra']='task 1.your request POST Request from Pakainfo.com';
  echo json_encode($arr);
}
else
{
    $_POST['data_extra']='task 2.your request POST Request from Pakainfo.com';
    echo json_encode($_POST);
}
?>

Example

header set access-control-allow-origin multiple domains | cross domain ajax request,cross domain ajax request jquery | no access control allow origin header is present jquery ajax origin

Star Pyramid and patterns in C programming 0

Star Pyramid and patterns in C programming

Star Pyramid and patterns in C programming

In this Post We Will Explain About is Star Pyramid and patterns in C programming With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to c pattern programs with solutions Example

In this post we will show you Best way to implement C Programming Code To Create Pyramid and Pattern, hear for c program to print patterns of numbers and stars in a pyramid shape with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

pattern programs in c

Star Pyramid and patterns in C,There are a series of * or any some other character used to make some more pattern or any idea mathes geometrical shape Like as – square patterns, triangle patterns(Pyramid), rhombus patterns, heart patterns etc.

Required knowledge

  • Basic C programming
  • Operators
  • If else
  • For loop
  • Nested loop

printf("\n");
for(int i=1;i<=1;i<=n;i++)
{
	printf("%d : ",i);
	for(int sp=i;sp<=n-1;sp++)
		printf("");
	for(int j=1;j<=i;j++)
		printf("* ");
	for(int sp=i;sp<n+2;sp++)
		printf("  ");
	for(int sp=i;sp<=n-1;sp++)
		printf(" ");
	for(int j=1;j<=i;j++)
		printf("* ");
	for(int sp=i;sp<=n+2;sp++)
		printf("  ");
	for(int sp=i;sp<=n-1;sp++)
		printf(" ");
	for(int j=1;j<=i;j++)
		printf("* ");
		
		printf("\n");
}

List of star pattern programming exercises

Square Star Pattern

*****
*****
*****
*****
*****

Hollow Square Star Pattern

*****
*   *
*   *
*   *
*****

Hollow Square Star Pattern with Diagonal

*****
** **
* * *
** **
*****

Rhombus Star Pattern

*****
*****
*****
*****
*****

Hollow Rhombus Star Pattern

*****
*   *
*   *
*   *
*****

Mirrored Rhombus Star Pattern

*****
*****
*****
*****
*****

Hollow Mirrored Rhombus Star Pattern

*****
*   *
*   *
*   *
*****

Right Triangle Star Pattern

*
**
***
****
*****

Hollow Right Triangle Star Pattern

*
**
* *
*  *
*****

Mirrored Right Triangle Star Pattern

*
**
***
****
*****

Hollow Mirrored Right Triangle Star Pattern

*
**
* *
*  *
*****

Inverted Right Triangle Star Pattern

*****
****
***
**
*

Hollow Inverted Right Triangle Star Pattern

*****
*  *
* *
**
*

Heart Star Pattern

  *****     *****
 *******   *******
********* *********
*******************
 *****************
  ***************
   *************
    ***********
     *********
      *******
       *****
        ***
         *

Diamond Star Pattern

    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *

Hollow Diamond Star Pattern

**********
****  ****
***    ***
**      **
*        *
*        *
**      **
***    ***
****  ****
**********

Inverted Pyramid Star Pattern

*********
 *******
  *****
   ***
    *

X Star Pattern

*       *
 *     *
  *   *
   * *
    *
   * *
  *   *
 *     *
*       *

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is c program to print patterns of numbers and stars in a pyramid shape And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.