using System;
class ClassA
{
public static void Main()
{
Console.WriteLine("Class A");
}
}
class ClassB
{
public static void Main()
{
Console.WriteLine("Class B");
}
}
save this file as abc.cs
and compile with csc abc.cs/main:classA if you choose classA as entry point
and compile with csc abc.cs/main:classB if you choose classB as entry point
Be Different with excellent knowledge A Devloper Blog....
Monday, July 18, 2011
Saturday, July 16, 2011
Add Window Media player to your asp.net web page(2nd way)
Just this code and change file name ..this code will work
<object id="VIDEO" width="320" height="240"
style="position:absolute; left:0;top:0;"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
type="application/x-oleobject">
<param name="URL" value="[Songs.PK] Aakrosh - 01 - Isak Se Meetha.mp3"/>
<param name="SendPlayStateChangeEvents" value="False"/>
<param name="AutoStart" value="True"/>
<param name="uiMode" value="none"/>
<param name="PlayCount" value="9999"/>
<param name="Volume" value="9999"/>
</object>
<object id="VIDEO" width="320" height="240"
style="position:absolute; left:0;top:0;"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
type="application/x-oleobject">
<param name="URL" value="[Songs.PK] Aakrosh - 01 - Isak Se Meetha.mp3"/>
<param name="SendPlayStateChangeEvents" value="False"/>
<param name="AutoStart" value="True"/>
<param name="uiMode" value="none"/>
<param name="PlayCount" value="9999"/>
<param name="Volume" value="9999"/>
</object>
Add Window Media player to your asp.net web page
Go To source File and do paste this code.......
<div>
<embed type="application/x-mplayer2" width="300" height="300" src="song.mp3" showstatusbar="1">
<param name="AutoStart" value="1" />
</embed>
</div>
<div>
<embed type="application/x-mplayer2" width="300" height="300" src="song.mp3" showstatusbar="1">
<param name="AutoStart" value="1" />
</embed>
</div>
convert binary code into image
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace binary_data_converted_into_image
{
public class DecodeBase64Binary
{
public static void Main(string[] args)
{
//
// Read the contents of Encoded Bitmap from the text file.
//
TextReader reader = new StreamReader(@"f:\Water lilies.txt");
String imageString = reader.ReadLine();
//
// Decode the Base64-Encoded binary whic previously read from the
// text file above.
//
byte[] imageBytes = Convert.FromBase64String(imageString);
//
// Create a new image file.
//
FileStream fs = new FileStream(@"C:\New Water lilies.jpg", FileMode.Create, FileAccess.Write);
BinaryWriter writer = new BinaryWriter(fs);
try
{
for (int i = 0; i < imageBytes.Length; i++)
{
writer.Write(imageBytes[i]);
}
}
finally
{
writer.Close();
fs.Close();
}
Console.ReadLine();
}
}
}
//--------------
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace binary_data_converted_into_image
{
public class DecodeBase64Binary
{
public static void Main(string[] args)
{
//
// Read the contents of Encoded Bitmap from the text file.
//
TextReader reader = new StreamReader(@"f:\Water lilies.txt");
String imageString = reader.ReadLine();
//
// Decode the Base64-Encoded binary whic previously read from the
// text file above.
//
byte[] imageBytes = Convert.FromBase64String(imageString);
//
// Create a new image file.
//
FileStream fs = new FileStream(@"C:\New Water lilies.jpg", FileMode.Create, FileAccess.Write);
BinaryWriter writer = new BinaryWriter(fs);
try
{
for (int i = 0; i < imageBytes.Length; i++)
{
writer.Write(imageBytes[i]);
}
}
finally
{
writer.Close();
fs.Close();
}
Console.ReadLine();
}
}
}
//--------------
how to retrieve image in console in binary code
using System;
using System.IO;
namespace csharp.Example.System
{
public class BinaryToBase64
{
public static void Main(string[] args)
{
//
// Prepare a place holder for our image file
//
byte[] imageBytes = null;
//
// Read the content of image file and store each byte in the
// imagesBytes.
//
FileStream fs = new FileStream(@"C:\Users\Radhey Radhey\Pictures\Cars\1.jpg", FileMode.Open, FileAccess.Read);
BinaryReader reader = new BinaryReader(fs);
try
{
long size = reader.BaseStream.Length;
imageBytes = new byte[size];
for (long i = 0; i < size; i++)
{
imageBytes[i] = reader.ReadByte();
}
}
finally
{
reader.Close();
fs.Close();
}
//
// Convert the images bytes into its equivalent string representation
// encoded with base 64 digit.
//
string imageString = Convert.ToBase64String(imageBytes);
Console.WriteLine("Image String: " + imageString);
TextWriter writer = new StreamWriter(@"f:\Water lilies.txt");
writer.WriteLine(imageString);
Console.ReadLine();
}
}
}
using System.IO;namespace csharp.Example.System
{
public class BinaryToBase64
{
public static void Main(string[] args)
{
//
// Prepare a place holder for our image file
//
byte[] imageBytes = null;
//
// Read the content of image file and store each byte in the
// imagesBytes.
//
FileStream fs = new FileStream(@"C:\Users\Radhey Radhey\Pictures\Cars\1.jpg", FileMode.Open, FileAccess.Read);
BinaryReader reader = new BinaryReader(fs);
try
{
long size = reader.BaseStream.Length;
imageBytes = new byte[size];
for (long i = 0; i < size; i++)
{
imageBytes[i] = reader.ReadByte();
}
}
finally
{
reader.Close();
fs.Close();
}
//
// Convert the images bytes into its equivalent string representation
// encoded with base 64 digit.
//
string imageString = Convert.ToBase64String(imageBytes);
Console.WriteLine("Image String: " + imageString);
TextWriter writer = new StreamWriter(@"f:\Water lilies.txt");
writer.WriteLine(imageString);
Console.ReadLine();
}
}
}
Check Character in c sharp
using System;
namespace csharp.Example.System
{
public class DeterminingCharType
{
public static void Main(string[] args)
{
Console.WriteLine("please enter character");
char c = Convert.ToChar(Console.ReadLine());
if (Char.IsDigit(c))
{
Console.WriteLine("Char " + c + " is digit");
}
else if (Char.IsNumber(c))
{
Console.WriteLine("Char " + c + " is number");
}
else if (Char.IsSeparator(c))
{
Console.WriteLine("Char " + c + " is separator");
}
else if (Char.IsSymbol(c))
{
Console.WriteLine("Char " + c + " is symbol");
}
else if (Char.IsControl(c))
{
Console.WriteLine("Char " + c + " is control");
}
else if (Char.IsLetter(c))
{
Console.WriteLine("Char " + c + " is letter");
}
else if (Char.IsPunctuation(c))
{
Console.WriteLine("Char " + c + " is punctuation");
}
else if (Char.IsSurrogate(c))
{
Console.WriteLine("Char " + c + " is surrogate");
}
else if (Char.IsWhiteSpace(c))
{
Console.WriteLine("Char " + c + " is whitespace");
}
Console.ReadLine();
}
}
}
namespace csharp.Example.System
{
public class DeterminingCharType
{
public static void Main(string[] args)
{
Console.WriteLine("please enter character");
char c = Convert.ToChar(Console.ReadLine());
if (Char.IsDigit(c))
{
Console.WriteLine("Char " + c + " is digit");
}
else if (Char.IsNumber(c))
{
Console.WriteLine("Char " + c + " is number");
}
else if (Char.IsSeparator(c))
{
Console.WriteLine("Char " + c + " is separator");
}
else if (Char.IsSymbol(c))
{
Console.WriteLine("Char " + c + " is symbol");
}
else if (Char.IsControl(c))
{
Console.WriteLine("Char " + c + " is control");
}
else if (Char.IsLetter(c))
{
Console.WriteLine("Char " + c + " is letter");
}
else if (Char.IsPunctuation(c))
{
Console.WriteLine("Char " + c + " is punctuation");
}
else if (Char.IsSurrogate(c))
{
Console.WriteLine("Char " + c + " is surrogate");
}
else if (Char.IsWhiteSpace(c))
{
Console.WriteLine("Char " + c + " is whitespace");
}
Console.ReadLine();
}
}
}
Progress Bar in Console Application...
using System;
using System.Text;
using System.Threading;
namespace csharp.Example.System
{
class ConsoleProgressBar
{
//[STAThread]
public static void Main(string[] args)
{
StringBuilder progress = new StringBuilder();
for (int i = 1; i <= 100; i++)
{
// Increments progress bar indicator.
//
if (i % 2 == 0)
{
progress.Append("=");
}
//
// Prints the progress bar and return to the beginning of
// the line using carriage return (\r). Using carriege
// return makes the next print process occurs in the same
// line of the console.
//
Console.Write(i + "% " + progress.ToString() + "\r");
// Adds delay to simulate a process.
Thread.Sleep(100);
}
Console.Write("Done! ");
Console.Read();
}
}
}
using System.Text;
using System.Threading;
namespace csharp.Example.System
{
class ConsoleProgressBar
{
//[STAThread]
public static void Main(string[] args)
{
StringBuilder progress = new StringBuilder();
for (int i = 1; i <= 100; i++)
{
// Increments progress bar indicator.
//
if (i % 2 == 0)
{
progress.Append("=");
}
//
// Prints the progress bar and return to the beginning of
// the line using carriage return (\r). Using carriege
// return makes the next print process occurs in the same
// line of the console.
//
Console.Write(i + "% " + progress.ToString() + "\r");
// Adds delay to simulate a process.
Thread.Sleep(100);
}
Console.Write("Done! ");
Console.Read();
}
}
}
Wednesday, July 13, 2011
how to make setup in visual studio
Create Your Own Set Up
Step I:
Create one Windows based application in VS.Net using any of the Languages i.e. C# or VB.Net.
Step II:
After your program is running and you are ready for the setup. To add setup to your existing application go to Go to File > Add Project > New Project.
After your program is running and you are ready for the setup. To add setup to your existing application go to Go to File > Add Project > New Project.
The window appears like below and you select the Project as Setup Project and give a Name and its Location.
Step III:
After creating setup project right click on project and than select view, it will show different possible operations, which you can perform with this setup project.
The options available are
File System
Registry
File Types
User interfaces
Custom Actions
Launch conditions
Step IV:
Click on File system, it is used to create file system on the target machine. Through this you can specify what details you want to provide at the target machine.
Step V:
Now in the new window, its time to add the files & folder’s used by the application.
First we add the Project Output file. Click on Project Output and a new popup appears. Select the appropriate choice. For a normal project we select as Primary Output File & Content Files.
it is used to create file system on the target machine. Through this you can specify what details you want to provide at the target machine.
To add Icons/Any specific folders, click on Add > Folder and Folder is added. Rename the folder as per your project requirements
After the Folder is create then add the files to the setup. These will be installed in the same fashion on the target machine
Step VI:
Now we are about to create the setup before that we will setup the program icon. To do it we will do this process :
When you click on Browse, a window gets popup. Now as the icons are already added into the application setup, just click on Browse to pint to that icon and click on ok.
Step VII:
Now final step is compile the setup project. After compilation you will notice that it has generated Setup.msi in the same location which you provided when you initially created the setup project.
You can supply this msi the target machine, when you run this msi at target machine it will create a virtual directory as well as create same folder structure, which you have specified in File System. This installer will also install the specified those libraries in the registry which are specified in the Registry.
Now you can browse that application at the target machine in same way as you have done at your own machine.
Friday, July 8, 2011
All Stars Programs with solution using C.... ..
- Write a C program to print the following pattern:
2. *
3. * *
4. * * *
5. * * * *
By Gulshan Arora
- Write a C program to print the following pattern:
7. * *
8. * * * * * *
9. * * * * * * * * * *
10.* * * * * * * * * * *
By Gulshan Arora
- Write a C program to print the following pattern:
12.* *
13. * *
14.* * * *
15. * * * *
16.* * * * *
17. * * * *
18.* * * *
19. * *
20.* *
- Write a C program to print the following pattern:
22.* * * * *
23. * * * *
24. * * *
25. * *
26. *
27. * *
28. * * *
29. * * * *
30.* * * * *
- Write a C program to print the following pattern:
32.*
33. * * *
34. * * * * *
35. * * * * * * *
36. * * * * * * * * *
37. * * * * * * *
38. * * * * *
39. * * *
40. *
41. * * *
42. * * * * *
- Write a C program to print the following pattern:
44.*
45. * *
46. * * *
47. * * * *
48. * * *
49. * *
50. *
- Write a C program to print the following pattern:
52.* * * * * * * * *
53.* * * * * * * *
54.* * * * * *
55.* * * *
56.* *
57.* * * *
58.* * * * * *
59.* * * * * * * *
60.* * * * * * * * *
- Write a C program to print the following pattern:
62.* * * * * * * * * * * * * * * * *
63. * * * * * * * * * * * * * *
64. * * * * * * * * * *
65. * * * * * *
66. * * * * * * * * *
67. * * * * * * *
68. * * * * *
69. * * *
70. *
- Write a C program to print the following pattern:
72.*
73. * * *
74. * * * * *
75.* * * * * * *
76.* *
77.* * * *
78.* * * * * *
79.* * * * * * *
80.* * * * * *
81.* * * *
82.* *
83.* * * * * * *
84. * * * * *
85. * * *
86. *
- Write a C program to print the following pattern:
88.* * * * * * * * * * * * * * * * * * * * * * * * *
89. * * * * * *
90. * * * * * *
91. * * * * * *
92. * * *
93. * * * * * *
94. * * * * * *
95. * * * * * *
96.* * * * * * * * * * * * * * * * * * * * * * * * *
*
* *
* * *
* * * *
Program:
/* This is a simple mirror-image of a right angle triangle */
#include
int main() {
char prnt = '*';
int i, j, nos = 4, s;
for (i = 1; i <= 5; i++) {
for (s = nos; s >= 1; s--) { // Spacing factor
printf(" ");
}
for (j = 1; j <= i; j++) {
printf("%2c", prnt);
}
printf("\n");
--nos; // Controls the spacing factor
}
return 0;
}
- Write C program to print the following pattern:
3. * *
4. * * * * * *
5. * * * * * * * * * *
* * * * * * * * * * *
Program:
#include
int main() {
char prnt = '*';
int i, j, k, s, c = 1, nos = 9;
for (i = 1; c <= 4; i++) {
// As we want to print the columns in odd sequence viz. 1,3,5,.etc
if ((i % 2) != 0) {
for (j = 1; j <= i; j++) {
printf("%2c", prnt);
}
for (s = nos; s >= 1; s--) { //The spacing factor
if (c == 4 && s == 1) {
break;
}
printf(" ");
}
for (k = 1; k <= i; k++) {
if (c == 4 && k == 5) {
break;
}
printf("%2c", prnt);
}
printf("\n");
nos = nos - 4; // controls the spacing factor
++c;
}
}
return 0;
}
- Write C program to print the following pattern:
7. * *
8. * *
9. *
Subscribe to:
Posts (Atom)
-
Make Your Own Notepad In this tutorial we will be making a simple C# Notepad with the option to Clear, Cut, Copy, Paste, Select All, Save...
