Wednesday, December 21, 2011

VB.NET: - Subroutines and functions


Subroutines and functions
Subroutines
     A subroutine is a block of statements that carries out a well-defined task. The block of statements is placed within a set of “Sub..........End Sub” statements and can be invoked by name.
Example
            Sub ShowDate()
                  MsgBox(now())
            End Sub

The above subroutine displays the current date in the massage box and can be called by its name ShowDate().
The statements in a subroutine are executed, and when the End Sub statement is reached, control return to the calling program. It’s possible to exit a subroutine prematurely with the exit sub statement.
All variables declared with in a subroutine are local to those subroutines. When the subroutine exits, all the variables declared in it cease to exit.

Functions
     A function is similar to subroutine, but a function return a result. Subroutines perform a task and don’t report anything to the calling program; functions commonly carry out calculation and report the result.
Because they return values, functions, like variable, have type (return data type). The value we pass back to calling program from a function is called return value, and its type must match the type of the function.
Function, accept arguments, just like subroutine. The statements that make up a function are placed in a set of “Function..........End Function” statement.
The result of a function is returned to the calling program with the return statement. The first time a return statement is executed. The function terminated and control is return to the calling program.
Example
      Function NextDay() as Date
            Nextday = date ADD(DateInterval.Day,1,Now())
      End Function

     Similar to variable, a custom function has a name, which must be unique in its scope. If we declare a function in a form, the function name must be unique in the form. If we declare a function as public or friend, its name must be unique in the project. Functions have the same scope rules as variables and can be prefixed by many of some keyboards. In effect, we can modify the default scope of a function with the keywords Public, Private, Protected, Friend and ProtectedFriend.

Arguments
     Subroutines and Functions aren’t entirely isolated from the rest of the application. Must procedure accept arguments from the calling program. Recall that an argument is a value we pass to procedure and on which the procedure usually act. This is how subroutines and functions communicate with the rest of an application.
     Functions also accept arguments, in many cases more than one.
Example
     The function Min(), for instance, accepts two numbers and return the smaller are :-
      Function Min(ByVal a As Integer, ByVal b As Integer) As Single
            Min=IIF(a<b;a,b)
      End Function
IFF() function is a built in function that evaluates the first argument, which is logically expression. If the expression is true, IFF() function return second argument; if the expression is False, IFF() return the third argument.

Argument passing Mechanisms
     One of the most important issues is writing procedure is the mechanism use to pass arguments. The examples so far have used the default mechanism, passing arguments by value. The other mechanism is passing them by reference.
       1. Passing argument by value:
When we pass an argument by value, the procedure sees only a copy of argument. The benefits of passing argument by value are isolated from the procedure, and only the code segment in which they are declared can change the values. This is the default argument passing mechanism in vb.net.
     To specify the argument that will by pass by value, use the ByVal keyword in front of the argument name. If we omit the ByVal keyword, the editor will insert it automatically, since it is the default option.
Example
     Function Degree(ByVal celcius As Single) As Single
            Degree= (9/5)*celcius + 32
      End Function
Note1: When we pass arguments to a procedure by reference, we’re actually passing the variable itself. Any changes made to the argument by the procedure we be permanent. When we pass arguments by value, the procedure gets a copy if the variable, which is discarded when the procedure ends. Any changes made to the argument by the procedure won’t affect the variable of the calling program.
Note2: When we pass an array as argument to a procedure, the array is always passed by reference even if we specify the ByVal keyword. The reason for this is that it would take a machine sometime to create a copy of array. Since a copy of array must also live in memory, passing too many arrays back and forth by value would depend our system’s memory.

       2. Passing Argument by Reference
Passing argument by reference gives the procedure access to actual variable. The calling procedure passes the address of the variables in memory to that the procedure can change its value permanently. With VB6.0 is the Default argument passing mechanism.
     Example
            Function ADD(ByRef num1 as Integer,ByRef num2 as Integer) As Integer
                  ADD = num1 + num2
                  num1 = 0
                  num2 = 0
            End Function
     This function adds two numbers and then sets them to zero.

VB.NET - Array

Array
     A standard structure for storing data in any programming language is the array. Array can hold set of data of the same type (a set of numbers, a series of data, and so on). An array has a name, as does a variable, and the value store in it can be access by an index.
Declaring array
     Array must be declared with the dim (or public, or private) statement followed by the name of the array and the index of the last element in the array in parentheses.
Example
     Dim arr(15) as Integer
Initializing arrays
     Just as, initializing variables, we can initialize arrays.
     Syntax: =   Dim arr_name As DataType = {entry1, entry2 ….. entry n}

Types of array
In VB.NET the array classified into following types:-
       1. One Dimensional Array: - is used to store data in one flow. At declaring time of this type of array, we use only one subscript.
Example:  Dim marks(5) as integer
In above example, we declare a one dimensional array type integer and name marks. In this, we use one subscript which size is 5.

       2. Two Dimensional Arrays: - we use two subscripts at the declaring time of this array. We separate these subscripts by comma.
Example: dim officeCount (40,5) as Byte
In the above example, we declare a two dimensional array named officeCount. In this first subscripts hold 0 to 40 and second subscript hold 0 to 5 elements. This array has total (40+1) * (5 + 1) = 246 elements.
Two dimensional arrays are also called Rectangle array.
       3. Multi Dimensional Array: - the types of array which use more than two subscripts is called multidimensional array. Visual Basic supports 32 dimensional (subscripts) in array.
Example:  Dim arr(p,q,r,s) as integer

       4. Jagged Array: - Jagged array is the combinations of many arrays. In this each array have different length. A type of array, which each element is a separate array, is called jagged array.
Example:
Dim colors(2)() as Integer
colors(0) = new string{“Red”,”Green”,”Blue”}
colors(1) = new string{“Black”,”white”}
colors(2) = new string{“Yellow”,”Gray”,”Cyan”,”Orange”}



Sunday, December 18, 2011

Maa tere doodh ka haq humse adaa kya hoga

Maa tere doodh ka haq humse adaa kya hoga

Tu jo naraz hui khush humse khuda kya hoga..
Maa tere doodh ka haq humse aada kya hoga

Yaad hai aaj bhi maa mujhko zamana mera
Mujhko School talak chodke aana tera
Sard jaadou ki khatarti hui raatou mai mujhe
Maa chupaleti thi mujhe pyar se baahou mai mujhe

Garmiyou mai mujhe anchal ki hawa deti thi
Phulne phalne ki tu mujhko duva deti thi
Raat bhar jag ke seene pe sulaya tune
Khud rahi bhuki magar mujhko khilaya tune

Tere dil jaisa kisi aur ka dil kya hoga
Maa tere doodh ka haq humse aada kya hoga
Tune aulad pe kya kuch nahi Qurbaan kiya
Apni neende humein di apna woh sukh chain diya

Log karte thai agar tujhse shikayat meri
Apni jaan par khelkar karti thi hifazat meri
Jab koi mujhko sataye tou bigadjati
Meri khatir kabhi jhagde par utar aati thi
Mere saansou mai tu moujud hai khusboo banker
Meri raatou mai chamakti hai tu jugnu banker

Tera dil todke dil mera bhala kya hoga
Maa tere doodh ka haq humse aada kya hoga
Yaad aati hai abhitak baatei teri
Mere rone se chalak jaati thi aankhein teri

Tu mujhe rota hua dekhkar rodeti thi
Apna sukh chain mere waste khodeti thi
Phir duaein mujhe de ab bhi sawar jaunga
Tu yunhi roti rahi tou mai marjunga
Hoga ehsaan gale badke lagale mujhko
Apne mamta bhare jannat mai chupale mujhko
Yahi ek raasta hai is ke siva kya hoga

Maa tere doodh ka haq humse aada kya hoga
Tujhko Allah ne kya khoob sharf baqsha
Zikar quran ke paarou mai tera aaya hai
Teri azmat ko farishtou ne i di hai
Yahi waliyou ne imamou ne gulami ki hai

Apne betou ke sitam haske uthaleti hai
Aur tu hai ke inhe phir bhi dua deti hai
Hai teri zaat pe Allah ki khudrat ko bhi naaz
Ho ijazat tou pahdhou mai tere anchal pe namaz
Martabe mai koi maa tujhse bada kya hoga

Maa tere doodh ka haq humse aada kya hoga

Wasta adam e hawa ka tujhe deta hu
Wasta shahe madina ka tujhe deta
Wasta deta hu hyder ki shujat ka tujhe
Wasta Fatima Zahra ki ibadat ka tujhe
Tu jo khush hogi tou khush honge Hussain aur Hassan
Warna veeran rahega mere jeevan ka chaman
Aye meri maa tu mera doodh na baqshegi agar
Aag douzaq ki jalayegi mujhe reh reh kar
Baad marne ke zara sonch mera kya hoga

Maa tere doodh ka haq humse aada kya hoga
:'( :'( :'(

Social Media Poetry

Great People

Thursday, December 15, 2011

Wednesday, December 14, 2011

Create image gallary with HTML5 and CSS3.0

  


Code

<!DOCTYPE html>
<html>
<head>
    <Title>DKB Photo Gallary</Title>
   
    <style type="text/css">
        body{background-image:url(Images\bg.png);}       
       
        img
        {
        width:150px;
        height:120px;
        box-shadow:10px 10px 105px limegreen;
        border-radius:5px 5px 5px 5px;
        opacity:0.5;
        float:left;
        position:relative;
        padding:5px 5px 5px 5px;
        background:lightgreen;
        border:3px solid green;
        }
       
        .pic1
        {
        z-index:1;
        -webkit-transform:translate(50px,50px) rotate(-30deg);
        -ms-transform:translate(50px,50px) rotate(-30deg);
        -moz-transform:translate(50px,50px) rotate(-30deg);
        }
        .pic2
        {
        z-index:1;
        -webkit-transform:translate(50px,50px) rotate(-3deg);
        -ms-transform:translate(50px,50px) rotate(-3deg);
        -moz-transform:translate(50px,50px) rotate(-3deg);
        }
        .pic3
        {
        z-index:1;
        -webkit-transform:translate(50px,50px) rotate(15deg);
        -ms-transform:translate(50px,50px) rotate(15deg);
        -moz-transform:translate(50px,50px) rotate(15deg);
        }
        .pic4
        {
        z-index:1;
        -webkit-transform:translate(50px,50px) rotate(-20deg);
        -ms-transform:translate(50px,50px) rotate(-20deg);
        -moz-transform:translate(50px,50px) rotate(-20deg);
        }
   
           
        img:hover
        {
        width:400px;
        height:500px;
        box-shadow:10px 10px 105px pink;
        border-radius:5px 5px 5px 5px;
        opacity:0.5;
        float:left;
        position:relative;
        padding:10px 10px 10px 10px;
        background:yellow;
        border:3px solid orange;
        }
    </style>
</head>
<body>
    <p>
        <img class="pic1" src="Images\chloe_moretz.jpg">
        <img class="pic2" src="Images\cosmos-wide.jpg">
        <img class="pic3" src="Images\horses-wide.jpg">
        <img class="pic4" src="Images\olivia_wilde.jpg"><br>
    </p>
</body>
</html>

By Dharmendra Bakrecha
http://dkbakrecha.webs.com/dkbstuff.htm
mail : dkbakrecha@gmail.com

Work hard and Sleep Hard


Monday, October 31, 2011

50 First Dates : "Every Breath You Take"



"Every Breath You Take"

Every breath you take
Every move you make
Every bond you break
Every step you take
I'll be watching you

Every single day
Every word you say
Every game you play
Every night you stay
I'll be watching you

O can't you see
You belong to me
How my poor heart aches with every step you take

Every move you make
Every vow you break
Every smile you fake
Every claim you stake
I'll be watching you

Since you've gone I been lost without a trace
I dream at night I can only see your face
I look around but it's you I can't replace
I feel so cold and I long for your embrace
I keep crying baby, baby please

Every move you make
Every vow you break
Every smile you fake
Every claim you stake
I'll be watching you

Manage by "DKB" any query : dkbakrecha@gmail.com

Tuesday, October 25, 2011

Sincere Love.....








 I love you more than they love you
Their love is only in the mouth
Tap my love from the heart of the most in
I want you to come to me
       
 You may never know
       
 That I love you
       
 You just looked at me
       
 Like the wind passing away
In each I pray
That's where I really want you
I pray to God
I came out
That I want to live with
Forever
         
 I want to tell you god
         
 Through the winds that blow
         
 I want you to accept me
         
 I want God to open your heart
God ..
Only he was looking for during this
Say hello to him:)

Saturday, October 15, 2011

Meaning Clock


Good Relations Are Like Needles of clock,
They only meet for Sometime but Always stay connected.

Wednesday, May 11, 2011

Winning is Everything


Winning is Everything
sometimes winning is everything
take a stand, now and never
choose a high, leave your mark
now or never, kill doubt
stand for something, prove something
make waves, never say die...

live your dream, conquer your fears
take a risk, erase boundaries
beat the odds, trust your instincts
take up a challenge, never give up
prove yourself, own your words
right a wrong, dare to dream
push the limit, play with pride
wake the spirit, go for glory
tougher the better, face your demons
it's your time, taste victory
Because WINNING is EVERYTHING..
                                        ..D. Bakrecha

Saturday, April 16, 2011

One line concept


As based on OOP in Java..... DKB

Object: An object is a software bundle of related state and behavior. Software object are often used to model the real world object that we find in everyday life.
Class: A class is a blueprint or prototype from which object are created.
Inheritance: Inheritance provides a powerful and natural mechanism for organizing and structuring our software.
Interface: An interface is a contract between a class and the outside world. When a class implements an interface, it promises to provide the behavior publish by the interface.
Package: A package is a namespace for organizing classes and interfaces in a logical manner. Placing our code into packages makes out large software projects easier to manage.

Wednesday, March 30, 2011

Java Applat 03

//Dharmendra Bagrecha
import java.awt.*;
import java.applet.*;
/*
<APPLET code="cal.class" width=400 height=400>
</Applet>
*/
public class cal extends Applet
{
TextField text1,text2;
//Button c;
    public void init()
    {
    text1 = new TextField(5);
    text2 = new TextField(5);
    add(text1);
    add(text2);
    text1.setText("0");
    text2.setText("0");
    //c = new Button("Calculate");
    //c.addActionListener(this);
    }
   
    public void paint(Graphics g)
    {
    int x=0,y=0,z=0;
    String s1,s2,s;
    g.drawString("Input Number in boxes :",10,50);
    try
        {
        s1 = text1.getText();
        x = Integer.parseInt(s1);
        s2 = text2.getText();
        y = Integer.parseInt(s2);
        }
    catch(Exception ex){}
    z = x + y;
    s = String.valueOf(z);
    g.drawString("The Sum is :",10,75);
    g.drawString(s,100,75);
    z = x - y;
    s = String.valueOf(z);
    g.drawString("The Minus is :",10,85);
    g.drawString(s,100,85);
    z = x * y;
    s = String.valueOf(z);
    g.drawString("The Multiply is :",10,95);
    g.drawString(s,100,95);
    }
   
    public boolean action (Event event,Object object)
    {
    repaint();
    return true;
    }
}


Java Applat 02

//Dharmendra Bagrecha
import java.awt.*;
import java.applet.*;
/*
<APPLET code="Face.class" width=200 height=200>
</Applet>
*/
public class Face extends Applet
{
    public void paint(Graphics g)
    {
    g.drawOval(40,40,120,120);
    g.drawOval(57,75,30,20);        //eyes
    g.drawOval(110,75,30,20);
    g.fillOval(68,81,10,10);
    g.fillOval(120,81,10,10);
    g.drawOval(94,100,15,30);        //Nose
    g.drawArc(60,105,80,40,180,180);    //Mouth
    }
}


Nathuram Godse - The Man Who Killed Gandhi

Nathuram Godse - The Man Who Killed Gandhi (The Other Side of The Story)