One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man

Friday, July 1, 2011

WPF transparent form application

1) First you have to create a new WPF application project
                                           File -> New -> project
select WPF application and press OK

2) Then you have to create a circle inside the form using the Ellipse tool in the toolbox
3) After that you have to do few changes to the XAML coding


Your  coding appear like the following


<Window x:Class="MyApp.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <Ellipse Margin="-1,-1,-1,1" Name="ellipse1" Stroke="Black"/>
    </Grid>
</Window>


That must change like following


<Window x:Class="MyApp.Window1" MouseLeftButtonDown="Window_MouseLeftButtonDown" WindowStyle="None" AllowsTransparency="True" Background="Transparent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <Ellipse Margin="-1,-1,-1,1" Name="ellipse1" Stroke="Black" Fill="Gray" Opacity="0.5"/>
        <Button Height="23" Margin="99,28,104,0" Name="button1" VerticalAlignment="Top">Close</Button>
    </Grid>
</Window>


following picture show you the changes by underlining newly added parts
4) Then double click on the button and write the following coding part
               Close();
5) Then write the following code inside the "Window_MouseLeftButtonDown" method
               DragMove();
   You can see the above 2 steps from the picture
6) Finally build the solution and see the result. you can drag the form by draging the content of the form
This is a very basic WPF form application. You can develop any complex interfaces or application same as the normal windows form application by using this theory

Wednesday, March 9, 2011

Pharmacy Software for beginners

This is my first year project that we have in the software technology subject. we have to create a pharmacy software which use in the their stores using c++ language. But at that time we don't have a knowledge to use databases. Therefore we use linked list method to implement this project. Then we can store our inputed values until we close the program using linked list. Click here to download the .exe file and try it and see how to work. First of all you have to input stocks. Then input items. After that you can check other functions.


In the picture you can see the the Add Items tab. There are two tabs inside that. Because if we want to add new item what we don't have in the inventory we have to add that item separately, otherwise we can input that immediately. Different stocks in the same item separate by the expire date.


Above you can see the release item tab. when we release items we have to reduce the stored values and it will automatically calculate the price and it will show you how much you have in your hand after you release this amount. If that quantity in hand is less than Re-order level we give you a massage "please reorder the item".


When we move to the edit item tab, there are two tabs for Edit Items and Edit stocks. If we want to edit one item of a stock we can use edit item tab and if we want to edit whole stock details we can use edit stock tab.


This is a Delete item tab. First you have to specify the deletion type and you can select items for delete. When you delete items if the Re-order level reached it will show you a message to inform that. 


When we move to the Report tab there are more reports to the user that provide various information about items. Before you watch the results you have to refresh the table.


Click here to download the source code. This software created using visual studio 2008 IDE. Because of that your system have visual studio 2008 to see the source code. That the zip file I provide, you have to extract first. then goto that folder and double click the visual studio file. Then you can see the source code and other interfaces.


Saturday, March 5, 2011

New software "Media Center" to watch TV, Listen Radio and read News

Web is too  decentralized place. If we want to watch TV or listen Radio and read news, we have to go through search engines to find out them. I think about a software to centralize all of them. That is the Media Center (beta version)software


You can watch TV, listen Radio, Watch e-papers and go to the other news  sites very easily by only pressing a one button.


Click Here to Download.
when this software run sometimes system will ask you permission for connect to the internet. Then you have to Allow it. Otherwise it will not working properly. Some channels did not provide that services at sometimes. If those are not working you have to try that channel after few minutes.
There can be errors. Because this is a beta version. Please inform us about if there are any errors.Your comments are very useful to improve this software. 

Thursday, February 10, 2011

Shell Scripting - Tutorials

To view the full size image, you have to click on the image.......

01. This example coding gives you a clear idea about how to write a switch statements and how to get user inputs in shell script. 

Write a menu driven shell script to perform the following tasks
        [1] Show Today's date/time
        [2] Show file in current directory
        [3] Show calender
        [4] Start editor to write letters
        [5] Exit/Stop
02.This example coding is helpful to you to understand how to use advance for-loops


Write a shell script to display the even numbers 2,4,6,......100
04. Suppose you have a text file named dirList containing a list of directories. Write a shell script that goes to each of them, execute the command make and comes back to the working directory
05. How to perform real number calculation? How to calculate 5.12 + 2.5 real number calculation at $ prompt in shell?
                echo 5.12 + 2.5 | bc


Thursday, February 3, 2011

java - Methods to manipulate characters



I will give you examples to get a clear idea about each and every method


1. isDigit()                                 - check whether the character is a digit or not
2. isLetter()                               - check whether the chatacter is a letter or not
3. isLowerCase()                       - check whether the character is a lowercase or not
4. isUpperCase()                       - check whether the character is a uppercase or not
5. toLowerCase()                      - convert the uppercase character to lowercase character
6. toUpperCase()                      - convert the Lowercase character to Uppercase character
7. isWhiteSpace()                     -  check whether the character is a space, tab or newline or not
8. isSpaceChar()                       - check whether the character is a space or not


01)  isDigit() and isLetter()


class hsp{
public static void main(String args[]){
System.out.println(Character.isDigit('a'));
System.out.println(Character.isDigit('2'));
System.out.println(Character.isLetter('a'));
System.out.println(Character.isLetter('2'));
}
}


you have to use covering class to use these methds


Character.isDigit('a')
Character.isLetter('a')


output : 














02)  isLowerCase() and isUpperCase()


class hsp{
public static void main(String args[]){
System.out.println(Character.isLowerCase('a'));
System.out.println(Character.isLowerCase('A'));
System.out.println(Character.isLowerCase('2'));
System.out.println(Character.isUpperCase('a'));
System.out.println(Character.isUpperCase('A'));
System.out.println(Character.isUpperCase('2'));
}
}


Output:
















03)  toLowerCase() and toUpperCase()


class hsp{
public static void main(String args[]){
System.out.println(Character.toLowerCase('a'));
System.out.println(Character.toLowerCase('A'));
System.out.println(Character.toLowerCase('2'));
System.out.println(Character.toUpperCase('a'));
System.out.println(Character.toUpperCase('A'));
System.out.println(Character.toUpperCase('2'));
}
}


Output:
















04)  isSpaceChar()


class hsp{
public static void main(String args[]){
System.out.println(Character.isSpaceChar('a'));
System.out.println(Character.isSpaceChar('A'));
System.out.println(Character.isSpaceChar('2'));
System.out.println(Character.isSpaceChar('\t'));
System.out.println(Character.isSpaceChar(' '));
  }
}


Output:
















05)  isWhitespace()


class hsp{
public static void main(String args[]){
System.out.println(Character.isWhitespace('a'));
System.out.println(Character.isWhitespace('A'));
System.out.println(Character.isWhitespace('2'));
System.out.println(Character.isWhitespace('\t'));
System.out.println(Character.isWhitespace('\n'));
System.out.println(Character.isWhitespace(' '));
}
}


Remember the "space" word in the "isWhitespace()" keyword is lower case.


Output:



Saturday, January 29, 2011

Create a simple console calculator using shell scripts

This coding gives you a some idea about, how to use loops and if else statements and other simple things. I think this coding will be more valuable for beginners.
You can use editors that support graphical interface and you can detect your errors very easily. 
Application -> Accessories -> Text Editors
First you have to save your script using .sh extension.   
                ex :-  cal.sh
After that you can type the coding......


#This is a simple calculator


option=-1
num1=0
num2=0


echo This is my calculator
echo Availabale operations
echo -e "\tAddition\t\t - 0"
echo -e "\tSubstraction\t\t - 1"
echo -e "\tMultiplication\t\t - 2"
echo -e "\tDivition\t\t - 3"
echo -e "\tFactorial\t\t - 4"
echo -e "\tAny power of any base\t - 5"


echo -n "What is the operation that you want  -  "
read num


if [ $num -eq 0 ]
then 
        echo -n "Enter the number 1 - "
        read num1
        echo -n "Enter the number 2 - "
        read num2
        echo Answer is `expr $num1 + $num2`
else
        if [ $num -eq 1 ]
        then
                  echo -n "Enter the number 1 - "
                  read num1   
                  echo -n "Enter the number 2 - "
                  read num2
                 echo Answer is `expr $num1 - $num2
        else
                 if [ $num -eq 2 ]
                 then       
                      echo -n "Enter the number 1 - "
                         read num1
                         echo -n "Enter the number 2 - "
                         read num2
                         echo Answer is `expr $num1 \* $num2`
                 else
                    if [ $num -eq 3 ]
                    then 
                                         echo -n "Enter the number 1 - "
                                    read num1
                                    echo -n "Enter the number 2 - "
                                    read num2
                                    echo Answer is `expr $num1 \/ $num2`
                                 echo Remainder is `expr $num1 \% $num2`
                    else     
                                        if [ $num -eq 4 ]
                                then
                                            echo -n "Enter the number - "
                                            read num1
                                            answer=1
                                            while [ $num1 -gt 0 ]
                                             do
                                              answer=`expr $answer \* $num1`
                                              num1=`expr $num1 - 1`
                                            done
                                            echo "Answer is " $answer
                                else
                                   if [ $num -eq 5 ]
                                   then
                                               echo -n "Enter the Base - "
                                               read num1
                                               echo -n "Enter the power - "
                                               read num2
                                               answer=1
                                                       while [ $num2 -gt 0 ]
                                                        do
                                                          answer=`expr $answer \* $num1`
                                                          num2=`expr $num2 - 1`
                                                       done
                                                       echo "Answer is " $answer
                                    fi 
                                fi
                       fi
                 fi
         fi
fi

After finish the coding you have to execute this script. To execute you have to open the terminal first. 
Then type sh<space><script name>
          ex :- sh cal.sh
Then press Enter and see the out put

java VS .NET

How to create your own web browser using visual studio C#

1. As usually first you have to create a windows form application
2. Then change your form name and change "IsMdiContainer" property to "True"










3. Then drag and drop a web browser and a tool Strip from the web browser.




4. Then Add buttons and labels and text boxes to your tool strip.
   you can use any amount of buttons to go to your preferable sites by pressing one button.
  you  can set images and sizes to your buttons.
5.After that you have to write codings for every butoon click event (double click on the button).
  Add below codings for that events.


Next button 
webBrowser1.GoForward();


Previous button
webBrowser1.GoBack();


Go button
webBrowser1.Navigate(new Uri("http://"+toolStripTextBox1.Text));


Facebook shortcut button
webBrowser1.Navigate(new Uri("http://www.facebook.com/"));


Gmail shortcut button
webBrowser1.Navigate(new Uri("http://www.gmail.com/"));


  After all these, coding will be view like below. 
6. You can run and check your own web browser.



Wednesday, January 26, 2011

How to create a simple media player using Visual Studio C#

As usually you have to create a windows form application in visual studio
File->New->Project


Then you have to select c# windows form application and give the name and location for your project. After that press ok.


Then Right-click on the toolbox and press "choose Items". Then the following window will appear.


Press "COM component" tab.
Then put a tick on windows media player according to the following picture and press OK.


Now you can see there is tool "Windows media player" on the bottom of the toolbox.


Then drag and drop and change the size as you wish.


After that drag and drop a Menu Strip from the toolbox and give the first one as "Open".


Then Double-click on "Open".



Write a coding as it is in the following picture.



                    OpenFileDialog open = new OpenFileDialog();
                    open.Title = "Open";
                    open.Filter = "All Files|*.*";
                    try
                    {
            
                              if(open.ShowDialog()==System.Windows.Forms.DialogResult.OK)
                                                      axWindowsMediaPlayer1.URL=(open.FileName);
                    }
                    catch (Exception ex)
                    {
                             MessageBox.Show(ex.Message.ToString(),"Error", MessageBoxButtons.OK,       MessageBoxIcon.Error);                
                    }

At last run the program and watch a movie using your own media player.

Sunday, January 23, 2011

How to print the content of any text file?

Write a program to read lines from a text file and display the content to the user.

Hint:
         You may have to use FileInputStream, InputStreamReader and
         BufferedReader classes.
         When you ends the reading readLine() method will give you null values

         FileInputStream fs = new FileInputStream("tutorial.txt");
         BufferedReader in = new BufferedReader(new InputStreamReader(fs));


Answer :  "tutorial.txt" is my file name. you have to use a existing file name in your computer. if it is not in the same folder that you save this java programe, you have to give the full path of that file.


import java.io.*;


class File{
public static void main(String args[]) throws IOException { 
FileInputStream fs = new FileInputStream("tutorial.txt");
BufferedReader in = new BufferedReader(new InputStreamReader(fs));
String text=in.readLine();


while(text!=null){
System.out.println(text);
text=in.readLine();
}
  }
}

Saturday, January 22, 2011

How to get user inputs using keyboard?

Tutorial


01. Write a Java program to convert a given temperature in Celsius to Fahrenheit or to
convert  a  given  temperature  in  Fahrenheit  to  Celsius.  Get  all  the  inputs  as
keyboard  inputs.  Your  program  should  have  two  methods
           celsiusToFahrenheit()
                       and
            fahrenheitToCelsius()
to  perform  the  operations  mentioned  above.    When
ever you run the program main method should display  an output as given below.
Enter
          1 – To convert Celsius to Fahrenheit
          2 - To convert Fahrenheit to Celsius
         Any other number – To exit

        *  When the use enters a value 1 or 2, get the temperature in Celsius or in
             Fahrenheit convert to the other form and display.

        * Then you  must display the menu given above again.

        * You exit the program wh en the user  enter any number other than 1 or 2.

        * You may use loop and switch statements.


              Tc = (5/9)*(Tf-32);
              Tf = (9/5)*Tc+32;

Answer :



import java.util.Scanner;


class Temp{
public static void main(String args[]){
System.out.println("Enter\n1 - To convert Celsius to Fahrenheit\n2 - To convert Fahrenheit   to Celsius\nAny other number - To exit");

Scanner sc1 = new Scanner(System.in);
int option = sc1.nextInt();


switch(option){
case 1 : celsiusToFahrenheit();
break;
case 2 : fahrenheitToCelsius();
break;
default : System.exit(0);
}
}
public static void celsiusToFahrenheit(){
System.out.println("Enter celsius value - ");


Scanner sc2 = new Scanner(System.in);
double temp = sc2.nextDouble();

                          System.out.print("Fahrenheit value - "+((9.0/5.0)*temp+32));
}
public static void fahrenheitToCelsius(){
System.out.println("Enter fahrenheit value - ");


Scanner sc2 = new Scanner(System.in);
double temp = sc2.nextDouble();

                          System.out.print("Celsius value - "+((5.0/9.0)*(temp-32)));
}
}




02. Write a Java program to calculate the numb er of digits and number of letters in a
word. Get the word as a  command line argument.
Note:
              You may use isDigit() and isLetter() methods in Character class.

Answer :



import java.io.*;


class Text{
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the text : ");
String text = br.readLine();

int digits=0, letters=0;
for(int i=0; i<text.length(); i++){
if(Character.isDigit(text.charAt(i)))
digits++;
else if(Character.isLetter(text.charAt(i)))
letters++;
}
System.out.println("Number of letter - "+digits);
System.out.println("Number of digits - "+letters);
}
}