MEOW + RAWRRR =
Hacking Your Education┋ Indy Book Culture & Arts on Margins┋ Electricity, Electronics, Data Cables & Wireless Networks, Information Technology, Software Development / Testing / Documentation, Metal Craft & Fixing Things┋ Brain, Universe, Evolution, Math: Beautiful Stories in Science ┋ Zines, Comix, Bookfairs, & Rogue Spaces┋BIPOC, Intersectional, & Majority World Feminisms┋Theory vs. Materiality: A (Violent) Geneology of Utopia┋Love's Labor: Lust – Gazing Back at Patriarchy (with Google Glasses)┋Spinsters, Witches, Lesbians, Whores: Bad Girls As Collateral Damage in the Invention of Love & Marriage┋Queer/ Trans/ Crip Cyborg Bio-Hacking┋Transformative Justice: The color of Capitalism is the color of Prison ┋ To Be a Backpacking Taoist: A Nomad's Work of Care & Creativity
Notes 1: Intro to Python, BASH, Django

A> INTRO TO COMPUTER SCIENCE
Lesson 1. Intro to Python

A. Install Python & IDLE
B. Declarative knowledge vs. Imperative knowledge
C. Fixed vs. Stored program computer
D. Interpreter vs. Compiler, Programming language: Syntax, Static Semantics, Semantics – and how a program can Crash
E. Simple programming in Python – Assignment #PS 0

PDF slides for the first lecture in the course can be found here.
———-

A. Install Python & IDLE

First task is to install Python. For the Linux operating system, Python is already installed; however IDLE may not be installed. IDLE is the programming environment that was designed for Python programming and is included with the Python distribution. Here is a tutorial on installing Python and IDLE.

To install IDLE on Linux, if it isn’t already installed, go to the terminal and use this command: “apt-get install idle”

To begin coding, open up a new file on IDLE, enter code, and save the file. Enter the Python shell within terminal, and open up the file you have created in IDLE by entering “python filename.py”

–  For more information about commands within BASH, see the next session of this post, with my notes on Treehouse’s “Console Tutorial.”
–  For more information about Linux, read Adafruit’s post about why Linux is awesome, which I found out about through HackaDay’s Christmas blog post entitled, “What is This Thing Called Linux?”

———-

B. Declarative Knowledge vs. Imperative Knowledge

Declarative knowledge is composed of statements of fact. However, it doesn’t provide instructions on how to arrive at this fact, or how to test if it’s correct.

Imperative knowledge is about how to accomplish something, like a recipe. An example of imperative knowledge is an “Approximation Algorithm,” which provides instructions on how to arrive at an answer through a series of closer and closer estimations.

An Algorithm is a description of how to perform a computation. It consists of a set of instructions, a flow of control, and a termination condition.


C. Fixed vs. Stored program computer

The first computers were fixed program computers that coStored program computeruld only do one operation. Later, stored program computers were created that can execute any number of programs. This is because there is no distinction between the program that implements the algorithm and the data on which that program operates. With this innovation, programs could produce programs, and the machines have gone from single-operation machines to infinitely flexible language processors, or “interpreters.”
D. Programming language

An interpreter is a program that can execute any legal set of instructions. It consists of:
a) a control unit that tells the computer what to do
b) memory for storing instructions and data
c) an arithmetic logic unit that executes that calculation, taking in one input and converting it into an output
d) a bunch of input and output devices that communicate instructions and data from the human user to the computer

Alan Turing broke down the instructions to a stored program computer into six primitive commands, which constitute complete computability. Any device that can can carry out these six functions can work with any other device:

1. Right:  move the machine head to the right
2. Left:  move the machine head to the left
3. Print:  place a symbol into the current cell
4. Scan:  identify any symbols in the current cell
5. Erase:  erase any symbols in the current cell
6. Halt: do nothing

This is a very basic version of a programming language. A programming language provides a set of primitive instructions and provides control parameters for carrying out these instructions. What distinguishes one programming language from another is the a) syntax, b) static semantics, and c) semantics of the language – which determine how sequences of symbols are interpreted and how they can be combined to create new meanings.

a) Syntax – which sequence of characters and symbols constitute a well-formed string? (Rules of grammar.)
b) Static Semantics – which well-formed strings have meaning? (Beyond grammar, making meaningful sentences.)
c) Semantics – what is the meaning of the well-formed strings?

A computer can crash if any of the above aspects of language conflicts or breaks down – that is, if:
1. the program stops running
2. the program never stops running – infinite loop
3. the program gives you the wrong answer – (this is the worst kind of problem, because it can go undetected for a long time)

Programming language has to be translated from human alphabets and symbols (source code) into binary machine language (object code).
– A compiler translates from source code (high level language) to object code (machine language).

Compiler

– An interpreter translates from source code into an intermediate language before translating that code in small bits and pieces into object code. This allows the interpreter to translate one statement at a time, executing one before translating another. This is different from the compiler, which translates an entire program and then executes the whole thing.

Interpreter

– Compiled language (source code –> checker/compiler –> object code –> interpreter —> output) Compilers take a longer time to generate error reports because it has to go through the entire body of code, while interpreters stop when faced with the first mistake; however, compilers are faster than interpreters overall. Examples: C, C++, Objective-C, COBOL, Pascal, Visual Basic.

– Interpreted language (source code –> checker –> interpreter –> output) Examples: Java, Python, Ruby, Perl, PHP.

———-

E. Assignment #1 – Writing a very basic set of instructions in Python

The first assignment required that I set up Python on my computer and get familiar with the IDLE programming envrionment. Here is another tutorial on how to install Python and IDLE. To solve the problem, I read this page about the correct syntax for printing various types inputs and outputs in Python (strings versus numbers). I also read the help pages for different functions within Python, and read through some of the Python 2.7.9 documentation and tutorial pages here  (on defining a variable, the print function, the input vs. raw_input functions).

Problem:
Write a program that does the following in order: 1) Asks the user to enter his/her date of birth. 2) Asks the user to enter his/her last name. 3) Prints out the user’s last name and date of birth, in that order.

Answer:
birthday = raw_input(“What is your birthday?”)
name = raw_input(“What is your last name?”)
print name + ” ” + birthday

==========
==========

B> WEB DEVELOPMENT PRE-WORK FOR FLATIRON SCHOOL
Lesson 1. Intro to the Command Line

Here is the FlatIron School tutorial on the Command Line: http://bit.ly/command-line-tutorial
Here is a blogpost by TreeHouse with some Command Line basics: http://blog.teamtreehouse.com/command-line-basics

Among the commands that were covered in these tutorials and TreeHouse Console Foundations videos are:

  • ls, pwd, cd
  • less, more, cat, mv, cp, rm, mkdir
  • sudo, su
  • chmod – modifying the 9 permissions octal notation on each file: (r)ead/(w)rite/(e)xecute for (u)ser/(g)roup/(o)ther
  • chown
  • top, ps, ps aux
  • env, echo, find, grep, sort, search
  • piping |, <, >, <<, >>, -0
  • installing software with the package manager: ‘sudo apt-get update,’ make, make install, upgrade, remove, autoremove
  • curl, tar, configure

Steps for installing software through BASH:
1. Download source file.
2. Untar file.
3. Run ./configure script.
4. Run “make” command.
5. Run “sudo make install.”

==========
==========

 

C> USING PYTHON FOR WEBDEV ON DJANGO – UDEMY
Lesson 1. Installing Django on a Virtual Environment

According to the description on the Django website, which has a strong community of developers, and some good resources on documentation/tutorials:

“Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.” 

You can watch instructor Justin Mitchel’s YouTube videos on installing Django, here:

Here are the instructions within BASH for installing Django, first on a virtual environment, and then directly onto the main system:

sudo easy-install pip
sudo pip install virtualenv
virtual env [name]
source bin/activate
pip freeze
pip install django
pip install django — upgrade
sudo easy-install django
sudo pip install django upgrade
django-admin.py startproject my_project
python manage.py runserver

For the editor, Justin Mitchell recommends the free and open source Komodo Edit.

Comments are closed.