How to install and configure Python 2.7 on Windows 7, so you can execute the scripts from cmd

Python comes already installed in most of the linux based operating systems, probably because they’re mostly being used by heavy computer geeks who is passionate about coding and computer technologies in general. Unfortunately for those who make use of Windows 7, they have to manually download, install and configure Python on their machines completely by themselves.

The beginner who has no idea on how to properly setup Python 2.7 on their Windows 7 computer, is completely left with no official solutions; they have to swim completely alone unless they find a good tutorial on the internet, which explains everything in details so even a complete newbie can understand.

Having struggled myself in the beginning of my journey as a Python coder, I finally decided to write a very concise and easy to follow tutorial for anyone out there who is interested in installing and configuring Python 2.7 on their Windows 7 operating system.

There are many ways one can configure Python programming technology on their Windows machine. The main purpose of this tutorial is to give one the proper instructions on how to install Python 2.7 on Windows 7 so they would be able to execute scripts directly from the Windows command line interface, which is widely known as cmd.

Before going on with the technical instructions, it is truly important for one to learn about environment variables and their purpose on Windows machines.

Windows environment variables

The information about Windows environment variables being shared in here is for complete beginners, for those who have no idea about them. It does not intend at all to cover them in details, but only for the purpose of understanding their important role in configuring Python 2.7 on Windows 7 so one can easily test and run their Python scripts from the command line.

An environment variable in Windows is mainly being used to point to specific paths of executables so the system can directly execute the programs from the command line, without the need of the absolute path. Each program installed on Windows 7, and I do believe in all operating systems available out there, gets placed in specific path, in a specific directory. For the system to keep track of these paths, the environment variables is being used.

One can easily access the environment variables of their Windows 7 machine, by following the instructions being shown below.

System Properties, Advanced, Environment Variables.

Download and install Python 2.7 on your Windows 7 computer

Before proceeding with the download and installation of Python 2.7 on your Windows 7 operating system, it is important to find out the system type. Do you have a 32 bit machine or a 64 bit one? Based on the architecture of your machine, you will download the specific Python 2.7 interpreter.

To find out your system type go to Start, right click on Computer and go to Properties; the following will come up.

As you can see from the above screenshot I have a 64 bit machine. I need to download the python installer for 64 bit system type.

Now go to the python official website and go to Downloads. Under Downloads click on the Windows category.

Depending on the system type you have, you have to download the right version. In the following screenshot everything is self explanatory so take a look at it and click on the python installer for your type.

python installation

Note: The version of python we need is 2.7.11

Download the right version of python for you and move it on Desktop like shown below.

python installation

Then do a right click on the python installer you just moved to Desktop and click on Install. The installation of python will start. The following box will show up.

python installation

If you don’t want to make python available to other users then just select the second option and click Next. I prefer to leave this as default.

The next box will ask you about the path where you want python to be installed. Please leave this as default as you are new to this stuff.

python installation

The C:\Python27\ is the path where our python installation is going to be placed. We will need this path for some configuration so make sure to save it in a notepad file.

C:\Python27\

Then the following will show up. Make sure to click Next.

python installation

Once the above step is completed, the installation of the official Python 2.7.11 interpreter will start on your Windows 7 machine.

python installation

When the setup is close to the finish, just click the Finish button like shown below.

python installation

We are not done yet!

If you go to your Windows 7 cmd and type python in there, like shown below, you will probably get some error, like path not found.

python

The error occurs because the system does not know where to look for the windows executeable named python. It does not exist.

python installation

You have to create it.

Setup python path in Windows 7

So what you need to do in order to execute python program from the command line is to edit the Path environment variable.

First go to My Computer, Properties, Advanced System Settings, Environment Variables. Then find the Path environment variable and click on it; then click Edit.

In the end add the following path.

C:\Python27\

After you have copied the above path and added it in the Path environment variable, click Ok. You will now be able to execute Python 2.7.11 directly from the cmd.

I also have a video in which this article is based. Please make sure to watch it after reading this tutorial, so you can get a better idea on the stuff being explained in here.

How to install Django on Ubuntu 14.04 LTS for python geeks

About Django

Django is a great web application development framework for the perfectionist with deadlines built in python programming language. It provides a very good structure and common methods that help to do the heavy lifting when writing web applications.

If you have never used django before and are looking for an installation guide on your Ubuntu 14.04 LTS then you are in the right place. Through this article we will teach you how to setup a very simple django development environment step by step.

Some Tools We Need

There are many different ways to install the django framework in Ubuntu. In order to stay updated with the latest python development industry standards we need to install a few tools before getting Django up and running on our machine.

The first tool is called pip which is a very practical python package management system widely used by python developers all over the world. I mainly use pip to install packages for my python projects, generate dependencies of a project and also uninstall different python packages from my machine when they are no longer required.

Before installing pip we highly recommend to our users to update the package index on their machine with the help of the command shown below.

sudo apt-get update

The following command can be used to install the pip python package manager inside Ubuntu 14.04 LTS.

sudo apt-get install python-pip

Now we can easily install python packages on our Ubuntu 14.04 LTS machine by following the syntax shown below.

pip install name-of-python-package-here

But we do not recommend installing packages yet! Python developers use another tool during the development of their python projects.

This tool is called virtualenv. It is really useful as it helps to manage dependency conflicts of different python projects on the same machine. In short words the tool virtualenv helps to create isolated virtual environments where you can develop without any worries about package conflicts.

To install virtualenv on Ubuntu 14.04 LTS the following command can be used.

sudo pip install vitualenv

What is the next step? Do we need to make use of the tool virtualenv? For sure!

Create A Virtual Environment For Your Project

virtualenv can be easily used to create isolated virtual environments for your python projects. For example to create a virtual environment under the name of venv1 the following command can be used.

virtualenv venv1

In order to work on an isolated environment it needs to be activated. The following command does it for you.

source venv1/bin/activate

But working with virtualenv is a bit annoying as there are many different commands you need to remember and type on your terminal emulator.

The best solution is to install and use virtualenvwrapper which makes working with python virtual environments very easy. Once you have finished installing and configuring virtualenvwrapper working on a virtual environment is as easy as typing the following command.

workon venv1

Now that pip and virtualenv tools are available on your machine it is time to install and configure virtualenvwrapper.

To install virtualenvwrapper use pip like shown below.

pip install virtualenvwrapper

There are a few steps you need to follow in order to do this properly. On your command prompt run the following command.

source /usr/local/bin/virtualenvwrapper.sh
All virtual environments you create will be available inside the directory ~/.virtualenvs.

If you want to keep your virtual environments inside another directory then use the following commands like shown in the official documentation of the virtualenvwrapper.

export WORKON_HOME=~/Name-Of-DIrectory-Here
mkdir -p $WORKON_HOME
source /usr/local/bin/virtualenvwrapper.sh

I like to keep my virtual environments inside ~/.virtualenvs. My projects are inside ~/projects.

To create a virtual environment just use the command mkvirtualenv like shown below.

mkvirtualenv linuxtuts
The following output is displayed on my terminal when executing the above command.

New python executable in linuxtuts/bin/python
Installing setuptools, pip...done.

To work on the virtual environment linuxtuts use the following command.

workon linuxtuts
Once the virtual environment has been activated your command propmpt will change. Mine looks like shown below.

(linuxtuts)oltjano@baby:~/Desktop$
As you can see from the output shown above linuxtuts is the name of the virtual environment we created.

Make the changes permanent

In order for the commands offered by virtualenvwrapper to work anytime you open the terminal it is needed to make some changes in the .bashrc file.

The .bashrc file is used to setup environment variables, functions aliases and many other stuff you want to have when opening a new terminal window. Read more on .bashrc.

Open the .bashrc file with your text editor, copy paste the following in it and then save the file.

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh

Install Django

Inside the virtual environment use the command which python to see the python executable you are using.

which python
The above command produces the following output on my machine. Depending on the name of your directory for the virtual environments you will get a different output, but structured in a very similar way.

/home/oltjano/.virtualenvs/linuxtuts/bin/python

The above output is telling us that the python executeable being used is inside the virtual environment which in this case is linuxtuts.

Deactivate the virtual environment with the command deactivate.

deactivate

Remove the virtual environment linuxtuts with the help of the following command.

rmvirtualenv linuxtuts
The reason why we decided to remove linuxtuts is because we did not choose the version of python we want to use inside the virtual envrionment we created.

It can be done with the following command.

mkvirtualenv -p /usr/bin/python-version-here

In a project I am working on we use python3.2. To run the project I create a special environment for it.

mkvirtualenv -p /usr/bin/python3.2 linuxtuts

The above command produces the following output.


Running virtualenv with interpreter /usr/bin/python3.2
New python executable in linuxtuts/bin/python3.2
Installing setuptools, pip...done
Also creating executable in linuxtuts/bin/python

The command prompt will look similar to mine.

(linuxtuts)oltjano@baby:~/Desktop$
You can use any python version required by your project. The installation of django is very easy.

Just run the following command.

pip installl django

The above command produces the following output.

You are using pip version 6.0.7, however version 6.0.8 is available.
You should consider upgrading via the ‘pip install –upgrade pip’ command.
100% |################################| 7.4MB 40kB/s

Collecting django
Downloading Django-1.7.6-py2.py3-none-any.whl (7.4MB)
Successfully installed django-1.7.6
Installing collected packages: django

To install a different version of django than the default one specify the version like shown below.

pip install Django==1.0.4

It is up to you which version of python and django you want to use for your projects. Our mission is to help how to install them.

Setup your first simple project in django

After you have finished the installation of django in a virtual environment you probably want to start your first project.

Fortunately for us django offers management tools for your projects. The django-admin.py tool can be used to start the project.

Create a fresh virtual environment for your new project.

mkvirtualenv -p /usr/bin/python2.7 fresh_project

Note: Depending on the version of python you want to use you need to change the path listed above.

Install a new copy of django inside your virtual environment.

pip install django

Use the following comand to start a fresh django project.

django-admin.py startproject fresh_project
Then cd to your project directory and list the files inside your project. The directory structure will be similar to the one shown below.

fresh_project manage.py

The manage.py ,is another tool you have to use on your django projects. Each django project is composed of apps.

You can create a new app with the following command.

python manage.py startapp myapp

If you do an ls now the directory structure should look like the one shown below.

fresh_project manage.py myapp

It is always a good idea to generate the requirements.txt file for every project you write in django so when you show it to your friends or want to run the project in another machine you can easily install the needed packages to run the project.

Create a new file called requirements.txt on the top level directory of your project and append the packages in there using the following syntax.

django==1.9.5

As you can see from the above command you append the package name then you add its version which really important.

If you do an ls now inside your project you should get the following.

fresh_project manage.py myapp requirements.txt
And you install the requirements for the project on a new machine by using the following command.

pip install -r requirements.txt
Are you asking yourself how to run the django project? Just run it using the following command which starts the builtin django development server.

python manage.py runserver
And then visit http://127.0.0.1:8000/. You will get a message from django congratulating you running your first django project like shown in the following screenshot.
django installation finished

Conclusion

Knowledge on tools such as virtualenv and virtualenvwrapperis a must for a python developer. In this article I showed you how to install django on Ubuntu 14.04 LTS and also how to setup a very basic django development environment.

My Experience With Newor Media

Where there is code, there is usually some sort of monetization along with it.  For many of us on the web that means digital advertising, which has gotten a bad reputation from pretty much it’s inception.  As you can see, I use ads on this site to help me make a side paycheck now and then.

In the beginning I used AdSense, and there’s nothing wrong with that.  I did it for years, and the return was decent.  I, like many, get a lot of companies trying to places ads on my site, but why not just stick with AdSense?  It’s easy, and you can access to the largest ad marketplace.

Recently, through a mutual friend, I was introduced to a company called Newor Media that basically manages all your ads for you.  Not really a network, but people who are experts in networks and getting good rates.  They guaranteed me that they would beat AdSense, and would provide up to 6 banner ads along with other recommendations to help monetize the site. The only confusing part is that they seem to be private, but if you contact them on the site, they are usually open to new sites.  I was also a little bit hesitant as I was running AdSense for years, so I didn’t want to waste my time trying someone new.

But here is my honest unbiased feedback about working with them. I have been using them for 5-6 months now, so it’s possible something could change later on. But, I want to fully recommend them to anyone reading this. Seriously, it is one of the best decisions I’ve made when it comes to this site. Their online reporting is a bit simple, but shows daily revenue and impressions which is all I really need. I also get the impression that they are actively working on the ads, as they occasionally update me with new partners or suggestions, which is pretty unlike other networks.

I’m making significantly more than AdSense right now, and the quality of the ads is still high in my opinion.  They also have some of the best customer service I’ve ever seen, and if I have a question or need to make a change, they respond back in 10 minutes (usually).  And payments are automatic.

So far I’m very happy. I was never super comfortable with AdSense, only because I know I was probably under monetized a bit.  But the ease of set-up is about the same with Newor Media, and they actually seem to care about improving performance and helping me.  Give them a shot and let me know what your experience is.

Top 10 Code Snippets With CSS Animations

A great thing about CSS is that it allows you to animate your creations. CSS animations are typically smooth and add some sense of movement and dimension to your projects. Best of all, they’re fairly easy to understand and implement into any code (though some properties aren’t supported by all browsers, so be sure to use vendor prefixes with them).

Animations are super versatile and can be used to create so many unique effects, from something as simple as a spinner to something much more complicated, like a working, ticking clock face. Take a look at the list below to see our top 10 favorite code snippets that include CSS Animations

  1. CSS Responsive Animated Accordion

Screen Shot 2017-03-22 at 9.46.22 AM

This snippet not only creates an accordion functionality that has animations, but it’s also fully responsive. The accordion tabs smoothly slide down to reveal the content when the heading is clicked. This accordion feature would be a great addition to any website.

2. CSS Text Animation

Screen Shot 2017-03-22 at 9.48.20 AM

This tutorial demonstrates how to use CSS to animate text. The second word rotates in between four different words, so you can use the animation to essentially make your text say four things at once.

3. CSS Animated Hamburger Icon

Screen Shot 2017-03-22 at 9.55.19 AM

The hamburger icon in this snippet turns into an “x” when you click it, thanks to smooth CSS transitions and animations. When you click it again, it reverts back to the three-line hamburger style icon.

4. CSS Flame Animation

Screen Shot 2017-03-22 at 9.58.19 AM

This pure CSS flame animation dances and flickers slightly, just like a real flame would. A really cool effect to add to a project that has a spooky or eerie vibe.

5. Pure CSS Animated Clouds

Screen Shot 2017-03-22 at 10.00.21 AM

This pure CSS animation produces clouds of all different sizes that slowly float on by from one end of the viewport to the other.

7. CSS3 Working Clock

Screen Shot 2017-03-22 at 10.03.00 AM

Did you know you can use CSS animations to create a realistic looking working clock? No JavaScript or jQuery necessary. The clock is pure CSS, using only CSS to create all movements and shapes.

8. CSS Animation on Hover

Screen Shot 2017-03-22 at 10.05.05 AM

This simple snippet is a good demonstration of how you can use CSS animations to rotate an object, and also how you can activate CSS animations using :hover as a trigger event.

9. CSS Spinner Animation

Screen Shot 2017-03-22 at 10.07.48 AM

Use this tutorial to understand how to make a pure CSS spinner. Spinners are perfect to present to the users while sites or images are preparing to load.

10. CSS Animated Sunset Background

Screen Shot 2017-03-22 at 10.09.37 AM

This snippet uses animated gradients as the background of the page to create a moving sunset type effect. A great way to experiment with animated gradients and color.

How to Create Social Media Share Buttons

A good social media share button has to be aesthetically pleasing and really accessible — you have to make your users want to click the buttons and share your content (a good hover effect with a clean CSS transition never hurt, either). In this tutorial, we’ll show you how to make simple but beautiful social media share buttons using Font Awesome icons that come complete with a smooth hover effect. The best part about this tutorial is that it really requires relatively little code, so it’s a pretty quick and simple way to add a whole lot of style and professionalism to your projects.

The HTML

To start, we’ll need some HTML for our buttons. They’re going to be standard anchor tags that contain icon tags so we can use the social media platform’s logo icon with each corresponding social media share button. Because we’re using Font Awesome, we need to make sure that we link to the icon library somewhere in our files, either by using CSS’s @import rule, or by adding the following code into the <head> of our HTML file:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">

To create the buttons, your HTML should resemble the following code:

<div class="container">
  <a class="share facebook" href="#">
    <i class="fa fa-facebook"></i> 
    Share
  </a>
 
  <a class="share gplus" href="#">
    <i class="fa fa-google-plus"></i> 
    Share
  </a>
 
  <a class="share twitter" href="#">
    <i class="fa fa-twitter"></i> 
    Tweet
  </a>
 
  <a class="share stumbleupon" href="#">
    <i class="fa fa-stumbleupon"></i> 
    Stumble
  </a>
 
  <a class="share pinterest" href="#">
    <i class="fa fa-pinterest"></i> 
    Pin it
  </a>
 
  <a class="share linkedin" href="#">
    <i class="fa fa-linkedin"></i> 
    LinkedIn
  </a>
</div>

Here, we’re creating share buttons for Facebook, GooglePlus, Twitter, Stumble Upon, Pinterest, and LinkedIn. However, if you want to customize this code for your own projects, feel free to add as many social media platforms as you like — Font Awesome has icons for just about every social media network that has ever been even a little bit popular, so you have a lot of options.

The CSS

Now it’s time to add some major styling to our HTML and turn the plain links into something resembling buttons. Here’s the CSS you’ll need to achieve this:

@import url(https://fonts.googleapis.com/css?family=Ubuntu);

body{
    font-family: 'Ubuntu';
    text-transform: lowercase;
    background-color: #d1e0e0;
}

.container{
    text-align: center;
    width: auto;
    margin: 75px auto;
    width: 55%;
}

.share {
   float: left;
   padding: 10px 15px;
   border: none;
   background-color: #ececec;
   text-decoration: none;
   font-size: 14px;
   color: #FFF;
   z-index: 1;
   transition: transform .1s ease-in;
}

.share i{
    font-size: 18px;
    padding-right: 5px;
}

.facebook {
   background-color: #3b5998;
}
 
.gplus {
   background-color: #dd4b39;
}
 
.twitter {
   background-color: #55acee;
}
 
.stumbleupon {
   background-color: #eb4924;
}
 
.pinterest {
   background-color: #cc2127;
}
 
.linkedin {
   background-color: #0077b5;
}

As you’ll probably notice, the background of each button is a different color, and these colors reflect the logos and brands of the social media platforms that the buttons correspond to. You’re free to customize this code however you like, but if you want your buttons to stay on brand, then you may choose to keep the colors as is.

You also might notice that we added a transition property to the buttons. This will come into play when we add the hover effect, which is our next and final step. Right now, our buttons should look something like this:

Screen Shot 2017-03-02 at 4.12.18 PM

It’s a beautiful sight.

The Hover Effect

We’re almost done, we just need to add one little finishing touch, because what’s a good button without a hover effect? Here, we’ll finalize our social media sharing buttons by giving them an effect that makes the buttons smoothly increase in size (thanks to our transition rule from earlier) when the user hovers over them. This effect sort of makes it look like the buttons are popping out at you, but in a smooth way that makes it quite fun to hover over them.

Here’s the CSS you’ll need:

.share:hover {
   transform: scale(1.3);
   z-index: 2;
}

That’s it. All we need to do is transform the scale and make sure we give the buttons a higher than default z-index (otherwise they will grow in size but won’t show up over the other buttons) and our social media sharing buttons are ready to be included in our projects. Here’s how it looks when you hover over one of them:

Screen Shot 2017-03-02 at 4.12.26 PM