My Name Is Salman Masood , I am Computer Science &Amp; Maths Graduate from University of Karachi, Pakistan , Teaching Is My Passion and My Aim Is to Deliver All My Knowledge among Those Students Who Can'T Afford Tutors or Expensive Institute Fees. I Will Be Keep Sharing My All Knowledge and Information with You .... Remember Me in Your Prayers !
Monday, 4 June 2018
Assignment Operator in php
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>assignment operator</title>
</head>
<body>
<?php
$x=4;
echo "<h1> = operator </h1> ";
$y=$x;
echo "value of y = ".$y;
echo "<br/>value of x = ".$x;
echo "<h1> += operator </h1> ";
$y+=$x; // y=y+x
echo "value of y = ".$y;
echo "<br/>value of x = ".$x;
echo "<h1> -= operator </h1> ";
$y-=$x; // y=y-x
echo "value of y = ".$y;
echo "<br/>value of x = ".$x;
echo "<h1> *= operator </h1> ";
$y*=$x; // y=y*x
echo "value of y = ".$y;
echo "<br/>value of x = ".$x;
echo "<h1> /= operator </h1> ";
$y/=$x; // y=y/x
echo "value of y = ".$y;
echo "<br/>value of x = ".$x;
?>
</body>
</html>
Airthmetic Operator in PHP
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Airthmatic operator</title>
</head>
<body>
<?php
$a=10;
$b=5;
echo "<h1>Addtion </h1>";
echo "a + b = ".($a+$b);
echo "<h1>Subtraction </h1>";
echo "a - b = ".($a-$b);
echo "<h1>Multiplication </h1>";
echo "a * b = ".($a*$b);
echo "<h1>Division </h1>";
echo "a / b = ".($a/$b);
echo "<h1>Modulus </h1>";
echo "a % b = ".($a%$b);
echo "<h1>Exponent </h1>";
//echo "a ^ b = ".($a**$b);
echo "a ^ b = ".pow($a,$b);
?>
</body>
</html>
variable scope in php
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>variable scope..</title>
</head>
<body>
<h1>variable scope </h1>
<?php
echo "<h2>Local variable </h2>";
function myfun1()
{
$x=15; //local .......
echo "value of inside the function x = ".$x;
}
myfun1();
//echo "value of outside the function x = ".$x;
echo "<h2>Global variable </h2>";
$y=10;
$z=20;
function myfun2()
{
//echo "value of y inside the function = ".$y;
}
myfun2();
echo "value of y outside the function = ".$y;
echo "<h2>Global keyword </h2>";
function myfun3()
{
global $y,$z;
$y=$y+$z;
echo "value of y inside the function = ".$y;
}
myfun3();
echo "<h2>static variable </h2>";
function myfun4()
{
static $a=0;
$a++;
echo "value of a inside the function = ".$a."<br/>";
}
myfun4();
myfun4();
myfun4();
?>
</body>
</html>
Sunday, 3 June 2018
Custom Exception in C# Error Handling
----------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication37
{
class CustomEXception:Exception
{
public CustomEXception(string msg):base (msg)
{
}
}
}
-----------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication37
{
class Program
{
public static void checkage(int age)
{
if (age<18)
{
throw new CustomEXception("Age should be greater than 18...");
}
else
{
Console.WriteLine("Eligible to enrolled in exam....");
}
}
static void Main(string[] args)
{
int age ;
l1:
Console.WriteLine("Enter the age: ");
age = int.Parse(Console.ReadLine());
try
{
checkage(age);
}
catch( CustomEXception e)
{
Console.WriteLine("error is "+e);
// throw;
}
finally
{
Console.WriteLine("press any key to continue....");
Console.ReadLine();
Console.Clear();
}
goto l1;
}
}
}
Finally block in Exception handling in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication36
{
class Program
{
static void Main(string[] args)
{
int a, b;
float c;
l1:
Console.WriteLine("Enter the value of a :");
a = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the value of b :");
b = int.Parse(Console.ReadLine());
try
{
c =(float) (a *1.0 / b);
Console.WriteLine("value of c =" + c);
}
catch (Exception e)
{
Console.ForegroundColor = System.ConsoleColor.Red;
Console.WriteLine("Error is "+e);
}
finally
{
Console.ForegroundColor = System.ConsoleColor.White;
Console.WriteLine("press any key to continue.....");
Console.ReadKey();
Console.Clear();
}
goto l1;
}
}
}
Saturday, 2 June 2018
Workshop Management system part 1
USE [master]
GO
/****** Object: Database [workshops] Script Date: 6/2/2018 3:59:50 PM ******/
CREATE DATABASE [workshops]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'workshops', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\workshops.mdf' , SIZE = 3136KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'workshops_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\workshops_log.ldf' , SIZE = 784KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [workshops] SET COMPATIBILITY_LEVEL = 110
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [workshops].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [workshops] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [workshops] SET ANSI_NULLS OFF
GO
ALTER DATABASE [workshops] SET ANSI_PADDING OFF
GO
ALTER DATABASE [workshops] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [workshops] SET ARITHABORT OFF
GO
ALTER DATABASE [workshops] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [workshops] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [workshops] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [workshops] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [workshops] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [workshops] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [workshops] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [workshops] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [workshops] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [workshops] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [workshops] SET ENABLE_BROKER
GO
ALTER DATABASE [workshops] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [workshops] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [workshops] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [workshops] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [workshops] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [workshops] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [workshops] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [workshops] SET RECOVERY FULL
GO
ALTER DATABASE [workshops] SET MULTI_USER
GO
ALTER DATABASE [workshops] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [workshops] SET DB_CHAINING OFF
GO
ALTER DATABASE [workshops] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
GO
ALTER DATABASE [workshops] SET TARGET_RECOVERY_TIME = 0 SECONDS
GO
USE [workshops]
GO
/****** Object: StoredProcedure [dbo].[sp_insert_instructor] Script Date: 6/2/2018 3:59:50 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_insert_instructor]
(
@i_name nvarchar(20) ,
@i_designation nvarchar(20) ,
@i_image nvarchar(max)
)
as
begin
insert into tbl_instructor
values(@i_name ,
@i_designation ,
@i_image
)
end
GO
/****** Object: Table [dbo].[Employee] Script Date: 6/2/2018 3:59:50 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Employee](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](20) NULL,
[Salary] [float] NULL,
[Department] [varchar](20) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[tbl_batch] Script Date: 6/2/2018 3:59:50 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_batch](
[b_id] [int] IDENTITY(1,1) NOT NULL,
[b_name] [nvarchar](20) NOT NULL,
PRIMARY KEY CLUSTERED
(
[b_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
UNIQUE NONCLUSTERED
(
[b_name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_feedbackform] Script Date: 6/2/2018 3:59:50 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_feedbackform](
[f_id] [int] IDENTITY(1,1) NOT NULL,
[f_comment] [nvarchar](max) NOT NULL,
[f_marks] [int] NULL,
[f_wr_id_fk] [int] NULL,
[wr_id_fk_s] [int] NULL,
PRIMARY KEY CLUSTERED
(
[f_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_instructor] Script Date: 6/2/2018 3:59:50 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_instructor](
[i_id] [int] IDENTITY(1,1) NOT NULL,
[i_name] [nvarchar](20) NOT NULL,
[i_designation] [nvarchar](20) NOT NULL,
[i_image] [nvarchar](max) NOT NULL,
PRIMARY KEY CLUSTERED
(
[i_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_student] Script Date: 6/2/2018 3:59:50 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_student](
[s_id] [int] IDENTITY(1,1) NOT NULL,
[s_name] [nvarchar](20) NOT NULL,
[s_enrollment] [nvarchar](20) NOT NULL,
[s_image] [nvarchar](max) NOT NULL,
[s_batchcode] [int] NULL,
PRIMARY KEY CLUSTERED
(
[s_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
UNIQUE NONCLUSTERED
(
[s_enrollment] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_workshopname] Script Date: 6/2/2018 3:59:50 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_workshopname](
[w_id] [int] IDENTITY(1,1) NOT NULL,
[w_name] [nvarchar](20) NOT NULL,
PRIMARY KEY CLUSTERED
(
[w_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
UNIQUE NONCLUSTERED
(
[w_name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_workshoprecord] Script Date: 6/2/2018 3:59:50 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_workshoprecord](
[wr_id] [int] IDENTITY(1,1) NOT NULL,
[wr_date] [date] NULL,
[wr_id_fk_w] [int] NULL,
[wr_id_fk_i] [int] NULL,
PRIMARY KEY CLUSTERED
(
[wr_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_workshoprecordforstudent] Script Date: 6/2/2018 3:59:50 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_workshoprecordforstudent](
[wr_id] [int] IDENTITY(1,1) NOT NULL,
[wr_date] [date] NULL,
[wr_id_fk_w] [int] NULL,
[wr_id_fk_s] [int] NULL,
PRIMARY KEY CLUSTERED
(
[wr_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tbl_feedbackform] ADD DEFAULT ((0)) FOR [f_marks]
GO
ALTER TABLE [dbo].[tbl_feedbackform] WITH CHECK ADD FOREIGN KEY([f_wr_id_fk])
REFERENCES [dbo].[tbl_workshoprecord] ([wr_id])
GO
ALTER TABLE [dbo].[tbl_feedbackform] WITH CHECK ADD FOREIGN KEY([wr_id_fk_s])
REFERENCES [dbo].[tbl_student] ([s_id])
GO
ALTER TABLE [dbo].[tbl_student] WITH CHECK ADD FOREIGN KEY([s_batchcode])
REFERENCES [dbo].[tbl_batch] ([b_id])
GO
ALTER TABLE [dbo].[tbl_workshoprecord] WITH CHECK ADD FOREIGN KEY([wr_id_fk_w])
REFERENCES [dbo].[tbl_workshopname] ([w_id])
GO
ALTER TABLE [dbo].[tbl_workshoprecord] WITH CHECK ADD FOREIGN KEY([wr_id_fk_i])
REFERENCES [dbo].[tbl_instructor] ([i_id])
GO
ALTER TABLE [dbo].[tbl_workshoprecordforstudent] WITH CHECK ADD FOREIGN KEY([wr_id_fk_w])
REFERENCES [dbo].[tbl_workshoprecord] ([wr_id])
GO
ALTER TABLE [dbo].[tbl_workshoprecordforstudent] WITH CHECK ADD FOREIGN KEY([wr_id_fk_s])
REFERENCES [dbo].[tbl_student] ([s_id])
GO
USE [master]
GO
ALTER DATABASE [workshops] SET READ_WRITE
GO
Friday, 1 June 2018
3-Variable in php with previous commands practice
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>lesson 3</title>
</head>
<body>
<?php
$x=5;
$y=10;
print "<h1> Before swapping </h1>";
echo "value of x = ".$x;
echo "<br/>value of y = ".$y;
print "<h1> After swapping </h1>";
$x= $x+$y; // 5+10 =15
$y=$x-$y; //15-10 =5
$x=$x-$y; //15-5=10
echo "value of x = ".$x;
echo "<br/>value of y = ".$y;
?>
</body>
</html>
Subscribe to:
Posts (Atom)
Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC
Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...
-
Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...
-
Load event: pictureBox3.Image = Image .FromFile( @"C:\Users\salman\Documents\Visual Studio 2013\Projects\WindowsFormsApplication3\W...