Thursday, November 26, 2009

How to Download a File using C#.NET in Visual Studio

System.Net.WebClient wc = new System.Net.WebClient();
wc.DownloadFile("http://www.images.com/some.jpg",@"C:\some.jpg");

this is so simple. You can download any kind of file using this.

Thursday, November 19, 2009

How to send a SMS using C# (Compact Framework) in Windows Mobile

Sending SMS though our own application is very necessary when we talking business application. Windows Mobile SDK comes with PocketOutlook that we can use to send SMSs.

First you need to create a smart device application. and layout your form as below.

image

Then add the PoketOutlook assemply to your application as a reference.

image image

here is the code.

Method1

using Microsoft.WindowsMobile.PocketOutlook;
private void btnSend_Click(object sender, EventArgs e)
{
String number = txtNumber.Text;
String boby = txtBody.Text;
SmsMessage message = new SmsMessage(number,boby);
message.Send();
}

Method2 – Send SMS to Multiple recipients

private void btnSend_Click(object sender, EventArgs e)
{
SmsMessage message = new SmsMessage();

Recipient r1 = new Recipient("Name1", txtNumber.Text);
Recipient r2 = new Recipient("Name2", "0772789456");

message.To.Add(r1);
message.To.Add(r2);

message.Body = txtBody.Text;

message.Send();
}

Monday, November 16, 2009

Configure XAMPP with vista when IIS is running

Go to XAMPP installed folder and go to

Apache /Conf/ Extra folder  and open the httpd-ssl.conf file with note pad or some text editor.

# Note: Configurations that use IPv6 but not IPv4-mapped addresses need two
# Listen directives: "Listen [::]:443" and "Listen 0.0.0.0:443"
#
 
Listen 443

find the above code and change 443 to something like 4499.

DocumentRoot "c:/web/xampp/htdocs"ServerName localhost:443
ServerAdmin admin@localhost

and also find the above and change it to 4499
and save the file.Then open the file httpd.conf in apache/conf folder.

#Listen [::]:80
Listen 80

find above and change 80 to something like 8080

#
ServerName localhost:80

and find this and change it also to 8080

Thursday, November 12, 2009

Change the background color in Blackberry Fields

There are four basic background available in blackberry.

    • SolidBackground
    • SolidBackgroundwithTranparency
    • GradientBackground
    • BitmapBackground
// Solid Background
Background b=BackgroundFactory.createSolidBackground(Color.ANTIQUEWHITE);
setBackground(b);
 
// Solid Background with Transperancy                                       //Alpha
Background b=BackgroundFactory.createSolidTransparentBackground(Color.AZURE,180);
setBackground(b);
 
// Gradient Background
Background b = BackgroundFactory.createLinearGradientBackground(
Color.AZURE,Color.BISQUE,Color.AZURE, Color.BISQUE);
setBackground(b);
 
// Bitmap Background
Background b = BackgroundFactory.createBitmapBackground(yourImage, 0, 0,0);
setBackground(b);

GO language by Google

Google released new programming language called GO. This is a Open Source Programming

language. GO combines the performance and security benefits associated with using a compiled language like C++ with the speed of a dynamic language like Python.

This is how google describes GO,

Go attempts to combine the development speed of working in a dynamic language like Python with the performance and safety of a compiled language like C or C++. In our experiments with Go to date, typical builds feel instantaneous; even large binaries compile in just a few seconds. And the compiled code runs close to the speed of C. Go is designed to let you move fast.

References,Tutorials