Friday, August 24, 2012

SENDING SMS VIA WAY2SMS IN ASP.NET C#

 



Here is the code for sending sms via way2sms in asp.net c#. It is one way api, that is we can only send sms, no receiving facility is provided. For using this code first you should create a account in way2sms with a valid Indian mobile phone number. Then you get username and password. Use the code as you like.
#####################################################################################
 public void send(string uid, string password, string message, string no)
{
HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create("http://ubaid.tk/sms/sms.aspx?uid=" + uid + "&pwd=" + password +
"&msg=" + message + "&phone=" + no + "&provider=way2sms");

HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
string responseString = respStreamReader.ReadToEnd();
respStreamReader.Close();
myResp.Close();
}


(2)- On The aspx page take two textboxes and a button and on the click event of the button call the function like--

protected void Button1_Click(object sender, EventArgs e)
{
send("yourmobileno","yourpassword", TextBox2.Text, TextBox1.Text);
}

//only change yourmobileno and
//yourpassword below
//TextBox2.Text for message and
//TextBox1.Text for reciever no


(3)- Dont forget to use namespaces
using System.Net;
using System.IO;

//************Hope it helps************//


###################################################################################


You might also like:

All Mobiles Secret Codes

Download youtube videos without any sofware

10 Worst Cyberattacks in 2012

Gadget Innovations of 2012

Monday, August 20, 2012

Programs

Data Structure Programs in java

Hi Here the Links to download various Data Structure Programs in java 

DoubleLinkedlist
Bubblesort java 
Binarysearch java
Linearsearch java 
Mergesort java 
Linkedlist java 
Stack java



Java Constructors Overloading

This Simple Java Program is for performing Constructor Overloading in Java. This is a part of Mumbai University MCA Colleges Java Practicals.

Constructor is required when we declare a class object. Java Class Constructors initializes the variables of the object. Constructor Overloading is done so that the objects of different forms can be initialized at the declaration time.

The Below program uses a class named Box which finds the volume of the Box object. This class has 2 constructors one for initializing a Cube Box and other for Initializing a Rectangular Box.
As those are constructors and return nothing, they dont have a return type.


class Box
{
int l,b,h;
Box(int x)             // Constructor for Cube
{
 l=x;
 b=x;
 h=x;
}
Box(int x,int y,int z)            //Constructor for Rectangle
{
 l=x;
 b=y;
 h=z;
}
void volume()
{
          System.out.println("Volume of the box is "+(l*b*h));
}
public static void main(String args[])
{
Box cube= new Box(10);          //Calling cube constructor
Box b=new Box(10,4,7);          //Calling box constructor
cube.volume();
b.volume();
}
}

Hope this Java Program is useful to you in some sense or other. Happy Programming and Studying.




In the Below program Abstract Class named Interest is used by 2 classes named SimpleInterest and CompoundInterest. These 2 classes uses the variables, Constructor and the display method of the abstract class. Both the classes use different definitions for the abstract method calc() to calculate the interest.

abstract class Interest
{
double p,amt,n;
Interest(double a,double y)
{
p=a;
n=y;
}
void display()
{
System.out.println("\nAMOUNT = "+p+"\nNOS OF YRS ="+n);
}
abstract void calc();
}

class SimpleInterest extends Interest
{
SimpleInterest(double a,double y)
{
super(a,y);
}
void calc()
{
amt= (p*n*0.0925);
System.out.println("SIMPLE INTEREST="+amt);
}
}

class CompoundInterest extends Interest
{
CompoundInterest(double a,double y)
{
super(a,y);
}
void calc()
{
amt= p*Math.pow((1+(8.5/100)),n);
System.out.println("COMPOUND INTEREST="+amt);
}
}

class Bank
{
public static void main(String str[])
{
Interest i;
SimpleInterest s1=new SimpleInterest(25000,5);
CompoundInterest c1=new CompoundInterest(25000,5);
i=s1;
i.display();
i.calc();
i=c1;
i.display();
i.calc();
}
}






The Below java program calculates the areas of Circle, Triangle and Rectangle with same name function but different signatures.


class Area
{
void area(int l,int b)
{
          System.out.println("AREA OF RECTANGLE ="+(l*b));
}
void area(double b,double h)
{
System.out.println("AREA OF TRIANGLE ="+(0.5*b*h));
}
void area(double r)
{
System.out.println("AREA OF CIRCLE ="+(3.14*r*r));
}
public static void main(String args[])
{
Area a=new Area();
a.area(10.5,20.4);
a.area(2,6);
a.area(15.3);
}
}



Interface just carry the signature of the function to be used. The class which implements a interface has to define the function which its gonna implement.

.

interface Exam
{
boolean pass(int marks);
}

interface Classify
{
String division(int avg);
}

class Result implements Exam,Classify
{
public boolean pass(int marks)
{
System.out.println("Marks obtained are "+ marks);
if(marks>=50)
return true;
else
return false;
}
public String division(int avg)
{
if(avg>=60)
return("First Division");
else if(avg>50)
return("Second Division");
else
return("Third Division");
}
public static void main(String ar[])
{
Result r =new Result();
boolean flg;
flg=r.pass(60);
if(flg==true)
System.out.println("Marks>=50");
else
System.out.println("Marks<50");
System.out.println(r.division(60)); 
}
}