Key reasons why you should start to learn Python, from a Python nerd perspective

Having started Python computer programming language in my teens, it is lately that I am seeing the fruits to it . As almost everything is getting automated by a computer technology behind it, coding is becoming a necessity, especially for those who want to learn how things work under the hood.

Since a little child, I have had the desire of owning a personal computer and giving it commands to run stuff. Although not a professional programmer, finally I can easily automate tasks on my personal computer with the help of different software technologies such as bash scripting, terminal utilities and for sure Python.

Those who are totally unaware of the programming technologies and their specific usage, have all the reasons to ask why it is important for one to start and learn a computer programming language. Being a computer nerd, through this article, I am going to share the key reasons why it is important for one to start and learn Python programming language.

Before giving one the key reasons on why they should start and learn the Python computer programming language, let me share a few words about the technology itself.

Python technology explained shortly for complete beginners

Python is a high level scripting language widely used by professional software developers all over the world. It offers rapid development due to its high level nature, and many startups  make use of it for prototyping. Not only is Python used in big projects and large codebases, but it is also being utilized by system administrators  in the automation of their daily tasks.

As an interpreted computer programming language, Python is very beginner friendly as it helps one test and run their code interactively in their Python shell.

Giants such as Google and Youtube make heavy usage of the Python programming language, they have projects which depend entirely on such computer coding technology.

Not only is Python computer programming language being used to create Desktop based apps, but also in the web development industry with frameworks such as django, flask, pyramid, plone and many others.

Key reasons why one should start to learn Python programming

There are many reasons why one should learn a computer programming language such as Python, but through this article we are going to provide you guys the key ones, all of them come from personal journey with Python coding.

Almost everything is getting automated

As everyone of us is experiencing it, lately the technology is automating almost every part of our lives, from shopping payments to private medical records. Computer software is being used to automate stuff in our daily lives, and code powers the software.

When one has knowledge on coding technology, it is easier for them to interact with software and even write their own scripts to automate tasks so they can avoid repeating themselves and also utilize their computer resources to the fullest.

Not only automation gets easier when one has knowledge on a specific coding technology, but understanding how things work under the hood becomes available to them. Most of the web projects on the Internet provide an API for the developers to interact with.

Python has many libraries which can be utilized to send requests on the Internet, making it really easy for one to interact with online applications available out there.

One can write their own utilities and computer programs in Python

Knowledge on a specific coding technology such as Python, provides one  the ability to write software which matches their specifics, in a very short time, since Python fits great for rapid development.

Python can be used to write simple scripts to solve practical problems, but if used properly by a skilled developer, large systems can be entirely powered by it.

Having intermediate knowledge on Python programming language, one can easily express themselves in computer code.

Python developers get paid to write professional code

Not only can Python help one to automate their computer tasks, but it can also make money to them. For one to get paid for their Python code, it takes time, as becoming a professional does not happen over night.

Personally, I have been paid for some Python code I have written and I can truly say that it is a great feeling to make money as a computer programmer.

Python is easy to learn

There are many coding technologies which if used properly can achieve the same things as Python, but as far as my experience goes, none of them is as beautiful as Python. Easy to learn, its beautiful syntax makes Python very easy to read. Not only it offers rapid development when it comes to software prototyping, but it also makes it easy to maintain the project’s codebase due to its readability.

To master the craft of Python development, for sure it takes a lot of time, not months, but years! For one to learn the basics and level up to an intermediate position, three months is enough.

Python has the most welcoming community

There are computer geeks worldwide that make use of Python technology in their software development projects. Not only are they skilled with the latest Python tips and hacks for professionals, but they have deep love for the community. Back in 2013, I had the chance to attend EuroPython, a conference in which developers from all over the world gather with the main purpose of sharing their experience with the Python coding technology.

Some of the most beautiful days of my life! The Python community is very welcoming, it’s like a good heart which shares love without conditions constantly. And it does not stop!

Python is free as in beer, and OpenSource

One doesn’t have to purchase any license to make use of the official Python technology. Anyone can easily download the latest Python interpreter from the official website and start to experiment on their own. Not only is Python free as in beer, but it is also open source, which means that the code which composes it, is available for the public to study.

Nowadays, it is really important that people use open technologies as there is a lot of mass surveillance going on. It is always a good idea to know how things work under the hood, only this way one can be aware of what really goes on while working with their computer.

Python has a great support on the Internet

When one starts their coding journey, it is normal for them to get stuck on different parts of the entire experience. Having been stuck myself with all kinds of errors produced by the Interpreter, I know how it feels. I have experienced the struggle of a complete Python beginner.

Fortunately for those who is interested in learning computer programming with Python, there is so many useful tutorials on the Internet, which can be used to advance skills on the coding journey.

There is also many books written about Python programming language, especially for complete beginners who need support more than anyone else on their computer programming journey.

Final thoughts

Nothing comes easy in this life. Hard work and dedication is the key, especially in the beginning. Being a Python nerd myself, I have experienced very bad days debugging all kinds of errors thrown by the projects I used to write on my own free time.

As a technology, Python fits perfectly the needs of the beginner programmer.

How to write and execute a simple Python script on Mac OS X, for complete beginners

Lately there is many people who want to learn computer programming and their first choice is to start with Python, a scripting language which can be easily utilized to automate different tasks such as scraping web pages on the Internet, interacting with public APIs and even pulling data our of your .excel documents.

Being a Python nerd myself, it makes me very happy to see new comers to the technology as the more coders make use of it, the higher is the chance it lives really long.

About Python

Python is a high level computer programming language which offers the professional programmer the necessary tools required to prototype and build computer software. Completely open source and free as in beer, it is widely used by software engineers all over world. Giants like Google and Youtube make use of Python computer programming language too, in fact they have big systems which depend heavily on Python code.

Not only already established companies make use of Python, but startups too, as the Python technology offers the right tools needed for doing rapid development and prototyping.

Python is not hard, but truth is that it is not easy as most of the newbies make it. One has to code a real project before giving any opinion on the difficulty of the programming language.

The first time I got introduced to Python code it felt like I was reading myself, my personal thoughts materialized in a computer technology.

Enough words, time for some action.

You need a Python interpreter to execute Python code

Python is an interpreted programming language, which means that for one to execute Python code on their local machine, they have to make sure they have the official interpreter. Fortunately for you guys, in Mac OS X computers, Python is shipped by default.

To make sure you have Python already installed on your Mac OS X machine, go to Launchpad, search for the terminal and after you have opened it, type the following command.

python

After the above command is executed on your Mac OS X, if everything goes fine, the following will come up.

The stuff shown in the above screenshot comes from the Python interpreter.

Execute you first Python line code

To execute Python code in the interpreter all one has to do is type the line of code and then hit Return button. In Python, code is being executed line by line. As far as I know there is two ways to run Python code, interactively and  script mode.

Once one launches Python shell from their terminal, the interactive mode of executing code is being activated.

Type the following in your Python shell and hit Return.

1 + 2

The following comes up.

If everything has worked correctly, you have successfully executed your first Python line code. As it is seen from the above example executed in the Python shell, when one works in interactive mode, every line of code produces an immediate result. The good thing about working with Python in interactive mode is the fact that one can easily test pieces of code and see for themselves what they do.

Interactive mode code execution, is a Python feature which I truly love as not only it does help one to test and play with parts of their code, but it is very useful for the beginners too.

Some Python basics needed to write the script

One important part of programming languages is the variables which is being used to keep track of data. One can easily declare variables in Python programming language by using the following syntax.

a = 5

The above variable links to data of type int, to an integer. There is many other data types supported in Python such as strings, floating point, list, tuple and dictionary.

b = 13.0 # a floating point

The above variable b, links to a floating point object. To experiment a little bit in the Python interactive shell, run the following arithmetic operation.

a + b

 

Python supports arithmetic operations by default. Other data types important for one during their Python coder journey is list and tuple.

A list is used to store objects of various data types. The following is the syntax for declaring a list.

l = []

Perfect for storing different objects, the list data type supports indexing which can be used to access its elements.

Declare another list in Python interactive shell like shown below.

l = [1, ‘liberiangeek’, 1.0]

For one to access the elements of the list, indexing operations can be used. The first element has an index of 0.

l[0]

It should produce the following result.

1

The second element of the list can be accessed with the following syntax.

l[1]

The following result should come after executing the above Python code in the interactive shell.

‘liberiangeek’

Fact is that list objects can change in time, elements can be added to and removed from them.

To add an element inside a Python list, the list specific method should be used like shown below.

l.append(‘new_element’)

Once the above code is being executed in the Python interactive shell, the list should be updated.

To verify is the list is updated or not, do the following check.

l

On the other hand, tuples is similar to lists, but the main difference is that they don’t change in time.

A tuple is declared with the following syntax.

t = () # this is a tuple

Same as lists, tuples support indexing too.

t = (1, 2, 3)

t [0]

Write the Python script

Any script written in Python should end in the .py extension, and it is called a module. For example, for the purpose of this tutorial, I am going to create the following text document in my text editor and then save it as a Python file.

liberiangeek.py

First thing I recommend right now for the level of knowledge you possess, is to comment the script, so you can easily understand its purpose when referring to it in the future.

The following syntax can be used to write a comment in Python. Comments is being used to explain code, they don’t get interpreted by the interpreter, instead they get ignored as their purpose is to help the coder comment their code.

# this is a comment which explains the python script

After having written the above code in the Python script, save the file in a .py extension. The script is not finished yet, it’s purpose is to practice all the Python concepts being covered through this article.

Create two variables like shown below, and make sure to save the Python script again, so you can avoid losing your work in case of any problems with your computer.

Then try to write a simple arithmetic operation in the script, like shown below.

c = a + b

Once you have written all the code above and saved the script, declare a list like shown below, and pull the first element out of it by indexing.

l = [‘liberiangeek’, ‘python’, ‘coder’]

first_el_of_list = l[0]

Before executing the Python script, there is a very important Python statement which we need to make use of, the print statement. It helps one to display output on the console.

Add the following two lines in your script, and you are done.

print(c)

print(first_el_of_list)

Execute the Python script

Before running the script it is very important that the working directory on your terminal, matches the path where the script is being stored. Mine is placed on /Users/Oltjano/Desktop/liberiangeek.py.

The following command is used to execute a Python script from the Mac OS X terminal.

python liberiangeek.py

Final thoughts

Executing a Python script on local Mac OS X is truly easy as the machine offers the interpreter by default, but those who have no idea about Python code, get usually stuck when they have to run a script.

How to execute a PHP script on your local Mac OS X by using AMPPS

PHP is a very useful tool when it comes to writing scripts for handling automation on the web, and it is widely used by Webmasters and web developers. Free as in beer and open source, a scripting language like PHP is worth learning, especially if one is interested in creating web applications.

The purpose of this tutorial, is to give one some basics of PHP and also help them create a script and then run it on their Mac OS X computer through a local web server, such as Apache of AMPPS.

Tools needed to execute a PHP script on local Mac OS X computer

Before going any further, the first step in running code or scripts on a local machine, is the configuration of the environment which helps to use the specific technology one wants to run their code in.

There are two main tools one needs to download and setup on their local Mac OS X machine for running PHP code. The following is the two:

  • AMPPS
  • Text editor

AMPPS is a package for computer programmers, with many tools in it, such as Apache, PHP, Mysql and all the utilities required to build and run applications on a local environment. It is mostly used by those in the web development industry, as before pushing code on production servers, developers code and test it on their local machines first.

What about the Text editor utility? A script is being written in a text editor, so one needs a tool like it to write their computer program. Text editors range from very basic, to totally advanced ones, which only hardcore computer geeks know how to use.

For the purpose of this tutorial, I am going to use a text editor which comes installed by default on my Mac OS X machine. It is highly recommended that for advanced PHP projects, one should setup an advanced PHP coding editor, but for now let’s keep it simple.

A text editor found by default on Mac OS X is more than enough for keeping up with this tutorial.

Now that the identification and explanation of the tools one needs to run PHP code on their machine is done, it is time for their installation. AMPPS requires specific steps to be installed on Mac OS X, which we have provided in one of our previous tutorials. Please make sure to read it and follow every step so you can successfully manage to install and run AMPPS on your local computer. If you encounter any problem during the setup of AMPPS on your machine, please don’t hesitate to leave a comment, we would be happy to help.

Some PHP basics

Before executing a PHP script, it is necessarily for one to have a basic knowledge on what that script does.

The first thing one should learn during their beginning of the computer programming journey, is the variables and their purpose. From what I know, a variable is used to keep track of data so it can be used by the coder in their scripts.

PHP has a very easy to understand syntax for declaring variables. One has to follow the pattern shown below to write a variable in their own PHP scripts.

$a = 13;

The above piece of code, declares the variable a and gives it a value, which in this practical case, is 13.

Note the semi colon being used, every PHP statement should end in a ;. According to some research I did on the Internet, PHP supports the following data types, which can be used with variables.

  • Integers
  • Doubles
  • Booleans
  • NULL
  • Strings
  • Arrays
  • Objects
  • Resources

Another important thing one should master during their PHP coding journey, is the comments. Comments do not get executed as normal code, as their purpose is to help the programmer comment their code, so they can make it easier for themselves and others to understand what their software is doing in specific parts of the project.

The following is a comment in PHP scripting language.

// This is a comment in PHP

There is two main types of comments in PHP programming language, single line comments and multiline comments. The above is a single line comment.

 

A multiline comment is used to give detailed explanations to the projects. The following is the syntax for it.

/*

This is a detailed comment,

it gives one details about the php project

it has many lines, it is totally different

from a single line comment

*/

Another useful PHP tool you should master as a beginner, is the echo builtin statement, which can be used to print on the screen.

echo “Welcome to PHP coding journey”;

When properly executed through a PHP script, the above statement prints a message in the screen, a string.

Write the PHP script

The knowledge presented in this tutorial about some PHP basics, is enough to write a simple script, which serves the main purpose for which this tutorial was written in the first place.

Before moving on, you should keep in mind that a PHP script, should end in the following extension.

.php

The name of the script can be anything. For the purpose of this tutorial, I am going to name mine like shown below.

coderjourney.php

Now open your text editor, open a new file and save it as a .php file.

Open the PHP script with the following syntax.

<?php

// Single line comment

?>

The entire code goes inside the PHP declaring tags.

<?php

// Single line comment

// All code goes inside the tags

?>

The script of this tutorial, is going to greet the user with a message, giving them a warm welcome in their PHP coding journey. The echo statement is what we need to use for achieving the task.

<?php

// Single line comment

// All code goes inside the tags

echo “Welcome to PHP coding journey”;

?>

Make sure to save the file, as the script is finished. Although it is a very basic one, it fits the purpose of the tutorial.

Execute the PHP script

AMPPS can help to run the PHP script, we coded during this tutorial. First, make sure the Apache and Mysql servers is running without errors.

To run a PHP script in your local machine through AMPPS, one needs to place their script in a directory inside the www of AMPPS.

The www directory is usually found in Applications/AMPPS path, like shown below.

Now, create a new folder inside AMPPS/www, name it whatever you like, mine is going to be phpjourney.

Once you have created the folder, place the script in there, the same as shown below.

 Almost done, the hard work is completed. Now visit your localhost, by copying pasting the following url on your web browser.

http://127.0.0.1/

Then visit the directory where you saved your script, click on the script and see for yourself what really happens.

Final thoughts

The main purpose of this tutorial was to help those who is stuck with a PHP script on their machine, without any idea on how to run it. Lately a friend gave me a PHP project, because he had no idea how to execute it. And it inspired me to write this very useful tutorial, especially for those who don’t have a PHP coding background.

How to setup WordPress 4.9.5 with Divi framework on Mac OS X, first part

WordPress is the most effective tool when it comes to building blog communities on the Internet, or landing pages. As a web technology, it offers all kinds of tools and utilities one needs to manage and run a successful web application online.

The fact that WordPress is an open source technology, widely used by webmasters and bloggers worldwide, attracts a lot of web developers and coders which contribute their energy in different tools, mainly useful plugins that add up functionality to the WordPress content management system.

During this first part of the WordPress with Divi setup series, as a computer geek, you will have a fresh WordPress installation on your localhost, completely configured for web development. Let’s progress with the first step, which is the download of WordPress CMS from the official site.

Download and unpack WordPress on your local Mac OS X machine

Since WordPress content management system is open source and free as in beer, as an end user you don’t have to pay anything, but to keep the project alive I highly recommend that you do a small donation if that’s possible for you.

First, go to the official website of WordPress and check for the latest software available,  like shown in the screenshot published below.

Then click on Download WordPress 4.9.5. Once the installation is finished, it is required that you unzip the downloaded package so you can keep up with this detailed guide.

There is many free tools out there for Mac OS X to unzip .zip packages, the one which I am using daily on my own machine, is named Archive Utility. After having unzipped the WordPress 4.9.5 package, a folder with the complete WordPress files will be available on your computer like shown in the following screenshot.

If everything looks like in the screenshots, the first step of setting up WordPress on your local machine is successfully completed. Let’s continue with the next step.

Download and install ampps on your Mac OS X

For one to run WordPress on their localhost machine it is needed specific web development software such as ampps, which offers the local server and many other technologies such as PHP, Apache, Perl, MongoDB and MySQL.

The software can be easily dowloaded completely for free, the same as WordPress CMS.  All you have to do is visit this link and choose the right version for your machine, which in our case is ampps for Mac OS X. The following screenshot makes it easier for you when it comes to choosing the right version for your computer, especially if you are a total beginner.

The ampps package for Mac OS X comes as a .dmg file, which can be easily installed on your machine. Once the download is being finished, make sure to right click on the package and then hit Open.

The installer will present you with the following.

Drop and drag AMPPS into Applications and let the installer take care, like shown in the following screenshot.

If everything with the installation goes fine, AMPPS can be easily launched from the Launchpad, but you will probably run into the following security issue.

There is a solution of everything, at least that’s what I do believe with all my soul!  Instead what you need to do to open AMPPS, is to locate the app under Applications through Finder. Once you have located it, do a right click and click on Open like shown in the following screenshot.

The system requires your password. Type and it and click OK.

Once finished with success, the following will launch.

It is a gui toolkit which helps one monitor the services offered by AMPPS, is they running or not?

The Apache server is currently running, a simple test like going to localhost on your browser, can prove that.

Create domain name for your local website

Now that we are done with the installation of AMPPS on your local machine, it is time to create a fake domain which is going to serve as the url of your local web application.

Make sure to open a new tab in your browser and enter the following url, which links to the AMPPS application.

http://127.0.0.1/ampps/

The following dashboard will come up.

With the main purpose of pointing to your local web application through your web browser, so you can test while developing, it is important that you create a fake domain for your local web application.

To create and add a fake domain in AMPPS, click on Add Domain like shown in the following screenshot.

Once you have clicked on Add Domain, the following will come up.

Under the Domain, one is highly recommended that their name ends in one of the followings:

  • .test
  • .example
  • .invalid
  • .localhost

For the purpose of this tutorial, I am going to use wordpress.test, like shown in the following screenshot.

Click on Add Domain and this step is done.

Create and setup database for your WordPress application

Any database driven web application, needs a database to work. Since WordPress is one, it is a necessity to create a mysql database  through phpMyAdmin.

First, access the phpMyAdmin through the following url.

http://localhost/phpmyadmin

If the request is successful, the following will come up.

To create a fresh mysql database, click on New button which is located on the top left side of phpMyAdmin.

Choose a name for your mysql database and click on Create. For the purpose of this tutorial, I chose to name my mysql database wordpress_test.

The setup of database is done!

Setup WordPress with AMPPS

A quick request on the following url, shows the new fake domain which you added through your AMPPS dashboard.

http://127.0.0.1/

Select all the files being found inside WordPress CMS folder which you did download, and copy them under the following path.

/Applications/AMPPS/www/wordpress.test

The final directory look is shown below.

Once data is being copied, visit localhost through your web browser and then access the local web application via the fake domain which you created, in my case it is the following.

http://127.0.0.1/wordpress.test/

After a successful request on the above url, or in your specific one if different than mine, you will be presented with the following.

The above informs the user about the fact that they need to know their database credentials so wp-config.php file is automatically generated. No need to worry about it, just click on Let’s go!

The following comes up.

Fill the form according to the followings:

Database Name –> wordpress_test

Username–> root

Password–> mysql

Then click on Submit. Once finished, the following comes up which informs you about the installation.

We are almost done. There is a few quick and short steps we need to accomplish before finishing the complete setup of WordPress on your local machine.

Fill the form according to your preferences and then click on Install WordPress.


Everything has been completed, all you have to do to manage your web

application, is to login.

Final thoughts

WordPress is the perfect tool when it comes to building land pages or online communities on the Internet, especially for those who don’t like to code much. The next tutorial will cover the setup of Divi WordPress theme, a very practical framework, designed to ease the job of the front end developer.

Installing Spotify in Ubuntu 16.04

Spotify has become a popular choice for those looking to listen to music at any time and with the ability to stream and create playlists, it has become one of the more popular music apps. While many use Spotify on iOS or Android devices, it can also be installed on Ubuntu and will allow Linux users to reap the many benefits of this powerful music app. Linux may not be the most popular operating system being used, but with thousands making use of it, users will need to know how they can benefit from Spotify. The operating system is also great for any other internet actions, including playing at some of the best canadian casinos, which offer an amazing way to engage in life-like casino games for real money.

Overview of Spotify

Spotify is a Swedish streaming service
that has finally made its way to the United States and it offers the ability to stream music through computers and mobile devices. Spotify is a music radio streaming service, but it also comes with some amazing tools so that users can customize their listening experience. It allows users to create and share playlists as well as songs and all of this can be done through social media sites like Twitter and Facebook. It is quite similar to using the Apple iTunes software, offering access to more than 15 million songs.

The great thing about Spotify is that it can be used anywhere and it is completely free. The company moniker allows users to Spot and Identify songs they like. To get started with this great service one will just register for a free account. When Spotify was first offered it was by invitation only, but now with millions of users worldwide, it is one of the most popular music streaming services in the industry.

The main difference between Spotify and other internet radio services is that there is a download that must be performed. Once the software has been added to the hard drive, users can enjoy the great technology and gain access to thousands of the most popular songs. While most users will choose the free version, Spotify also has two paid versions that can be enjoyed. The Spotify Premium and Spotify Family offer more benefits, including being free of all ads, offering enhanced sound quality, allowing users to listen when they are offline and also offers mobile listening without the shuffle mode being in use.

Using the Spotify Code

Spotify unfortunately has no supported release for Linux, but there is a way to get the benefit of Spotify by installing a code. By making use of the code, one will be able to add the Spotify repository, check for all the latest versions and install Spotify so it can be used on Linux devices. To benefit from Spotify, simply use the code provided and execute it. The code should be copied as it is written and pasted into the Terminal, and is as follows:

sudo apt-add-repository -y “deb http://repository.spotify.com stable non-free” &&
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys D2C19886 &&
sudo apt-get update -qq &&
sudo apt-get install spotify-client

. These are four separate commands and need to be entered exactly. As soon as the commands have been added and executed, users should have no problem instantly opening Spotify on their computer or mobile device.

The reason there is no dedicated Spotify client for Linux is because the company says there are not enough Linux users, and even fewer who pay for the service. However, with the provided code, users can make use of Spotify on Linux powered devices and can continue to enjoy the music streaming service. On a positive note, the Ubuntu Phone does come with an unofficial Spotify app for all premium users, so there are some options aside from using the code on a computer.

The Growing Popularity of Linux

For many years, the Linux operating system has lurked in the background, taking a back burner to more popular and more powerful systems like Windows and iOS. However, things started to change in 2008 when Google released an Android device that made use of Linux in the background. Android devices cannot run any Linux applications that have not been translated to the Google platform, but the success of Android has also lead to the success of Linux. Linux is now used on many Android devices and is also used by products that are developed by Apple.

Seeing as Android dominates the smartphone market it goes without saying the Linux has enjoyed some great growth over the years. However, it does not stop there. Linux is also being used in smart televisions that are being developed by LG and Samsung and it is also seen in Nest thermostats, Kindle e-readers and even in some drones made by companies like 3DR. To give consumers an idea of how popular Linux has become, it is responsible for the displays in Tesla cars and is also used by other manufacturers like Honda, Ford and Toyota. Many companies are now turning to Linux when they wish to create new technology. Since it can be customized to meet the needs of the consumer, it is a system that can provide benefits to many different industries, not just the home computer or smartphone industries.

There are also online casinos that have started to support Linux. For many years, Windows was the star of the show when it came to the ability to play online casino games, but Linux users, including Ubuntu users, can now enjoy great casino games and many of the new online casinos to enter the market are offering software that is compatible with Linux.