Monday, May 10, 2010

how to convert a dataset to excel?

public Stream ConvertDatsetToExcel(DataSet dataset)


{

Stream attachment = null;

string excelContent = "";



excelContent += "<>"; if (dataset.Tables[0].Rows.Count > 0) { excelContent += "<>"; for (int index = 0; index < dataset.Tables[0].Columns.Count; index++) { excelContent += "<>"; } excelContent += " <>"; for (int rowNo = 0; rowNo < dataset.Tables[0].Rows.Count; rowNo++) { excelContent += " <>"; for (int colNo = 0; colNo < dataset.Tables[0].Columns.Count; colNo++) { excelContent += "<>"; } excelContent += " <>"; } } else { excelContent += " <>"; for (int index = 0; index < dataset.Tables[0].Columns.Count; index++) { excelContent += "<>"; } excelContent += " <>"; } excelContent += "
";

excelContent += dataset.Tables[0].Columns[index].ColumnName;

excelContent += "
";

excelContent += dataset.Tables[0].Rows[rowNo][colNo].ToString();

excelContent += "
";

excelContent += dataset.Tables[0].Columns[index].ColumnName;

excelContent += "
";



attachment = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(excelContent));



return attachment;

}


for further information visit
http://www.scribd.com/groups/discussion/40777-how-to-convert-a-datset-to-excel-content-using-c-net

Tuesday, August 25, 2009

Data Hiding

If a subclass is having a data member with same name as superclass data member then inside subclass, subclass data member hides superclass data member.
class Sample{
 int a = 5;
}
class SubSample extends Sample{
 int a = 6;
 void display(){
  System.out.println("\n a="+a);
 }
}
class InheritanaceDemo14{
 public static void main(String[] args){
   SubSample s = new SubSample();
   s.display();
   System.out.println("\n s.a="+s.a);
 }
}
output:
a = 6
s.a = 6

A super class object can refer its subclass object

class Sample{
}
class SubSample extends Sample{
}
class InheritanaceDemo8{
 public static void main(String[] args){
  Sample s1 = new Sample();
  Sample s2 = new SubSample();
  System.out.println("s1 = " + s1);
  System.out.println("s2 = " + s2);
 }
}
output:
s1 = Sample@010b30a7
s2 = SubSample@1a758cb

Saturday, August 15, 2009

Using Smart Phones to Access Site Specific Services - a Mini Project

This is a mini project which has both code and documentation available.
This work investigates how smart phones can augment site specific services that are electronic services or application that resides in a specific location. Service provider runs MST server on Bluetooth enable PC’s or mobiles located in the store, restaurant, cinema and access them via their mobile service explores (MSE) enable smart phones. The service could push dynamic information updates to the phone via TEXT and MMS. This is to develop a push-based location aware advertising system using Bluetooth. This lets users receive advertisements on their smart phones based on their proximity to particular shops. At a minimum, we need is a single Bluetooth enabled PC to advertise a range of products.
Download Docmentation & code here

Thursday, July 24, 2008

PolybeianCipher

Java code for polybean cipher

download the code from  click here to download