Friday, 9 August 2013

What is the Difference Between ByRef and ByVal

ByRef refers to the location – But if you pass using “ByRef” then if the parameter values are changed, then the original argument value is also modified. The ByRef use, would imply that a change performed by the statement of the value you pass, has an affect on the actual data. You pass an argument by reference by specifying the ByRef keyword for the corresponding parameter in the procedure definition. When you use this passing mechanism, compiler gives the procedure a direct reference to the underlying programming element in the calling code.
ByVal refers to the actual value – if you are passing parameters with “ByVal” then even if the parameter values are changed, the original argument values will remain intact. Selecting a ByVal would thereby mean you are only working on a copy or replica of the data, and not the actual data segment it self. You pass an argument by value by specifying the ByVal keyword for the corresponding parameter in the procedure definition. When you use this passing mechanism, Visual Basic copies the value of the underlying programming element into a local variable in the procedure. The procedure code does not have any access to the underlying element in the calling code

How to write shell script that will add two nos, which are supplied as command line argument, and if this two nos are not given show error

if [ $# -ne 2 ]
then
echo “Usage – $0 x y”
echo ” Where x and y are two nos for which I will print sum”
exit 1
fi
echo “Sum of $1 and $2 is `expr $1 + $2`”

A Website to Play Online Games

How to Write Recursive Procedures

A recursive procedure is one that calls itself. Example is as follows –
The following procedure uses recursion to calculate the factorial of its original argument.
Function factorial(ByVal n As Integer) As Integer
If n <= 1 Then
Return 1
Else
Return factorial(n – 1) * n
End If
End Function

DOS Versus Linux Commands

DOS commands versusr Linux commands.
As an extra means of orientation for new users with a Windows background, the table below lists MS-DOS commands with their Linux counterparts. Keep in mind that Linux commands usually have a number of options. Overview of DOS/Linux commands are as follows -
DOS commands Linux command
/? man or command, –help
cd cd
chdir pwd
cls clear
copy cp
date date
del rm
dir ls
echo echo
edit vim (or other editor)
exit exit
fc diff
find grep
format mke2fs or mformat
mem free
mkdir mkdir
more more or even less
move mv
ren mv
time date