Serverless computing is a cloud-computing execution model in which the cloud provider dynamically manages the allocation of machine resources.
Android Hello World
Before you start writing your first example using Android SDK, you have to make sure that you have set-up your Android development environment properly. We also assume that you have a little bit working knowledge with Android Studio from class.
So let us proceed to write a simple Android Application which will print “Hello World!”.
A “Hello, World” HTML document
You create a file and put special character sequences called HTML elements into your file. These elements identify the structural parts of your document. When a Web browser displays the file, it will display your file’s content, but not the characters that make up the structure.
Here is an example:
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML> <HEAD> <TITLE> A Small Hello </TITLE> </HEAD> <BODY> <H1>Hi</H1> <P>This is very minimal "hello world" HTML document.</P> </BODY> </HTML>
Only the elements that you place in the BODY element (that is, between <BODY> and </BODY> ) ever get displayed in a Web browser’s window.
In this example, only the contents of the H1 element (between <H1> and </H1> ) and the P element (between <P> and </P> ) are displayed.
Hello World in C++
This is how you would display “Hello World” in C++.
#include <iostream> int main() { std::cout << "Hello World!"; }
Hello World in C#
This is how you would display “Hello World” in C#.
public class HelloWorld { public static void Main() { System.Console.WriteLine("Hello World!"); } }
Hello World in Visual Basic .NET
This is how you would display “Hello World” in Visual Basic.
' Allow easy reference to the System namespace classes. Imports System ' This module houses the application's entry point. Public Module modmain ' Main is the application's entry point. Sub Main() ' Write text to the console. Console.WriteLine ("Hello World using Visual Basic!") End Sub End Module
The command line for compiling the program is the following:
vbc.exe /t:exe /debug+ /optionstrict+ /out:.\HelloVB.exe HelloWorld.vb
In the previous line, /out specifies the output file, and /t indicates the target type.
Hello World in Java
This is how you would display “Hello World” in your Java application.
We break the process of programming in Java into three steps:
- Create the program by typing it into a text editor and saving it to a file named, say, HelloWorld.java.
- Compile it by typing “javac HelloWorld.java” in the terminal window.
- Execute (or run) it by typing “java HelloWorld” in the terminal window.
So, the code in our file would look like
public class HelloWorld { public static void main(String[] args) { // Prints "Hello, World" in the terminal window. System.out.println("Hello World"); } }
To compile HelloWorld.java type the text below at the terminal
javac HelloWorld.java
Once you compile your program, you can execute it. This is the exciting part, where the computer follows your instructions. To run the HelloWorld program, type the following in the terminal window:
java HelloWorld
That’s it!
Hello World in PowerShell
This is how you would display “Hello World” in PowerShell.
Note: PowerShell commands also have the ability to be run in a script with the .ps1 extension but running scripts are disabled by default for security purposes. Firstly, you will need to set the Execution Policy. The cmdlet Get-ExecutionPolicy will show you that the initial policy is set to ‘Restricted’. This will prevent scripts from running. You can change it with the Set-ExecutionPolicy cmdlet. There are four options Restricted, Remote-signed, Signed and Unrestricted. We recommend Remote-Signed as it will allow you to run the scripts that you have created locally and still keep your machine secure.
So, just type
Set-ExecutionPolicy RemoteSigned
Now you can use notepad to create your first script. In Notepad type:
Write-Host "Hello World"
This will need to be saved in a file called something like HelloWorld.ps1.
Then from a PowerShell console type
.\HelloWorld.ps1
The reason you need the .\ is because a PowerShell security feature ensures that you are targeting a specific script in a specific location,. And that’s all there is to it.
Hello World in Perl
This is how you would display “Hello World” in Perl. It’s quite similar to Bash, but note the differences carefully!
Create a text file called hello_world.pl
containing the following code:
#!/usr/bin/perl # # The traditional first program. # Strict and warnings are recommended. use strict; use warnings; # Print a message. print "Hello, World!\n";
Navigate to a directory where your hello_world.pl
is located and make the file executable:
$ chmod +x hello_world.pl
Now you are ready to execute your first perl script:
./hello_world.pl
Hello World in Bash
This is how you would display “Hello World” in Bash.
Create a text file called hello_world.sh
containing the following code:
#!/bin/bash # declare STRING variable STRING="Hello World" #print variable on a screen echo $STRING
Navigate to a directory where your hello_world.sh
is located and make the file executable:
$ chmod +x hello_world.sh
Now you are ready to execute your first bash script:
./hello_world.sh