16 December 2013

Find last digit of a Number


Base/Power
1
2
3
4
1
1
1
1
1
2
2
4
8
6
3
3
9
7
1
4
4
6
4
6
5
5
5
5
5
6
6
6
6
6
7
7
9
3
1
8
8
4
2
6
9
9
1
9
1

                                                       Base/Power Table

This is the Base/Power table to find last digit of a number. A power of 4 will be iterative after it all pattern will repeat, so we are taking only 4 power value.
There are few steps to find:
Let any number is ab
Step 1: Find remainder of b by 4
Ex: c=b%4
Step 2: Find the last digit of base number.
i.e: a=243 then last digit of number will be d=3
Step 3: Now find value in Base/Power table of d/c. This value will be your final answer.

Practice

Find the last digit of (135843)24586.

Solution

According to Assumption a=135843 and b=24586
Step 1: c=24586%4, c=2
Step 2: d=3
Step 3: in Base/Power table d/c or 3/2 will be 9.
So, finally the last digit of (135843)24586 will be 9.
Read More...

Find last digit of a Number

Base/Power
1
2
3
4
1
1
1
1
1
2
2
4
8
6
3
3
9
7
1
4
4
6
4
6
5
5
5
5
5
6
6
6
6
6
7
7
9
3
1
8
8
4
2
6
9
9
1
9
1

                                                       Base/Power Table

This is the Base/Power table to find last digit of a number. A power of 4 will be iterative after it all pattern will repeat, so we are taking only 4 power value.
There are few steps to find:
Let any number is ab
Step 1: Find remainder of b by 4
Ex: c=b%4
Step 2: Find the last digit of base number.
i.e: a=243 then last digit of number will be d=3
Step 3: Now find value in Base/Power table of d/c. This value will be your final answer.

Practice

Find the last digit of (135843)24586.

Solution

According to Assumption a=135843 and b=24586
Step 1: c=24586%4, c=2
Step 2: d=3
Step 3: in Base/Power table d/c or 3/2 will be 9.
So, finally the last digit of (135843)24586 will be 9.


Read More...

15 December 2013

Skip windows 8 logon screen


If you have got bore to login your screen and you don't want to login every times then there are few steps to hide logon screen in windows 8.

Step 1:  Hit Windows key + R then, type netplwiz and Click OK
Step 2: Uncheck the box as shown in belowed picture:


Step 3: You will we ask for password when you will click ok. Type your selected Account password. After boot it will not take password.

@Enjoy Technology
Read More...

Session Handling in PHP

Introduction

Session is the way to handle client connection at the server side. For establish communication with server, client need to register their self by session. Once the session has created, server will be able to listen the client request. In PHP we can create session eaisly by using single function.

Session creation

Syntax:
<?php
session_start();
$_SESSION[id]=value;
?>
we can use this session variable in another page by using this global session variable. For access session variable, we can use general method for using a variable.
<?php
$val=$_SESSION[id];
?>
Example:
<?php
session_start();
$_SESSION['userID']=”123456″;
?>

Destroy a session

Destroy a session is needed, because when client request is completed client can manually destroy the session or server can destroy the session after specified time.
Syntax:
<?php
require(“config.php”); // require which page session you have to destroy
session_destroy();
exit();
?>
For better understanding you can download a login interface with session control:Session.rar (5 KB)
Read More...

13 December 2013

Chat Program in asp.net using Microsoft.AspNet.SignalR

 Introduction:

A few days ago Microsoft has added new feature of SignalIR. It working is as like Jabber application for real time application. i.e Live chat, Online gaming, Online Shopping, news weather etc. It is most prominent feature to build such type of application. It provides simple ASP.Net Api remote procedure call using JavaScript in client browser using server side .Net Program.

Implementation

To implement this feature you should have .Net 4.5 Framework and visual studio Express 2012. This program is written for group chat and private chat simultaneously. you need to install SignalIR package from NuGet or it from Developer package manager console tools. 

Console intallation: 

Tools->Library Package Manager->Package Manager Console
then type
PM> Install-Package Microsoft.AspNet.SignalR.Owin
PM> Install-Package Microsoft.AspNet.SignalR

Source Code Link:    14-12-2013( 713 KB)


Read More...

Login Interface in Asp.net

Source Code Link:   CompleteLogin (10 KB)

Intorduction

Login Interface is most useful for knowing that who is accessing your website and protecting to unauthorized comments and access. In asp.net to implement login interface is quit easy. Platform needed: Visual Studio 12

Description

There are some steps to implements:
Step 1:
First of create an login form as given by drag and drop property of visual Studio 12
<form method=”get” action=”validate.aspx” >
<input id=”Text1″ type=”text” name=”username” style=”border-color:#0094ff;border-width:1px;border-radius:2px;margin-left:30px;color:#0094ff;opacity:0.7;” class=”auto-style2″ placeholder=”Email/Mobile” title=”Enter Email Address / Mobile Number” onfocus=”javascript:if(this.value==’Email/Mobile’){
this.value=”}” onblur=”javascript:if(this.value==”){
this.value=’Email/Mobile’}” />
<br /><br />
<input id=”Password1″ type=”password” name=”password” placeholder=”Password” style=”border-radius:2px;border-color:#0094ff;border-width:1px;margin-left:30px;color:#0094ff;” title=”Enter Password” class=”auto-style1″ onfocus=”javascript:if(this.value==’password’){
this.value=”}” onblur=”javascript:if(this.value==”){
this.value=’password’}” />
<br />
<a href=”forgot.aspx” style=”text-decoration:none;color:#0094ff;margin-left:30px;” title=”Click if you Forgot Password”>Forgot Password</a>
&nbsp;<input id=”Submit1″ type=”submit” value=”Signin” style=”margin-left:220px;color:#fff;background-color:#0094ff;height:30px;width:80px;” title=”Signin Now” />
</form>
Step 2: 
Create a Login validator file validate.aspx and edit validate.aspx.cs file as given below.  You need to create session for staying  user on the webpage. Cookies will hold you login details.
String username, password;
username = Request.QueryString["username"].ToString();
password = Request.QueryString["password"].ToString();
if (login(username, password))
{
Session["username"] = username;
Session["name"] = name;
HttpCookie registration = new HttpCookie(“username”);
HttpCookie registration1 = new HttpCookie(“password”);
registration.Expires.AddMonths(2);
registration1.Expires.AddMonths(2);
Response.Redirect(“search.aspx”);
}
else
{
Response.Redirect(“login.aspx”);
}
step 3:
 To verify email address create verify.aspx.cs as:
if (Session["email"] == null)
{
Response.Redirect(“verify1.aspx”);
}
else { 
email=Session["email"].ToString();
if (TextBox2.Text.Length >= 5)
{
if (TextBox2.Text.Equals(TextBox3.Text))
{
set_password(email, TextBox3.Text, TextBox1.Text);
}
else
{
Label1.Text = “Password not Matched..”;
TextBox2.Text = “”;
TextBox3.Text = “”;
}}
else
{
Label1.Text = “Password must be greater than 4 character..”;
}}}
step 4:
To verify Mobile Number create verify1.aspx.cs file
String email = “”;
if (Session["email"] != null)
{
Response.Redirect(“verify.aspx”);
}
else
{
email = TextBox4.Text;
if (TextBox2.Text.Length >= 5)
{
if (TextBox2.Text.Equals(TextBox3.Text))
{
set_password(email, TextBox3.Text, TextBox1.Text);
}
else
{
Label1.Text = “Password not Matched..”;
TextBox2.Text = “”;
TextBox3.Text = “”;
}
}
else
{
Label1.Text = “Password must be greater than 4 character..”;
}}}
Step 5:
If user forgot password then create password reset link by creating forgot.aspx.cs file. First of all check whether user exist or not. If user is not registered then need to register. Md5 encryption is needed for securing the http data, while you are creating the password reset link.
String source = @”Data Source=PROT\SQLEXPRESS;Initial Catalog=cms;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False”;
protected void Page_Load(object sender, EventArgs e)
{
}
Boolean validate_email(String email)
{
if (email.Contains(‘@’) && email.Contains(‘.’))
{
return true;
}
else
return false;
}
Boolean mailSender(String code, String taget_email)
{
try
{
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add(taget_email);
message.From = new System.Net.Mail.MailAddress(“inform@only4student.in”);
message.Subject = “Password Recovery mail for ISS”;
message.Body = “As you requested for recovery of password .<br/> Password recovery code : <b> ” + code + “</b> <br/> Go on following link to reset your Password : <br/>Thnak you”;
System.Net.Mail.SmtpClient smtp =new System.Net.Mail.SmtpClient();
smtp.Port = 25;
smtp.Host = “mail.only4student.in”;
smtp.EnableSsl = false;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential(“email@mail.in”, “*****”);
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(message);
return true;
}
catch (Exception ex)
{
Label2.Text = “We are not able to Change your password due to Network Problem.”+ex.Message;
//Error.Visible = true;
//Error.Text = “Recovery code IS : ” + code + “\n Plz. Copy it for further use and click on Hyperlink “;
//HyperLink1.Visible = true;
return false;
}
}
Boolean email_check(String email) {
String code = Membership.GeneratePassword(10, 5);
string select = “SELECT * FROM freeuser where email=’” + email + “‘”;
String query = “UPDATE freeuser SET recovercode=’” + code + “‘ where email=’” + email + “‘”;
SqlConnection conn = new SqlConnection(source);
conn.Open();
SqlCommand cmd = new SqlCommand(select, conn);
object o = cmd.ExecuteScalar();
if (o == null)
{
Label2.Text = “Your Email is not Registered….<a href=’Default.aspx’>Register Today</a>”;
return false;
}
else
{
//conn.Open();
SqlCommand cmd1 = new SqlCommand(query, conn);
int rowsReturned = cmd1.ExecuteNonQuery();
conn.Close();
Session["email"] = email;
if (mailSender(code, email))
return true;
else
return false;
}}
protected void Button1_Click(object sender, EventArgs e)
{
String email=”";
email = TextBox1.Text;
if (!email.Equals(“”))
{
if (validate_email(email))
{
if (email_check(email))
{
Label2.Text = “Your Password verification code is sent to your email address….<a href=’verify.aspx’>Verify Now</a>’”;
}
else
{
}
}
else {
Label2.Text = “Not a Valid Email Address…”;
}
}
else {
Label2.Text = “Please Specify you email Address..”;
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect(“login.aspx”);
}
}

Time Required:

It will take 30-40 minutes to implement.
Read More...

17 November 2013

Steps For Development of PHP Websites:
1. install Xampp,Wamp,or Apache server(Any one) Download:XamppWamp
2.install any php editor. Download Netbeans,Bluefish
3.Save files in c://xampp/htdocs/yourfile.php
4.Run on localhost as http://localhost/filename.php
|
|
|
Now Enjoy Php Coding
Read More...