Laravel Basic Routes

Laravel Basics

Now before we get started with creating our first Laravel Project, let’s discuss the basic to have an understanding of the framework.

Basic Routing

Routing is one of the essential concepts in Laravel. Routing in Laravel allows you to route all your application requests to its appropriate controller. The main and primary routes in Laravel acknowledge and accept a URI (Uniform Resource Identifier) along with a closure, given that it should have to be a simple and expressive way of routing. In this blog, you will learn about the routing concept of Laravel.

 

Create Routes in Laravel

All the routes in Laravel are defined within the route files that you can find in the routes sub-directory. These route files get loaded and generated automatically by Laravel framework. The application’s route file gets defined in app/Http/routes.php file. The general routing in Laravel for each of the possible request looks something like this:

The Default Route Files

All Laravel routes are defined in your route files, which are located in the routes directory. These files are automatically loaded by the framework. The routes/web.php  file defines routes that are for your web interface. These routes are assigned the web middleware group, which provides features like session state and CSRF protection. The routes in routes/api.php  are stateless and are assigned the api middleware group.

For most applications, you will begin by defining routes in your routes/web.php file. The routes defined in routes/web.php may be accessed by entering the defined route’s URL in your browser. For example, you may access the following route by navigating to http://your-app.test/user in your browser:

The Routing Mechanism In Laravel

The routing mechanism takes place in three different steps:

  1. First of all, you have to create and run the root URL of your project.
  2. The URL you run needs to be matched exactly with your method defined in the root.php file, and it will execute all related functions.
  3. The function invokes the template files. It then calls the view() function with the file name located in resources/views/, and eliminates the file extension blade.php at the time of calling.
 
Example:
app/Http/routes.php 

resources/view/laravel.blade.php

Route Parameters

In many cases, within your application, a situation arises when you had to capture the parameters send ahead through the URL. For using these passed parameters effectively, in Laravel, you have to change the routes.php code.

Laravel provides two ways of capturing the passed parameter:
  • Required parameter
  • Optional Parameter

Required Parameters

At times you had to work with a segment(s) of the URL (Uniform Resource Locator) in your project. Route parameters are encapsulated within {} (curly-braces) with alphabets inside. Let us take an example where you have to capture the ID of the customer or employee from the generated URL.
 
Example:
 

Optional Parameters

There are many parameters which do not remain present within the URL, but the developers had to use them. So such parameters get indicated by a ? (question mark sign) following the name of the parameter.

Example:

Available Router Methods

The router allows you to register routes that respond to any HTTP verb:

Redirect Routes

If you are defining a route that redirects to another URI, you may use the Route::redirect  method. This method provides a convenient shortcut so that you do not have to define a full route or controller for performing a simple redirect:

By default, Route::redirect returns a 302 status code. You may customize the status code using the optional third parameter:

You may use the Route::permanentRedirect  method to return a 301 status code:

What is CSS? And How Does It Relate to HMTL?

Topics to be covered

  • The difference between HTML and CSS
  • Getting acquainted with HTML elements, tags, and attributes
  • Setting up the structure of your first HTML and CSS web page
  • Getting acquainted with CSS selectors, properties, and values
  • Working with CSS selectors
  • Referencing CSS in your HTML

What Are HTML & CSS?

HTML, HyperText Markup Language, gives content structure and
meaning by defining that content as, for example, headings, paragraphs, or
images. CSS, or Cascading Style Sheets, is a presentation
language created to style the appearance of content—using, for example, fonts
or colors.

The two languages—HTML and CSS—are independent of one another and should
remain that way. CSS should not be written inside of an HTML document and vice
versa. As a rule, HTML will always represent content, and CSS will always
represent the appearance of that content.

With this understanding of the difference between HTML and CSS, let’s dive
into HTML in more detail.

Understanding Common HTML Terms

While getting started with HTML, you will likely encounter new—and often
strange—terms. Over time you will become more and more
familiar with all of them, but the three common HTML terms you should begin
with are elementstags, and attributes.

Elements

Elements are designators that define the structure and content of objects within a page. Some of the more frequently used elements include multiple levels of headings (identified as <h1> through <h6> elements) and paragraphs (identified as the <p> element); the list goes on to include the <a><div><span><strong>, and <em> elements, and many more.

Elements are identified by the use of less-than and greater-than angle brackets, < >, surrounding the element name. Thus, an element will look like the following:

<a>

Tags

The use of less-than and greater-than angle brackets surrounding an element
creates what is known as a tag. Tags most commonly occur in pairs
of opening and closing tags.

An opening tag marks the beginning of an element. It consists of a less-than sign followed by an element’s name, and then ends with a greater-than sign; for example, <div>.

closing tag marks the end of an element. It consists of a less-than sign followed by a forward slash and the element’s name, and then ends with a greater-than sign; for example, </div>.

The content that falls between the opening and closing tags is the content of that element. An anchor link (A web link that allows users to jump to a specific point on a website page.), for example, will have an opening tag of <a> and a closing tag of </a>. What falls between these two tags will be the content of the anchor link.

So, anchor tags will look a bit like this:            

<a>…</a>

Attributes

Attributes are properties used to provide additional information about an element. The most common attributes include the id attribute, which identifies an element; the class attribute, which classifies an element; the src attribute, which specifies a source for embeddable content; and the href attribute, which provides a hyperlink reference to a linked resource.

Attributes are defined within the opening tag, after an element’s name. Generally attributes include a name and a value. The format for these attributes consists of the attribute name followed by an equals sign and then a quoted attribute value. For example, an <a> element including an href attribute would look like the following:

<a href=”http://shayhowe.com/”>Shay Howe</a>

Common HTML Terms Demo

The preceding code will display the text “Shay Howe” on the web page and will take users to http://shayhowe.com/ upon clicking the “Shay Howe” text. The anchor element is declared with the opening <a> and closing </a> tags surrounding the text, and the hyperlink reference attribute and value are declared with href="http://shayhowe.com" in the opening tag.

Fig 1

HTML
syntax outline including an element, attribute, and tag

Now that you know what HTML elements, tags, and attributes are, let’s take a
look at putting together our first web page. If anything looks new here, no
worries—we’ll decipher it as we go.

Setting Up the HTML Document Structure

HTML documents are plain text documents saved with an .html file extension rather than a .txt file extension.

To begin writing HTML, you first need a plain text editor that you are
comfortable with like the one mentioned on our previous discussion. This does
not include Microsoft Word or Pages, as those are rich text editors

All HTML documents have a required structure that includes the following declaration and elements: <!DOCTYPE html><html><head>, and <body>.

The document type declaration, or <!DOCTYPE html>, informs web browsers which version of HTML is being used and is placed at the very beginning of the HTML document. Because we’ll be using the latest version of HTML, our document type declaration is simply <!DOCTYPE html>. Following the document type declaration, the <html> element signifies the beginning of the document.

Inside the <html> element, the <head> element identifies the top of the document, including any metadata (accompanying information about the page). The content inside the <head> element is not displayed on the web page itself. Instead, it may include the document title (which is displayed on the title bar in the browser window), links to any external files, or any other beneficial metadata.

Example of Title on a web browser

All of the visible content within the web page will fall within the <body> element. A breakdown of a typical HTML document structure looks like this:

<!DOCTYPE html>
<html lang=”en”>
<head>    
<meta charset=”utf-8″> 
<title>Hello World</title>  
</head>
 <body>    
<h1>Hello World</h1>    
<p>This is a web page.</p>  
</body>
</html>

HTML Document Structure Demo

The preceding code shows the document beginning with the document type declaration, <!DOCTYPE html>, followed directly by the <html> element. Inside the <html> element come the <head> and <body> elements. The <head> element includes the character encoding of the page via the <meta charset="utf-8"> tag and the title of the document via the <title> element. The <body> element includes a heading via the <h1> element and a paragraph via the <p> element. Because both the heading and paragraph are nested within the <body> element, they are visible on the web page.

When an element is placed inside of another element, also known as nested, it is a good idea to indent that element to keep the document structure well organized and legible. In the previous code, both the <head> and <body> elements were nested—and indented—inside the <html> element. The pattern of indenting for elements continues as new elements are added inside the <head> and <body> elements.

Self-Closing Elements

In the previous example, the <meta> element had only one tag and didn’t include a closing tag. Fear not, this was intentional. Not all elements consist of opening and closing tags. Some elements simply receive their content or behaviour from attributes within a single tag. The <meta> element is one of these elements. The content of the previous <meta> element is assigned with the use of the charset attribute and value. Other common selfclosing elements include

  • <br>
  • <embed>
  • <hr>
  • <img>
  • <input>
  • <link>
  • <meta>
  • <param>
  • <source>
  • <wbr>

The structure outlined here, making use of the <!DOCTYPE html> document type and <html><head>, and <body> elements, is quite common. We’ll want to keep this document structure handy, as we’ll be using it often as we create new HTML documents.

In Practice

Refer back to our previous Discussion to start
a new HTML Document

  1. Let’s open our text editor, create a new file named index.html, and save it to a location we won’t forget.
  2. Within the index.html file, let’s add the document structure, including the <!DOCTYPE html> document type and the <html><head>, and <body> elements.
<!DOCTYPE html>
<html lang=”en”>
 <head>  
</head>  
<body>
  </body>
</html>
  • Inside the <head> element, let’s add <meta> and <title> elements. The <meta> element should include the proper charset attribute and value, while the <title> element should contain the title of the page—let’s say “Styles Conference.”
<head>
 <meta charset=”utf-8″>
 <title>Styles Conference</title>
</head>
  • Inside the <body> element, let’s add <h1> and <p> elements. The <h1> element should include the heading we wish to include—let’s use “Styles Conference” again—and the <p> element should include a simple paragraph to introduce our conference.
<body>  
<h1>Styles Conference</h1>
 <p>Every year the brightest web designers and front-end developer descend on Chicago to discuss the latest technologies.
Join us this August!</p>
</body>
  1. Now it’s
    time to see how you’ve done! Find your index.html file Double-clicking this
    file or dragging it into a web browser will open it for us to review.
Fig 1

first
steps into building our Styles Conference website

Let’s switch gears a bit, moving away from HTML, and take a look at CSS.  

Remember, HTML will define the content and structure of our web pages, while CSS will define the visual style and appearance of our web pages.

Understanding Common CSS Terms

In addition to HTML terms, there are a few common CSS terms you will want to familiarize
yourself with. These terms include selectorsproperties,
and values. As with the HTML terminology, the more you work with
CSS, the more these terms will become second nature.

Selectors

As elements are added to a web page, they may be styled using CSS. A selector labels
exactly which element or elements within our HTML to target and apply styles
(such as color, size, and position) to. Selectors may include a combination of
different qualifiers to select unique elements, all depending on how specific
we wish to be. For example, we may want to select every paragraph on a page, or
we may want to select only one specific paragraph on a page.

Selectors generally target an attribute value, such as an id or class value, or target the type of element, such as <h1> or <p>.

Within CSS, selectors are followed with curly brackets, {}, which encompass the styles to be applied to the selected element. The selector here is targeting all <p> elements.

p { … }

Properties

Once an element is selected, a property determines the styles that will be applied to that element. Property names fall after a selector, within the curly brackets, {}, and immediately preceding a colon, :. There are numerous properties we can use, such as backgroundcolorfont-sizeheight, and width, and new properties are often added. In the following code, we are defining the color and font-size properties to be applied to all <p> elements.

p {  
color: …;  
font-size: …;
}

Values

Values can be identified as the text between the colon, :, and semicolon, ;. Here we are selecting all <p> elements and setting the value of the color property to be orange and the value of the font-size property to be 16 pixels.

p {  
color: orange;
  font-size: 16px;
}

To review, in CSS our rule set begins with the selector, which is
immediately followed by curly brackets. Within these curly brackets are
declarations consisting of property and value pairs. Each declaration begins
with a property, which is followed by a colon, the property value, and finally
a semicolon.

It is a common practice to indent property and value pairs within the curly brackets. As with HTML, these indentations help keep our code organized and legible.

CSS syntax outline including a selector, properties, and values

Knowing a few common terms and the general syntax of CSS is a great start,
but we have a few more items to learn before jumping in too deep. Specifically,
we need to take a closer look at how selectors work within CSS.

Working with Selectors

Selectors, as previously mentioned, indicate which HTML elements are being
styled. It is important to fully understand how to use selectors. The first
step is to become familiar with the different types of selectors. We’ll start
with the most common selectors: typeclass, and ID selectors.

Type Selectors

Type selectors target elements by their element type. For example, should we wish to target all division elements, <div>, we would use a type selector of div. The following code shows a type selector for division elements as well as the corresponding HTML it selects.

CSS
div { … }
HTML
<div>…</div>       
<div>…</div>

Class Selectors

Class selectors allow us to select an element based on the element’s class attribute value. Class selectors are a little more specific than type selectors, as they select a particular group of elements rather than all elements of one type.

Class selectors allow us to apply the same styles to different elements at
once by using the same class attribute value across
multiple elements.

Within CSS, classes are denoted by a leading period, ., followed by the class attribute value. Here the class selector will select any element containing the class attribute value of awesome, including both division and paragraph elements.

CSS

.awesome { … }

HTML

<div class=”awesome”>…</div>
<p class=”awesome”>…</p>

ID Selectors

ID selectors are even more specific than class selectors, as they target only one unique element at a time. Just as class selectors use an element’s class attribute value as the selector, ID selectors use an element’s id attribute value as a selector.

Regardless of which type of element they appear on, id attribute values can only be used once per page. If used they should be reserved for significant elements.

Within CSS, ID selectors are denoted by a leading hash sign, #, followed by the id attribute value. Here the ID selector will only select the element containing the id attribute value of shayhowe.

CSS

#shayhowe { … }

HTML

<div id=”shayhowe”>…</div>

Additional Selectors

Selectors are extremely powerful, and the selectors defined here are the
most common selectors we’ll come across. These selectors are also only the
beginning. Many more advanced
selectors
 exist and are readily available.

When you feel comfortable with these selectors, don’t be afraid to look into
some of the more advanced selectors from W3schools: https://www.w3schools.com/ or
follow this direct link: https://www.w3schools.com/css/default.asp

All right, everything is starting to come together. We add elements to a
page inside our HTML, and we can then select those elements and apply styles to
them using CSS. Now let’s connect the dots between our HTML and CSS, and get
these two languages working together.

Referencing CSS

In order to get our CSS talking to our HTML, we need to reference our CSS file within our HTML. The best practice for referencing our CSS is to include all of our styles in a single external style sheet, which is referenced from within the <head> element of our HTML document. Using a single external style sheet allows us to use the same styles across an entire website and quickly make changes sitewide.

Other Options for Adding CSS

Other options for referencing CSS include using internal and inline styles.
You may come across these options in the wild, but they are generally frowned
upon, as they make updating websites cumbersome and unwieldy.

To create our external CSS style sheet, we’ll want to use our text editor of choice again to create a new plain text file with a .css file extension. Our CSS file should be saved within the same folder, or a subfolder, where our HTML file is located.

Within the <head> element of the HTML document, the <link> element is used to define the relationship between the HTML file and the CSS file. Because we are linking to CSS, we use the rel attribute with a value of stylesheet to specify their relationship. Furthermore, the href (or hyperlink reference) attribute is used to identify the location, or path, of the CSS file.

Consider the following example of an HTML document <head> element that references a single external style sheet.

<head>  
<link rel=”stylesheet” href=”main.css”>
</head>

In order for the CSS to render correctly, the path of the href attribute value must directly correlate to where our CSS file is saved. In the example above, the main.css file is stored within the same location as the HTML file, also known as the root directory.

If our CSS file is within a subdirectory or subfolder, the href attribute
value needs to correlate to this path accordingly.

For example, if our main.css file were stored within a subdirectory named stylesheets, the href attribute value would be stylesheets/main.css, using a forward slash to indicate moving into a subdirectory.

At this point our pages are starting to come to life, slowly but surely. We haven’t explored into CSS too much, but you may have noticed that some elements have default styles we haven’t declared within our CSS. That is the browser imposing its own preferred CSS styles for those elements.

We have discussed the basics of CSS and how they can be applied to HTML. We are diving deep into the syntax and elements, and also creating our static website in next discussion.

What is 4IR

There’s a lot of talk about the 4th Industrial Revolution, one of the current buzz words going on today, hash tags like #4IR #4IRSA and many others, and everyone else keeps on asking, “What is this 4IR?”. And this blog is all about introducing the 4th industrial revolution. Interested, keep on reading…

Fourth Industrial Revolution (4IR) is not just an abstract concept. It’s the 4th cycle of the industrialists. So, I guess the first thing to speak about is, what is these industrial revolution all about?

The Industrial Revolution marks a major turning point in history; almost every aspect of daily life was influenced in some way. In particular, average income and population began to exhibit unprecedented sustained growth. Some economists say that the major effect of the Industrial Revolution was that the standard of living for the general population in the western world began to increase consistently for the first time in history, although others have said that it did not begin to meaningfully improve until the late 19th and 20th centuries.

Summary of the revolutions

·      In this story, the first era is the period of natural production, lasting from the dawn of the human species approximately 300,000 years ago and continuing until approximately 10,000 years in the past. During this period, humans consumed the bounty of nature and were shaped by the natural world.

 

·      The second era is the period of sustainable food production, rising with the development of agriculture sometime around 9,000 BC and extending to the middle of the 18th century. In this era, humans and their eventually domesticated animal companions used their physical strength and intellectual skills to create the infrastructure and production necessary to nourish larger, less transient human settlements. Some examples of this era include seasonal farming, irrigation systems, and food-storage facilities.

 

·      The third era is the period of industrialized labour, rising with the energy-saving inventions of the 18th century, such as the steam engine and the water-powered spinning frame for textile mills. This fundamentally new era represented the dehumanization of physical strength. After the development of the first machines, systems began outcompeting humans and domesticated animals in every area where brute strength and physical prowess were the critical components of production. The result was that humans had to either compete with machines on price, or switch to new, more intellectual forms of labour in order to produce the goods and services consumed by society.

·      The fourth era is the period of industrialized intelligence, rising with the mental-energy-saving inventions of the mid-20th century and continuing through today. Much as the industrial revolution dehumanized biological strength with machines, the displacement of biological intelligence with computers represents the dehumanization of intellectual labour.  Projecting current techniques a few years forward suggests that autonomous systems will eventually be capable of outcompeting humans in every area where intelligence is the key component of production.

4IR technologies?

keep close, we’ll talk about that in our next post …

How to create my first web page using html.

WHAT IS HTML

HTML stands
for Hyper Text Markup Language,
it is the standard markup language for creating Web pages. HTML
IS not a programming language it is rather a Markup language for creating
webpages/documents. Hypertext refers to the hyperlink that an HTML page
contain. Markup Language refers to the way the  tags are used to define the way the tags are used
to define the page layout and elements within the page. HTML elements are
the building blocks of HTML pages and they are represented by <>
tags.

WHAT DO YOU NEED TO START creating webpages with HTML

  • You need internet connection
  • A web browser of your choice (google Chrome, Mozilla
    Firefox, Safari. Or Edge)
  • A text editor of your choice(sublime text, Atom.io,
    Visual Studio Code, Brackets, Notepad++ for windows and  texmate for Mac)
  • Creating a html file does not need a server
  • Files must end with .hml file extension

What can you do with HTML

  • Publish online documents with headings, text, tables,
    lists, photos, etc.
  • Retrieve online information via hypertext links, at
    the click of a button.
  • Design forms for conducting transactions with remote
    services, for use in searching for information, making reservations, ordering
    products, etc.
  • Include spread-sheets, video clips, sound clips, and
    other applications directly in their documents.

I will take you through a typical html website with No style, styling is usably done with CSS which will be cover in the next discussion.

Follow the Steps below to create your first Html page:

Step 1: Open Notepad (PC)

Windows 8 or later:

Open the Start Screen (the window symbol at the bottom left on your screen). Type Notepad.

Windows 7 or earlier:

Open Start > Programs > Accessories > Notepad

Step 1: Open TextEdit (Mac)

Open Finder > Applications > TextEdit

Also change some preferences to get the application to save files correctly. In Preferences > Format > choose “Plain Text”

Then under “Open and Save”, check the box that says “Display HTML files as HTML code instead of formatted text”.

Then open a new document to place the code.

Step 2: Write Some HTML

Write or copy some HTML into Notepad.

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>

Step 3: Save the HTML Page

Save the file on your computer. Select File > Save as in the Notepad menu.

Name the file “index.htm” and set the encoding to UTF-8 (which is the preferred encoding for HTML files).

Step 4: View the HTML Page in Your Browser

Open the saved HTML file in your favorite browser (double click on the file, or right-click – and choose “Open with”).

The result will look much like this:

That is basically it, we will dive deep into styling our pages in he next discussion. i hope this will be useful.

How to set up Laravel.

Requirements PHP >= 5.5.9

Install Xampp

First of all, we need Xampp, so we can download it from the official page:
Download Xampp

Composer

After you’ve downloaded and installed Xampp, we need to install Composer.

Composer is a PHP package manager that is integrated with Laravel Framework. In Windows we can install it easy going to the official page and download the installer.

Composer Download page

Xampp Virtual Host

We will configure a Virtual Host in Xampp for a Laravel project, and in this example, we want to configure the domain laravel.dev for our project.

We need to edit httpd-vhosts.conf that is located in C:\xampp\apache\conf\extra\httpd-vhosts.conf and add following lines at the end of the file:

# VirtualHost for LARAVEL.DEV

DocumentRoot “C:\xampp\htdocs\laravel\public”

ServerAdmin laravel.dev “C:\xampp\htdocs\laravel”>

Options Indexes FollowSymLinks AllowOverride All Require all granted

After this, our apache is listening to laravel.dev connections, but we have to configure our hosts file that allows to redirect laravel.dev to the localhost that is located in C:\Windows\System32\drivers\etc

IMPORTANT!: To edit this file, maybe we should give access, click properties and allow your user to modify this file.
Edit hosts file adding our localhost for laravel.dev:

# localhost name resolution is handled within DNS itself.

# 127.0.0.1 localhost

# ::1 localhost 127.0.0.1 laravel.dev

Save the file and we are ready to install laravel.

Install Laravel Framework

We are prepared to install and configure a Laravel Framework. First of all, we have to navigate to htdocs folder to install it and run this following command:

composer create-project laravel/laravel laravel “5.1.*”

Will start the installation of the Framework:

When it finishes, it will create following directory schema:

Finally, start our apache and MySql from Xampp control panel:

Success!

Navigate to laravel.dev and Laravel it’s installed!

HTML (Hyper text markup language)

html is the standard markup language for creating Web pages. it consists of a series of elements that tell the browser how to display contents (text, images and other forms of multimedia) on a webpage using specific htm tags. Commonly used HTML tags include <h1>, which describes a top-level heading; <h2>, which describes a second-level heading; <p> to describe a paragraph; <table>, which describes tabular data; and <ol>, which describes an ordered list of information.

Python vs Java

What is Python?

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. It’s high-level built-in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python’s simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.

Often, programmers fall in love with Python because of the increased productivity it provides. Since there is no compilation step, the edit-test-debug cycle is incredibly fast. Debugging Python programs is easy: a bug or bad input will never cause a segmentation fault. Instead, when the interpreter discovers an error, it raises an exception. When the program doesn’t catch the exception, the interpreter prints a stack trace. A source-level debugger allows inspection of local and global variables, evaluation of arbitrary expressions, setting breakpoints, stepping through the code a line at a time, and so on. The debugger is written in Python itself, testifying to Python’s introspective power. On the other hand, often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective.

See also some comparisons between Python and other languages.

Basic usage

The standard packaging tools are all designed to be used from the command line.

The following command will install the latest version of a module and its dependencies from the Python Packaging Index:

python -m pip install SomePackage

Note

For POSIX users (including Mac OS X and Linux users), the examples in this guide assume the use of a virtual environment.

For Windows users, the examples in this guide assume that the option to adjust the system PATH environment variable was selected when installing Python.

It’s also possible to specify an exact or minimum version directly on the command line. When using comparator operators such as >, < or some other special character which gets interpreted by the shell, the package name and the version should be enclosed within double quotes:

python -m pip install SomePackage==1.0.4    # specific version
python -m pip install "SomePackage>=1.0.4"  # minimum version

Normally, if a suitable module is already installed, attempting to install it again will have no effect. Upgrading existing modules must be requested explicitly:

python -m pip install --upgrade SomePackage

More information and resources regarding pip and its capabilities can be found in the Python Packaging User Guide.

Creation of virtual environments is done through the venv module. Installing packages into an active virtual environment uses the commands shown above.

How do I …?

These are quick answers or links for some common tasks.

… install pip in versions of Python prior to Python 3.4?

Python only started bundling pip with Python 3.4. For earlier versions, pip needs to be “bootstrapped” as described in the Python Packaging User Guide.

… install packages just for the current user?

Passing the --user option to python -m pip install will install a package just for the current user, rather than for all users of the system.

… install scientific Python packages?

A number of scientific Python packages have complex binary dependencies, and aren’t currently easy to install using pip directly. At this point in time, it will often be easier for users to install these packages by other means rather than attempting to install them with pip.

… work with multiple versions of Python installed in parallel?

On Linux, Mac OS X, and other POSIX systems, use the versioned Python commands in combination with the -m switch to run the appropriate copy of pip:

python2   -m pip install SomePackage  # default Python 2
python2.7 -m pip install SomePackage  # specifically Python 2.7
python3   -m pip install SomePackage  # default Python 3
python3.4 -m pip install SomePackage  # specifically Python 3.4

Appropriately versioned pip commands may also be available.

On Windows, use the py Python launcher in combination with the -m switch:

py -2   -m pip install SomePackage  # default Python 2
py -2.7 -m pip install SomePackage  # specifically Python 2.7
py -3   -m pip install SomePackage  # default Python 3
py -3.4 -m pip install SomePackage  # specifically Python 3.4

Common installation issues

Installing into the system Python on Linux

On Linux systems, a Python installation will typically be included as part of the distribution. Installing into this Python installation requires root access to the system, and may interfere with the operation of the system package manager and other components of the system if a component is unexpectedly upgraded using pip.

On such systems, it is often better to use a virtual environment or a per-user installation when installing packages with pip.

Pip not installed

It is possible that pip does not get installed by default. One potential fix is:

python -m ensurepip --default-pip

There are also additional resources for installing pip.

Installing binary extensions

Python has typically relied heavily on source-based distribution, with end-users being expected to compile extension modules from source as part of the installation process.

With the introduction of support for the binary wheel format, and the ability to publish wheels for at least Windows and Mac OS X through the Python Packaging Index, this problem is expected to diminish over time, as users are more regularly able to install pre-built extensions rather than needing to build them themselves.

Some of the solutions for installing scientific software that are not yet available as pre-built wheel files may also help with obtaining other binary extensions without needing to build them locally.

Hello, World!

Python is a very simple language and has a very straightforward syntax. It encourages programmers to program without boilerplate (prepared) code. The simplest directive in Python is the “print” directive – it simply prints out a line (and also includes a newline, unlike in C).

There are two major Python versions, Python 2 and Python 3. Python 2 and 3 are quite different. This tutorial uses Python 3 because it more semantically correct and supports newer features.

For example, one difference between Python 2 and 3 is the print statement. In Python 2, the “print” statement is not a function, and therefore it is invoked without parentheses. However, in Python 3, it is a function, and must be invoked with parentheses.

To print a string in Python 3, just write:

print("Hello, World!")

You can just as easily store a string as a variable and then print it to stdout:

my_string = "Hello, World!"
print(my_string)

The above code will print Hello, World! on your screen. Try it yourself in the editor below!

Input Format

You do not need to read any input in this challenge.

Output Format

Print Hello, World! to stdout.

Sample Output:
Hello, World!

 

What is Java? Executive Summary

Java produces applets (browser-run programs), which facilitate graphical user interface (GUI) and object interaction by Internet users. Prior to Java applets, Web pages were typically static and non-interactive. Java applets have diminished in popularity with the release of competing products, such as Adobe Flash and Microsoft Silverlight.

Java applets run in a Web browser with Java Virtual Machine (JVM), which translates Java bytecode into native processor instructions and allows indirect OS or platform program execution. JVM provides the majority of components needed to run bytecode, which is usually smaller than executable programs written through other programming languages. Bytecode cannot run if a system lacks required JVM.

Java program development requires a Java software development kit (SDK) that typically includes a compiler, interpreter, documentation generator and other tools used to produce a complete application.

Development time may be accelerated through the use of integrated development environments (IDE) – such as JBuilder, Netbeans, Eclipse or JCreator. IDEs facilitate the development of GUIs, which include buttons, text boxes, panels, frames, scrollbars and other objects via drag-and-drop and point-and-click actions.

Java programs are found in desktops, servers, mobile devices, smart cards and Blu-ray Discs (BD).

 

 

What is Java used for?

Before I answer the question, what is Java used for, let me brief you about why you should choose Java. Java is highly popular and has dominated this field from early 2000’s till the present 2018. 

Java has been used in different domains. Some of them are listed below:

  • Banking: To deal with transaction management.
  • Retail: Billing applications that you see in a store/restaurant are completely written in Java.
  • Information Technology: Java is designed to solve implementation dependencies.
  • Android: Applications are either written in Java or use Java API.
  • Financial services: It is used in server-side applications.
  • Stock market: To write algorithms as to which company they should invest in.  
  • Big Data: Hadoop MapReduce framework is written using Java.
  • Scientific and Research Community: To deal with huge amount of data.               

Beginning Java programming with Hello World Example

The process of Java programming can be simplified into three steps:

  • Create the program by typing it into a text editor and saving it to a file – 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.

 

Below given program is the simplest program of Java printing “Hello World” to the screen. Let us try to understand every bit of code step by step.

/* This is a simple Java program.
FileName : "HelloWorld.java". */
class HelloWorld
{
// Your program begins with a call to main().
// Prints "Hello, World" to the terminal window.
public static void main(String args[])
{
System.out.println("Hello, World");
}
}

Output:

Hello, World

The “Hello World!” program consists of three primary components: the HelloWorld class definition, the method main and source code comments. Following explanation will provide you with a basic understanding of the code:

  1. Class definition: This line uses the keyword class to declare that a new class is being defined.
    class HelloWorld 
    

    HelloWorld is an identifier that is the name of the class. The entire class definition, including all of its members, will be between the opening curly brace  {  and the closing curly brace } .

  2. main method: In Java programming language, every application must contain a main method whose signature is:
    public static void main(String[] args)
    
    public: So that JVM can execute the method from anywhere.
    static: Main method is to be called without object. 
    The modifiers public and static can be written in either order.
    void: The main method doesn't return anything.
    main(): Name configured in the JVM.
    String[]: The main method accepts a single argument: 
              an array of elements of type String.

    Like in C/C++, main method is the entry point for your application and will subsequently invoke all the other methods required by your program.

  3. The next line of code is shown here. Notice that it occurs inside main( ).
    System.out.println("Hello, World");
    

    T his line outputs the string “Hello, World” followed by a new line on the screen. Output is actually accomplished by the built-in println( ) method. System is a predefined class that provides access to the system, and out is the variable of type output stream that is connected to the console.

  4. Comments: They can either be multi-line or single-line comments.
    /* This is a simple Java program. 
    Call this file "HelloWorld.java". */
    

    This is a multiline comment. This type of comment must begin with /* and end with */. For a single line, you may directly use // as in C/C++.

Important Points :

  • The name of the class defined by the program is HelloWorld, which is same as the name of the file(HelloWorld.java). This is not a coincidence. In Java, all codes must reside inside a class and there is at most one public class which contain main() method.
  • By convention, the name of the main class(class which contain main method) should match the name of the file that holds the program.

Compiling the program :

  • After successfully setting up the environment, we can open ta terminal in both Windows/Unix and can go to the directory where the file – HelloWorld.java is present.
  • Now, to compile the HelloWorld program, execute the compiler – javac , specifying the name of the source file on the command line, as shown:
    javac HelloWorld.java 
    
  • The compiler creates a file called HelloWorld.class (in present working directory) that contains the bytecode version of the program. Now, to execute our program, JVM(Java Virtual Machine) needs to be called using java, specifying the name of the class file on the command line, as shown:
    java HelloWorld
    

    This will print “Hello World” to the terminal screen.

Python vs Java Comparison Summary

Here’s a quick comparison between the two languages we discussed.

Technology Python Java
Popularity Very popular Very popular
Syntax Easy to learn and use Complex includes a learning curve
Performance Slower than Java in various implementations Relatively very fast
Cross-Platform Yes Yes, thanks to the JVM
Backend Frameworks Django, Flask Spring, Blade
Machine Learning Libraries Tensorflow, Pytorch, Weka, Mallet, Deeplearning4j, MOA
Game Development Engines Cocos, Panda3d JMonkeyEngine

Java and Python are both capable and popular languages, so there won’t be a lack of resources once you choose one and embark on your journey. If you’re new to programming, it’d be better to stick with Python just because it’s really easy and uses English-like syntax, it’s used in many Computer Science introductory courses around the world. However, if your goal is to build enterprise-level applications coming from a C/ C++ world, then Java would probably feel pretty familiar to you. It all goes down on what you plan to build and where you feel like journeying with your new skill.

PHP & Laravel.

What is laravel?

Laravel is a powerful web framework used for PHP application development. Utilizing model–view–controller (MVC) architecture. The framework aims to enhance the workflow of web developers with user authentication, database connection, and other unique utilities.

Laravel web development is well known to have been used in creating personalized web software in a quick and efficient way.

Reasons why Laravel web development is the Best PHP Framework?                                             

PHP has been known as the popular server scripting language around the world in the companies that develop Softwares.

Authorization and Program Logic Technique.

The key important part of any web app is the authentication part and with the knowledge of how much time coders do take to develop authentication computer code. It helps in arranging authorization logic and controls access to resources. With the latest Laravel design, the validation computer code is included. It has reduced the time taken to create codes. Application reasoning in Laravel has already been implemented in every software that uses controllers in making a route to declarations by the use of syntax. This framework provides flexibility to coders they need to build everything from the range of small websites to the useful business Softwares.

Artisan.

This is a tool provided by Laravel web development. Programmer interacts with the framework by the use of a command line that is entitled to the creation and management of the Laravel web development project environment. Artisan is a built-in tool provided by Laravel. Alon with this tool, we can perform majorly the repetitive and most tiresome programming tasks that programmers mostly avoid to come up with.

Migration System Databases.

On this feature, migration does help one to increase the database structure of the software without recreating each time a change is made. With this, chances to lose codes is avoided. Laravel provides the service of changing the structure and lets us do it by the use of PHP code instead of the structured query language(SQL) which is a language used to communicate with the database. Laravel Schema allows one to build database tables and insertion of columns as well as indices. This makes us consider the Laravel schema builder as a version that has control over one’s database.

These types of features mentioned above are simply a variety of them that do make Laravel be considered the best PHP framework. The progress and achievements made on Laravel web development for the past years are known thus making it the best so far web development framework.