Free Essay

Python

In:

Submitted By Cecabral
Words 2308
Pages 10
NOS 120 Linux/UNIX Single User
Compiling Linux Software from Source Code

Objectives

After reading this chapter and completing the exercises, you will be able to:

* Understand basic elements of C programming * Debug C programs * Create, compile, and test C programs

Text Reference: Chapter 10 – Developing UNIX/Linux Applications in C and C++

Programming Overview

A computer program is a list of instructions given to a computer to make it perform a specific task or series of tasks. A programmer communicates these instructions to the computer in a language the computer understands. Computers, however, can only operate using binary code (1’s and 0’s), which makes a computer’s language very difficult for humans to understand.

The solution to this problem is to create an intermediate language that both humans and computers can understand. These are called programming languages. Programmers create a list of instructions for the computer in a programming language such as C, C++, or Java.

The C Programming Language

The C programming language was released in 1973. C was created by Brian Kernighan, Dennis Ritchie and Ken Thompson working at Bell Labs. Both the UNIX and Linux operating systems are written in C. The C programming language is a high-level language because the code itself is written in relatively English-like statements. In 1978, Kernighan and Ritchie wrote "The C Programming Language," still one of the best C programming books available.

The list of programming instructions is known as source code. It is text-based in nature, and readable to humans (Figure 1). Programmers do all their work in this source code, changing the instructions to fix bugs, add features, or alter the appearance of a program.
Figure 1
C programming language source code for the “Hello, world!” program.

Compilers

Compiling is the process of translating source code (the human-readable description of a program written by a programmer) into the native language of the computer’s processor. While there are many popular programming languages, two predominate in Linux. Most programs written for Linux systems are written in either C or C++.

A special program called a compiler is used to translate human readable text instructions into computer readable format that correspond to the same instructions. The resulting file is usable by computers, but incomprehensible to humans. This is called object code. The resulting executable file is often called a binary, after the number system used by the computer. This translation from source code into binary object code is a one-way process. It is impossible to translate a binary executable back into the original source code.

The binary executable is what is needed to run the program. The source code is what you need if you want to understand how a program works internally, or if you want to change, add to, or improve a program. If you have the source code and an appropriate compiler, you can produce the binary executable, but the reverse is not true. The process is summarized below.

Compiling from source code can be an intimidating process if one is a non-programmer. Fortunately, the process is fairly straight forward if all the dependency programs are in place. Knowing how to compile source files is an indispensable skill in the Linux world. For this reason, every Linux user needs to become comfortable with the compilation process, as it truly is a necessary skill for anyone administering Linux systems.

As mentioned previously, programs written in programming languages such as C are converted into machine language by processing them with another program, called a “compiler”. The C compiler used almost universally in the Linux environment is called gcc (GNU C Compiler), originally written by Richard Stallman. Most distributions do not install gcc by default, but is easily installed using the package installer called yum.

Guided Exercise: GNU C/C++ Compiler Install

Compiling software from source code can become very complex and technical and is often well beyond the reach of many users. However, many compiling tasks are quite easy and involve only a few steps. It all depends on the package. In this exercise we will look at a very simple cases in order to provide an overview of the process and as a starting point for those of you who wish to undertake further study.

1. Install the C compiler and related tools

As root, use the following yum command to install GNU C/C++ compiler:

yum groupinstall 'Development Tools' -y

2. Verify installation

Type the following commands to display the version number and location of the compiler on Linux:

which gcc gcc --version

Sample output:

Compiling Programs with gcc

To compile a C program, use the following generic command:

gcc source_file.c -o program_name

The source files for gcc usually end in .c to indicate C program source code. If there is no error in the C program code then the compiler will successfully create an executable file called program_name in the current directory, otherwise the code syntax erorrs will have to be corrected. If you don’t specify an output file, gcc assumes the output filename a.out.

Guided Exercise: A First C Program

1. Login to your system a regular user.

2. Open your favorite text editor and enter the C code below. Save the file as hello.c in your home directory.

3. Open a terminal and compile hello.c with the following command:

gcc hello.c –o hello

Note that the file was automatically given execute permission during the successful compilation process.

Syntax errors may occur during the compile. Check the code for syntax errors if the code does not compile correctly. Save the file and recompile the program.

4. Once the code compiles correctly, execute the program as shown below.

Compiling C Programs from Existing Source Code

There is a lot of free software (e.g., http://sourceforge.net) that is written for Linux that is only available in source code format. This is the most efficient way for the developers to distribute their software. When you obtain the source code file(s) you compile them to generate an executable binary that's specific to the OS and hardware platform

Practically all source code comes in a compressed archive file. This will have the suffix .tgz or .tar.gz. It will also have a name and a version number, something like example-1.2.3.tar.gz.

While the exact process for compiling existing source code may vary, there are some general principles that can be followed, as outlined below.

1. Download the source code for the program from the Internet or other media.

The source code will most likely be in the form of a "tarball" and have a file extension of .tar, .tar.bz2, or .tar.gz.

2. Unpack the downloaded source code archive

Depending on the type of archive you have received, the command for unpacking it may differ slightly. The Linix tar (Tape ARchiver) command is used for working with file archives. Typical command switches are x to extract files, v for verbose mode so you can tell what’s going on, f indicating there will be a filename to follow. If the file name ends in .tar that is all you need, but usually the tar file has been compressed with another utility. Files ending in .gz were compressed with gzip. For those, add the z flag to the list of parameters. Files ending with .bz2 were compressed with the bzip2 utility. For those, add the j flag, or failing that, --bzip2.

For .tgz or .tar.gz use “tar –zxvf filename”; for .bz2 use “tar –jxvf filename”.

3. Once unpacked, the next step is to change into the newly created source code directory.

For example, if the archive name was source_code-1.2.3.tar.gz, cd into the directory named source_code-1.2.3.

Practically every source package contains some reading material, typically files with names in all caps, like README and INSTALL. Read these! They tell you how to proceed. There may also be documentation for your specific system, like README.linux. The documentation may also point you to other software that you need to install before you can install this package ("dependencies")

4. Run the “./configure” command

Execute “./configure” to configure the source code automatically. The primary job of the configure script is to detect information about your system and “configure” the source code to work with it. This checks that you have the correct compilation components and libraries installed.

5. Run the “make” command

Once configured, run "make" which does the actual compiling (this can take anything from a few seconds to many hours). When you run make, you'll once again see a bunch of strange messages filling the screen. The display looks quite technical and if someone is looking over your shoulder they will likely be impressed with your technical prowess on the computer. This is the actual compilation process occurring. This step may take some time, depending on how big the program is and the speed of the computer.

If all goes as it should, the binary executable is finished and ready to run after make has done its job. Now, the final step is to install the program.

6. To install the program run "make install".

Usually, this directory is /usr/local/bin, the traditional location for locally built software. Some distributions prefer to use the /opt (“optional”) software directory.

Sometimes you may not have root access to the system, and you would like to install the software into your home directory. You can do this in the configure step with “./configure --prefix=/home/username” (where username is your actual system user name).

7. Run the “make clean” command

Finally, most source code installations provide the option to clean up after themselves. Large programs often leave a substantial number of intermediate files lying about in their source directories, which can consume a significant amount of space. To make sure that these are cleaned up, or to clean up after a failed build of the program, try using the command “make clean.”

8. Execute the program

Depending on where the program was installed, either

./program_name

or

/path/to/program_name

Programming Assignment

1. For this exercise you will install the classic Rock-Paper-Scissors game from source code.

Login to your system as a regular user and do the following:

(a) Create a directory in your home directory name “src”.

mkdir ~/src

(b) Download the file papercut-0.1.1.tar.gz from Blackboard and save the file in your src directory.

(c) Change into the src directory.

(d) Extract the tarball.

tar zxvf papercut-0.1.1.tar.gz

(e) The tar command will extract the source code files into a directory (papercut-0.1.1) with the same name of the original tar.gz file.

(f) Now change into the source code directory and view the README file.:

(g) To begin the compilation process, execute the configuration command (replace username with your actual username):

./configure --prefix=/home/username

The dot-slash beforehand means you want to run the ./configure configuration tool in the current directory. This runs some diagnostic tests on your computer, figuring out whether the software has everything it needs to compile correctly.

The configuration process may take several minutes. When it's done, if it doesn't give you an error message, you're ready to compile.

(h) Execute the make command to compile the source code:

The make command “makes” the binary executable from the source code.

When it ends, if you still don't see an error message, you're ready for the last step. Note that you probably won't see a congratulations message either, but if there's no error, you've succeeded. The software has been compiled.

(i) All that remains to do is to put it where it belongs with “make install”.

This will install the papercut program in a directory named bin (short for “binary”) in your home directory.

(j) Now the program is ready to be used. Change back into your home directory, then execute “./bin/papercut 3”. This will run the Paper-Rock-Scissors game for three rounds. Give it a try. See if you can beat the computer!

(k) Execute the following command to view the actual source code for the program:

gedit ~/src/papercut-0.1.1/src/main.c

Next, click on “Edit” -> “Preferences”, then check “Display line numbers”.

You should now see the source code of the program with line numbers on the left side.

(l) Papercut is written in the C Programming language, as is most of Linux. Unless you have had a C programming class before the code will largely be unintelligible to you. That’s okay as our purpose is to learn how to compile and execute existing code.

We can, however, modify some easily recognizable code statements in the program. For example, look at line ~150.

printf("Youe lose. :-(\n\n");

The programmer misspelled “You” in the print statement. Correct that misspelling, please.

The “printf” statements simply print a line of text to the screen. There are numerous printf statements in the code. For example ~176, ~181, and ~193. Modify some of these printf with your own statements, but keep it professional.

(j) Change back into the source code directory once you have completed the code edits and save the file. Recompile the program by issuing the make and make install commands again.

(k) Execute the program and take a screenshot showing some of the changed text strings. Save the screenshot as papercut.png and upload to Blackboard.

2. Download the file vitetris-0.57.tar.gz from Blackboard and install the game from source code using the ./configure, make, make install process as outlined in the papercut example..

Play a game of Tetris (executable name is tetris). Take a screenshot of your game and save the image as tetris.png and upload to Bl

Similar Documents

Free Essay

Python Programming

...Introduction to Programming with Python 1 Outline Introduction to Python Operators & Expressions Data Types & Type Conversion Variables: Names for data Functions Program Flow (Branching) Input from the user Iteration (Looping) 2 What is Python  Python is both an interpreted, general purpose, open source, cross-platform, high level programming language.  Python uses an interpreter. This is a software program that convert Python code to machine language.  It is easy to jump in and experiment with Python in an interactive fashion. Compiling and interpreting  Many languages require you to compile (translate) your program into a form that the machine understands. compile source code Hello.java  execute byte code Hello.class output Python is instead directly interpreted into machine instructions. interpret source code Hello.py output 4 Programming basics     code or source code: instructions in a program. The sequence of syntax: The set of legal structures and commands that can be used in a particular programming language. output: The messages printed to the user by a program. console: The text box onto which output is printed. 5 The Basic Pattern Most of our programs will use the basic pattern of:  Get some user input  Perform some algorithm on the input  Provide results as output Identifiers in Python    Identifiers...

Words: 3768 - Pages: 16

Premium Essay

Burmese Python In The Everglades

...Burmese Pythons Have you ever went to the everglades before? If so then you’ll realize how much Burmese pythons they’re in the Everglades. Now the first thing you’ll be thinking of is Burmese pythons not belonging here in Florida and should be in Southeast Asia where they’ve originated but here is where I get into detail about this. First off, what is a Burmese python? “The Burmese python is a magnificent and powerful animal”. “Native to the grassy marshes of Southeast Asia”, capable of growing to an astounding length of 23 feet and a weight of up to 200 pounds”. (Paragraph 1 of Burmese Python: The Snake That’s Eating Florida). Also Burmese pythons are carnivores and survive by eating small birds and mammals. Although they got no venom, they kill their prey by grabbing the prey with its back teeth and when the prey tries to run, it only sinks further into the python’s grip and then the python wraps its body around the body and squeeze until the animal is dead which then the python swallows the prey by its unique hinged jaws which allows it to swallow an object five times as wide as its own head....

Words: 577 - Pages: 3

Premium Essay

Burmese Python Effect

...Feeling the Squeeze: The effects of the Python molorus bivittatus (Burmese python) in South Florida Inez Broom PCB 4043 October 7, 2015   Abstract The purpose of this paper is to discuss the effects of Burmese python in their non-native environment of South Florida. The discovery of how and why they have made South Florida their home and the impact they have had on the local ecosystem will be discussed. In addition, the management and control methods being used. Introduction The Python molorus bivittatus referred to as the Burmese python originated from Southeast Asia and have made South Florida their permanent home. Burmese python have been considered a subspecies to the native Indian python and have been able to squeeze out...

Words: 1179 - Pages: 5

Premium Essay

Satire In Monty Python And The Holy Grail

...Extreme Violence of the Knights In the movie Monty Python and the Holy Grail, a group of knights, under King Arthur’s leadership, go on a quest, given to them by God, to find the Holy Grail. After a little debate, they split up, but eventually find each other again, where they approach the Bridge of Death, and after crossing, find the Grail. This movie is a significant, modern example of satire, which burlesques the knights and customs of the Middle Ages. Satire attempts to bring change in the world, without actually providing a solution. The film Monty Python and the Holy Grail uses exaggeration and unexpected logic to expose the amount of gratuitous violence that the knights employ in the Middle Ages. The scene with the brawl between...

Words: 298 - Pages: 2

Premium Essay

Monty Python Parody In Sir Gawain The Green Knight

...Monty Python parodies the medieval romances genre’s characteristics of hero-knight (bravery), the loyalty to God, and the honor and respect for all women. Monty Python parodies the medieval romances characteristic of hero-knight (bravery). In Monty Python Tim warns king Arthur about tiny creatures, in other words the tiny rabbit is really dangerous. Tim says, “ look, that rabbit’s got a vicious streak a mile wide. It is a killer!” (Python 14). The rabbit may look innocent, but is evil; however the knights charge in. The rabbit attacks them and all that is heard is the knights yelling “aaaaaugh! Run Away!” (Python 14). The knights withdrawal makes fun about their duty to be brave because they are defeated by such a tiny creature. Meanwhile in...

Words: 738 - Pages: 3

Premium Essay

Organization of Programing Languages

...or CMP 401 ASSIGNMENT | ORGANIZATION OF PROGRAMMING LANGUAGES | | ANZOTSA JOHN ALAKU | BHU/12/04/05/0042 COMPUTER SCIENCE 400 LEVEL | | | ABRSTRACT My objective for these research was to find out about different programming languages and paradigm in which they belong, the most important use in this research are text and journal by other researchers. After all studies where carried out, I came to a conclusion that one programing language can belong to more than one paradigm C++ C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. Some people say that C++ is a middle language because it has the features of high level and low-level language. As one of the most popular programming languages in the world, C++ is widely used in the software industry. C++ is also used for hardware design to analyze structure. Some of its application domains include systems software, application software, device drivers, embedded software, high-performance server and client applications, and entertainment software such as video games. AspectJ AspectJ is a general-purpose Aspect-Oriented extension to java programming language. It was created at Palo Alto Research Center Incorporated (PARC), now it is an open source project and part of the Eclipse Foundation. AspectJ has everything that Java has and more which...

Words: 3773 - Pages: 16

Free Essay

Linux Vsc

...Contents Introduction 2 The Python Programming Language 2 History of Python 2 Features 4 Advantages and Disadvantages 5 Python vs. C 5 Summary 11 Bibliography 12 Introduction After comparing several programming languages, I have found many books and websites expressing how fast and efficient Python is. Further, many research papers describe the advantages of adding Python to computer sciences classes. For this reason I decided to study this language and compare it to one that I am familiar with, like the C language. This paper contains the history of Python, from its creation until now. It shows the features that make Python so popular, and the differences between Python and other languages. Most importantly, it explains the four pillars that are the foundation of the Python programming language, which are to provide quality, increase productivity, portability, and integration. Through this paper illustrate the advantages and disadvantages of Python, by showing that, although an interpretative language such as Python will never be as fast as a compiled language like C, it will be more efficient and useful in a variety of cases. The Python Programming Language History of Python Python (Software, 2011) is a relatively recent, object-oriented, interpreted scripting language created by Guido van Rossum at Stichting Mathematisch Centrum (CVI) in the Netherlands. According to Mark Pilgrim, Python is a successor of the ABC language...

Words: 1762 - Pages: 8

Premium Essay

Java Script: What Is a Function?

...Java Script: What is a Function? Abstract Java script functions are pieces of codes used to execute commands in a program whenever they are called to do so. Java script functions enable the reusability of commands, passing argument and value return in the program. This paper discusses functions as used in Java script as a programming language. Key words: Java script, functions, Python, built-in function, programmer function Java Script: What is a Function? Introduction In Java script, functions are defined as pieces of codes with specific duties that must be called up or referenced before they perform this function. Prior to their referencing, the codes sit in a dormant mode without any function. Functions can also be defined as collection of names or value pairs with hidden links to prototype object. One major use of functions in Java script is in repetitive tasks such as calculations, thus, they highly exhibit an element of reusability. Some programmers sometime call functions as constructors or arrays. Functions are used in defining arguments passed down to them by the programmer when the function is called (Resig, 2006). The result of the argument from the function depends on the kind of arguments that are given to the function. Functions can take more than one argument. Additionally, functions allow for augmenting object prototype to be available to other functions. Augmenting a function prototype makes this method to be available to...

Words: 470 - Pages: 2

Premium Essay

Prog Research Paper Unit 1

...1970’s Dartmouth Basic- was created by John Kemeny and Thomas Kurtz on May 1, 1964. Basic stands for Beginners All-purpose Symbolic Instruction Code . The aims of the BASIC system were: to develop a system and language that was friendly, easy to learn and use, to introduce computing as an adjunct to other courses, to operate an open access policy (i-programmer.info, 2010). Pascal- was created by Niklaus Wirth in 1972. He wanted a language suitable for teaching but for teaching computer science. It is best described as a simplified version of Algol. It was simplified both to make it easier to learn and to make it easier to compile (i-programmer.info, 2010). C- Was created by Ken Thompson iin the form of B and tweaked by Dennis Ritchie and renamed C in the 1970’s. It was the original code Unix was written in. Its function was for ease of use (i-programmer.info, 2010). Forth- was created by Charles H Moore in the 1970’s. The motivation behind this language was for both interactive execution of commands and the ability to compile sequences of commands for later execution (i-programmer.info, 2010). PLEX (Programming Language for EXchanges)- was created by Goran Hemdahl at Ericsson in the 1970’s. It is a special-purpose, pseudo-parallel and event-driven real-time programming language dedicated for AXE telephone exchanges, It is a propriatary language (i-programmer.info, 2010). 1980’s Atari ST BASIC – Atari commissioned MetaComCo to write a version of BASIC that...

Words: 1761 - Pages: 8

Free Essay

Pt1420 Unit 1 Rearch Ass.1

...was the B language, which was created by Ken Thompson in 1969-70. The computers in that time wrote in assembly code and the user had to write many pages of code to do a task. When the B language was created, it made it possible to do a task in a few lines. Although the B language improved the systems it lacked use of structure and didn’t know data types. So in 1971-73 Dennis Richie wrote the C language in which he kept the B syntax but added data types and other changes that needed to be made. It was built for power and speed and developed for UNIX systems. Its also used for Windows, the MacOS and Linux. 2. 1980s – The programming language was Python, which was created by Guido van Rossum. It’s more of a scripting language and allows users to produce large quantities readable and functional code in a quick amount of time. Python teaches the user how to work with other languages, indentation, and modularity. It supports object – oriented, procedural, and functional program styles. C++ was also created and used many different types of computers. Program A was created by Arthur Whitney in 1988, and it focused on graphics, systems interfaces, utility support, and user community. 3. 1990s – The programming language was Ruby, which was created by computer scientist Yukihiro Matsumoto. It was created to have syntax without having to learn all the commands and specialized vocabulary in order to get going. Its object – oriented and supports procedural, imperative, and functional...

Words: 454 - Pages: 2

Premium Essay

Exploring Programming Languages

...1970’s Dartmouth Basic- was created by John Kemeny and Thomas Kurtz on May 1, 1964. Basic stands for Beginners All-purpose Symbolic Instruction Code . The aims of the BASIC system were: to develop a system and language that was friendly, easy to learn and use, to introduce computing as an adjunct to other courses, to operate an open access policy (i-programmer.info, 2010). Pascal- was created by Niklaus Wirth in 1972. He wanted a language suitable for teaching but for teaching computer science. It is best described as a simplified version of Algol. It was simplified both to make it easier to learn and to make it easier to compile (i-programmer.info, 2010). C- Was created by Ken Thompson iin the form of B and tweaked by Dennis Ritchie and renamed C in the 1970’s. It was the original code Unix was written in. Its function was for ease of use (i-programmer.info, 2010). Forth- was created by Charles H Moore in the 1970’s. The motivation behind this language was for both interactive execution of commands and the ability to compile sequences of commands for later execution (i-programmer.info, 2010). PLEX (Programming Language for EXchanges)- was created by Goran Hemdahl at Ericsson in the 1970’s. It is a special-purpose, pseudo-parallel and event-driven real-time programming language dedicated for AXE telephone exchanges, It is a propriatary language (i-programmer.info, 2010). 1980’s Atari ST BASIC – Atari commissioned MetaComCo to write a version of BASIC that...

Words: 1789 - Pages: 8

Free Essay

Pt1420 Unit 1 Research Ass 1

...| Exploring Programming Language | Unit 1 Research Assignment 1 | | | 5/3/2014 | PT1420 | The five most popular programming languages in the 1970’s were: 1970: Pascal 1972: C 1972: Smalltalk 1972: Prolog 1973: SQL Pascal The Pascal programming language was developed by Niklaus Wirth. It was created in 1968 but it wasn’t published until 1970. It was developed to provide the features other programming languages didn’t offer at that time. His main reason for developing Pascal was efficiently implement and run, to allow for the development of structured and well organized programs, and to serve as a tool to teach the important concepts of computer programming. The program was named after a mathematician named Blaise Pascal. It was used as the primary language in the Apple Lisa and for the Mac in the early years of the computer. SQL SQL, which is short for, Structured Query Language, was designed by an IBM research center in 1974-1975. The Oracle Corporation introduced it as a commercial database system in 1979, the first time it was introduced. It has been a favorite query language for the use of database management systems for the microcomputer and mainframes, but is being supported by the PC database. C C was created at the Bell Laboratory in 1972 by Dennis Ritchie. It was created for the purpose in designing UNIX. Prolog Was created from 1971-1973 and was distributed in 1974-1975. It was created not as a programming language on purpose but...

Words: 988 - Pages: 4

Premium Essay

Exploring Programming Languages

...Exploring Programming Languages 1970s * Pascal * Developed 1970 * originally developed by Niklaus Wirth, a member of the International Federation of Information Processing (IFIP) * principle objectives, allow for the development of well structured and well organized programs, and to serve as a vehicle for the teaching of the important concepts of computer programming * named after the mathematician Blaise Pascal * C * Developed 1972 * C was created by Dennis Ritchie at Bell Labs initially as a systems programming language for implementing UNIX * C++ was created by Bjarne Stroustrup at Bell Labs in the 1980s adding object orientation to C * Influenced ANSI C, Java * C/C++ has become the world’s most widely used systems programming language * ML * Developed1973 * Created by Robin Milner at University of Edinburgh * Initial focus: meta-language for program verification * One of the most widely used functional programming languages * Influenced Standard ML, Miranda, Haskell * SQL * Completed 1978 * First defined in 1970 by Dr. E.F. Codd, researcher for IBM, in a his Paper titled “A Relational Model of Data for Large Shared Data Banks “ * SQL would allow computer users to retrieve data from a variety of sources * Smalltalk * Released 1972 * first commercially-successful object-oriented language * Written and developed...

Words: 790 - Pages: 4

Free Essay

Program Design

...转:程序员练级之路 (作者:陈皓)作者: 吴江伟 建议: * 不要乱买书,不要乱追新技术新名词,基础的东西经过很长时间积累而且还会在未来至少10年通用。 * 回顾一下历史,看看历史上时间线上技术的发展,你才能明白明天会是什么样。 * 一定要动手,例子不管多么简单,建议至少自己手敲一遍看看是否理解了里头的细枝末节。 * 一定要学会思考,思考为什么要这样,而不是那样。还要举一反三地思考。 注:你也许会很奇怪为什么下面的东西很偏Unix/Linux,这是因为我觉得Windows下的编程可能会在未来很没有前途,原因如下:   * 现在的用户界面几乎被两个东西主宰了,1)Web,2)移动设备iOS或Android。Windows的图形界面不吃香了。 * 越来越多的企业在用成本低性能高的Linux和各种开源技术来构架其系统,Windows的成本太高了。 * 微软的东西变得太快了,很不持久,他们完全是在玩弄程序员。详情参见《Windows编程革命史》 所以,我个人认为以后的趋势是前端是Web+移动,后端是Linux+开源。开发这边基本上没Windows什么事。 启蒙入门 1、 学习一门脚本语言,例如Python/Ruby 可以让你摆脱对底层语言的恐惧感,脚本语言可以让你很快开发出能用得上的小程序。实践项目: * 处理文本文件,或者csv (关键词 python csv, python open, python sys) 读一个本地文件,逐行处理(例如 word count,或者处理log) * 遍历本地文件系统 (sys, os, path),例如写一个程序统计一个目录下所有文件大小并按各种条件排序并保存结果 * 跟数据库打交道 (python sqlite),写一个小脚本统计数据库里条目数量 * 学会用各种print之类简单粗暴的方式进行调试 * 学会用Google (phrase, domain, use reader to follow tech blogs) 为什么要学脚本语言,因为他们实在是太方便了,很多时候我们需要写点小工具或是脚本来帮我们解决问题,你就会发现正规的编程语言太难用了。 2、 用熟一种程序员的编辑器(不是IDE) 和一些基本工具 * Vim / Emacs / Notepad++,学会如何配置代码补全,外观,外部命令等。 * Source Insight (或 ctag) 使用这些东西不是为了Cool,而是这些编辑器在查看、修改代码/配置文章/日志会更快更有效率。 3、 熟悉Unix/Linux Shell和常见的命令行 * 如果你用windows,至少学会用虚拟机里的linux, vmware player是免费的,装个Ubuntu吧 * 一定要少用少用图形界面。 * 学会使用man来查看帮助 * 文件系统结构和基本操作 ls/chmod/chown/rm/find/ln/cat/mount/mkdir/tar/gzip … * 学会使用一些文本操作命令 sed/awk/grep/tail/less/more … * 学会使用一些管理命令 ps/top/lsof/netstat/kill/tcpdump/iptables/dd… * 了解/etc目录下的各种配置文章,学会查看/var/log下的系统日志,以及/proc下的系统运行信息 *...

Words: 817 - Pages: 4

Free Essay

Advantages of Phase Modulation

...Python Reference Manual Release 2.3.3 Guido van Rossum Fred L. Drake, Jr., editor December 19, 2003 PythonLabs Email: docs@python.org Copyright c 2001, 2002, 2003 Python Software Foundation. All rights reserved. Copyright c 2000 BeOpen.com. All rights reserved. Copyright c 1995-2000 Corporation for National Research Initiatives. All rights reserved. Copyright c 1991-1995 Stichting Mathematisch Centrum. All rights reserved. See the end of this document for complete license and permissions information. Abstract Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its 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. This reference manual describes the syntax and “core semantics” of the language. It is terse, but attempts to be exact and complete. The semantics of non-essential built-in object types and of the built-in functions and modules are described in the Python...

Words: 14272 - Pages: 58