Use of For Loops and Functions in Shell Programming #Linux/Unix: Shell Programming – 001

bash-3.2$ cat multiplication.sh
#!/bin/bash

# Example use of function/method declaration in Shell Programming
# Example use of for loop

#a function that will multiply 1 to 10 with 5
multiplication()
{
x=5
for i in {1..10}
do
echo $i
echo “the multiplication result is:” $(($i*$x))
done
}

echo “Print 1 to 10; also multiply each number with 5 and show the multiplication result”
multiplication

—————————–
Output – ?????

bash-3.2$ ./multiplication.sh
Print 1 to 10; also multiply each number with 5 and show the multiplication result
1
the multiplication result is: 5
2
the multiplication result is: 10
3
the multiplication result is: 15
4
the multiplication result is: 20
5
the multiplication result is: 25
6
the multiplication result is: 30
7
the multiplication result is: 35
8
the multiplication result is: 40
9
the multiplication result is: 45
10
the multiplication result is: 50 From: http://sitestree.com/?p=12185
Categories:Linux/Unix: Shell Programming – 001
Tags:
Post Data:2018-04-16 18:16:06

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Example use of case in KSH. Show Today’s Day Name #Linux/Unix: Shell Programming – 001

bash-3.2$ cat ksh_case_example_1.sh
#!/bin/ksh

#show today’s day name
DAY=`date +%a`

#show value of $DAY
echo $DAY

#based on the value of the DAY variable show the day name in full format
case “$DAY” in

Mon)
echo “Monday”
;;

Tue)
echo “Tuesday”
;;

Wed)
echo “Wednesday”
;;

Thu)
echo “Thursday”
;;

Fri)
echo “Friday”
;;

Sat)
echo “Saturday”
;;

Sun)
echo “Sunday”
;;

esac

—————

Output – ?????

bash-3.2$ ./ksh_case_example_1.sh
Sun
Sunday From: http://sitestree.com/?p=12183
Categories:Linux/Unix: Shell Programming – 001
Tags:
Post Data:2018-04-16 18:14:45

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Take Two values from the user and do arithmetic operations #Linux/Unix: Shell Programming – 001

#!/usr/bin/bash
clear
echo “Enter First Number”
read x

echo “Enter Second Number”
read y

#does not work for /bin/sh
(( z = $x + $y ))
(( a = $x – $y ))
(( b = $x * $y ))
(( c = $x / $y ))

#clear

echo “Addition of 2 numbers is =” $z
echo “Subtraction of 2 numbers is =” $a
echo “Multiplication of 2 numbers is =” $b
echo “Division of 2 numbers is =” $c

—————————–

Output – ?????

Enter First Number
20
Enter Second Number
5
Addition of 2 numbers is = 25
Subtraction of 2 numbers is = 15
Multiplication of 2 numbers is = 100
Division of 2 numbers is = 4 From: http://sitestree.com/?p=12181
Categories:Linux/Unix: Shell Programming – 001
Tags:
Post Data:2018-04-16 18:13:03

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Arithmetic Operations using two variables #Linux/Unix: Shell Programming – 001

#!/bin/sh

#will do addition, subtraction, multiplication, and division of two variables
X=12
Y=5

#print the values of the variables
echo “X value is: “$X
echo “Y value is: “$Y

#addition
echo “X + Y” = `expr $X + $Y`

#subtraction
echo “Y – X” = `expr $Y – $X`

#multiplication
echo “X * Y” = `expr $X * $Y`

#division
echo “X / Y” = `expr $X / $Y”`

????? – Output

bash-3.2$ ./arithmetics-operations-of-variables.sh
X value is: 12
Y value is: 5
X + Y = 17
Y – X = -7
X * Y = 60
X / Y = 2 From: http://sitestree.com/?p=12179
Categories:Linux/Unix: Shell Programming – 001
Tags:
Post Data:2018-04-16 18:11:48

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Examples of using variables in a Shell Program #Linux/Unix: Shell Programming – 001

#!/bin/sh

#assign value to a variable and print to the screen
NAME=”Justetc”
echo $NAME

#Ask the user to enter a Name
echo ##################################
echo “enter name”

#read command is used to take input from the user
read X

#print the value two times to the screen
echo $X
echo $X
—————————
????? – Output

bash-3.2$ ./variable_use.sh
Justetc

enter name
Sayed Ahmed
Sayed Ahmed
Sayed Ahmed From: http://sitestree.com/?p=12177
Categories:Linux/Unix: Shell Programming – 001
Tags:
Post Data:2018-04-16 18:10:44

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

A Basic Shell Program #Linux/Unix: Shell Programming – 001

#!/bin/sh

#if enabled – will spit out the script to the screen
#set -v

#clear the screen
clear

echo “SCRIPT BEGINS”

#shows current login name
echo “Hello $LOGNAME”

#shows current date in the same line
echo “Todays date is: c”
date +%m/%d/%y

#shows current time in the same line
echo “and the current time is: c”
date +%H:%M:%S%n

#shows a list of the processes
echo “Now a list of the processes in the current shell”
ps

echo “SCRIPT FINISHED!!”

#example of how to use a variable
NAME=”Justetc”
echo $NAME
——————————————–
Output – ????????? ?? ?????

SCRIPT BEGINS
Hello shell
Todays date is: 04/15/18
and the current time is: 14:46:43

Now a list of the processes in the current shell
PID TTY TIME CMD
14522 pts/2 0:00 bash
14590 pts/2 0:00 a_basic_
14595 pts/2 0:00 ps
14508 pts/2 0:00 sh
SCRIPT FINISHED!!
Justetc From: http://sitestree.com/?p=12175
Categories:Linux/Unix: Shell Programming – 001
Tags:
Post Data:2018-04-16 18:09:14

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Repair laptop battery at home|| how to open laptop battery and rebuild after repairing #Misc

Watch this for concepts. However, do not do as it is. Take some safety measures and precautions as well. Understanding the theory behind circuits will help.
[youtube https://www.youtube.com/watch?v=Da4ilNuUCsg&w=853&h=480] From: http://sitestree.com/?p=12304
Categories:Misc
Tags:
Post Data:2018-09-14 22:15:20

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Misc Web API stuff for .Net #Misc .Net

Learn how to implement Web API service in DNN

Build your first Web API/RestFul application in .Net From: http://sitestree.com/?p=3781
Categories:Misc .Net
Tags:
Post Data:2016-07-17 21:19:45

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Creating and Consuming XML Web Services #Misc .Net

Brought from our old-site (this short note can be as old as 2007): http://salearningschool.com/displayArticle.php?table=Articles&articleID=1120&title=Creating%20and%20Consuming%20XML%20Web%20Services

  • visual studio .net -> File Menu -> new project -> Visual Basic/C# projects ->ASP.Net Web Service -> The project will get created
  • Some Files as created: AssemblyInfo.cs/vb: sharing and reuse in the CLR, Web.config, service1.asmx, service1.asmx.cs/vb
  • Create web service methods in the asmx.vb/cs files. A sample web-service method is already there
  • Now you can build the project using the Build Solution option
  • You can start the application, using the start option in the debug menu
  • Check other short-notes as listed in: http://www.justetc.net/knowledge/index.php?table=Articles&categoryID=24 to know different aspects of web service programming
  • You can publish the web-service using the publish option in the popup menu from the solution explorer. or the publish option in the build menu
  • Then you are required to change some configuration in the IIS server such as give directory browsing permission, make the virtual directory an IIS application, provide execute permission
  • XML WebService Discovery Mechanism: enables a client application to locate or discover the documents that describe an XML Web Service
  • You may want to create a discovery file and deploy in your web-server so that clients can know your services and make use of them.
  • To create, client application for a web-service, first you have to have the permission to access, then you need to add a web-reference to that service from your application
  • Create a proxy class, create an object of that proxy class, call the web service methods using this proxy object
  • You may want to use serialization and deserialization while communicating with the web-services

From: http://sitestree.com/?p=3774
Categories:Misc .Net
Tags:
Post Data:2016-07-17 14:18:28

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Debugging in .Net, (XML Web Services) #Misc .Net

Brought from: http://salearningschool.com/displayArticle.php?table=Articles&articleID=1117&title=Debugging%20in%20.Net,%20(XML%20Web%20Services)

Just listing some related notes.

  • Tools: DbgClr -GUI Based, CorDbg – command line based
  • You can use the debug menu. Start, Step Into, Step Over, New Breakpoint options – as available in most Good to great IDEs for debugging
  • Watch Window: Check the values of variables and expressions
  • Call Stack Window: Function and procedure calls currently on stack
  • Locals Window: Variables that are local to current context
  • Autos Window: Variables in the current statement and in the previous statement
  • Breakpoints Window: Function break point, file breakpoint, address breakpoint, data breakpoint. Gives information on breakpoints – name, condition, hit count
  • Debug XML Web-services: During Development: Place break points in the line where you want to start your debugging. Start the application, keep on executing, and come to the point where the breakpointed (never mind – my invention) statement will execute. Now you can use other windows (watch, call stack,..)
  • Debug XML Web-services: After Deployment: Open the XML webservice in IE, from visual studio debug menu select processes -> aspnet_wp.exe then select Common Language Runtime, select the program to debug, close process dialog box. From visual studio, open the code behind the file that you want to debug, then set breakpoints there
  • Debug Must: In the web.config file, set debug=true.
  • Along with debugging, you can use tracing to collect runtime information for debugging purpose.
  • Three types of Tracing: TextWriterTraceListener: Write messages to an object of the TextWriter class. EventlogTraceListener: Write messages to event logs. DefaultTraceListener: Send debug messages to the output window
  • As tracing usually generates a lot of information, it’s better that you turn off tracing while you don’t intend to use it. Use TraceSwitch classes for the purpose

From: http://sitestree.com/?p=3772
Categories:Misc .Net
Tags:
Post Data:2016-07-17 14:07:04

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada