background preloader

Learn Web Development with Ruby on Rails Tutorial & Example app

Learn Web Development with Ruby on Rails Tutorial & Example app

Teach the web Your browser may lack functionality needed by Webmaker to function properly. Please upgrade your browser for an improved experience. Welcome to Webmaker! That username is taken You must choose a username Invalid username. All usernames must be between 1-20 characters, and only include "-", "_" and alphanumeric characters You must agree to our terms and conditions. Let's teach the web! We've got creative ways to help anyone teach web literacy, digital skills and making. Learn Web Development with the Ruby on Rails Tutorial Michael Hartl Contents Foreword My former company (CD Baby) was one of the first to loudly switch to Ruby on Rails, and then even more loudly switch back to PHP (Google me to read about the drama). Though I’ve worked my way through many Rails books, this is the one that finally made me “get” it. The linear narrative is such a great format. Enjoy! Derek Sivers (sivers.org) Founder, CD Baby Acknowledgments The Ruby on Rails Tutorial owes a lot to my previous Rails book, RailsSpace, and hence to my coauthor Aurelius Prochazka. I’d like to acknowledge a long list of Rubyists who have taught and inspired me over the years: David Heinemeier Hansson, Yehuda Katz, Carl Lerche, Jeremy Kemper, Xavier Noria, Ryan Bates, Geoffrey Grosenbach, Peter Cooper, Matt Aimonetti, Gregg Pollack, Wayne E. About the author Michael Hartl is the author of the Ruby on Rails Tutorial, the leading introduction to web development with Ruby on Rails. Copyright and license Welcome to the Ruby on Rails Tutorial.

Python / Functions Python: Functions Python/Functions at YouTube slides PDF Hello, and welcome to the eighth episode of the Software Carpentry lecture on Python. In this episode, we'll show you how functions work, and how to define new functions of your own. First, a bit of design philosophy. Instead, languages should make it easy for people to create what they need to solve their specific problems. Every language does this by allowing programmers to define functions that carry out new higher-level operations. Which leads some people to regard programming as the act of creating a mini-language in which the solution to the original problem is trivial. In Python, we define new functions using the keyword def. For example, here's a function that does nothing but return a particular string to its caller. To call it, we just use the function's name, followed in this case by empty parentheses. To make functions more useful, we can give them parameters. Let's have a closer look at what happens when we call it.

2.2. Declaring Functions Python has functions like most other languages, but it does not have separate header files like C++ or interface/implementation sections like Pascal. When you need a function, just declare it, like this: def buildConnectionString(params): Note that the keyword def starts the function declaration, followed by the function name, followed by the arguments in parentheses. Multiple arguments (not shown here) are separated with commas. Also note that the function doesn't define a return datatype. The argument, params, doesn't specify a datatype. 2.2.1. An erudite reader sent me this explanation of how Python compares to other programming languages: statically typed language A language in which types are fixed at compile time. dynamically typed language A language in which types are discovered at execution time; the opposite of statically typed. strongly typed language A language in which types are always enforced. weakly typed language

PythonBooks - Learn Python the easy way ! 2.1.4 String manipulation | GEOG 485: GIS Programming and Automation Printer-friendly version You've previously learned how the string variable can contain numbers and letters and represent almost anything. When using Python with ArcGIS, strings can be useful for storing paths to data and printing messages to the user. There are also some geoprocessing tool parameters that you'll need to supply with strings. Python has some very useful string manipulation abilities. Concatenating strings To concatenate two strings means to append or add one string on to the end of another. You may need to concatenate strings when working with path names. The following example, modified from one in the ArcGIS Help, demonstrates this concept. String concatenation is occurring in this line: outputPath = resultsFolder + featureClass. The above example shows that string concatenation can be useful in looping. Casting to a string Sometimes in programming you have a variable of one type that needs to be treated as another type. Now try to run it. Readings

Python String Manipulation We already saw a brief introduction to the Python string type. In this section we will try to further explore how strings can be used in this language. Length of a String Finding the length of a string is done using the built-in function len(): Strings Are Immutable Strings in Python are immutable i.e. they cannot be changed once created. Concatenation and Substrings Concatenation of strings in Python is done using the plus operator. We can use * as a short hand notation for concatenating a string with itself multiple times: Other types such as ints and floats are not forced into strings when on either side of the concatenation operator: Output: => TypeError: unsupported operand type(s) for +: 'int' and 'str' We can, however, convert the int into a string and then perform the concatenation: Similarly we can use str() to convert floats (and other types) to a string. Single characters can be read from a string using the indexing operator (brackets, []). Format Strings String Methods

Python Programming Exercises - Free PDF downloads Sponsored High Speed Downloads Python programming | exercises - Technical University of Denmark Python programming | exercises Extra task After installing Cherrypy see that it works. Try to get the bonus-sqlobject.py from the tutorial to work. Python Programming Exercises Python Programming Exercises Control Structures 2.1 Write a program that inputs a 4 digit year and then calculates whether or not it is a leap year. A Python Book: Beginning Python, Advanced Python, and Python ... 3.5.3 if: statement exercises.....154 3.5.4 for: statement exercises ... oriented programming, Python enables us to write clear, logical applications for ... Python programming exercises , I - UZH - GC3: Grid Computing ... Grid Computing Competence Center Python programming exercises, I Riccardo Murri Grid Computing Competence Center, Organisch-Chemisches Institut, University of Zurich Python course in Bioinformatics - Donald Bren School of ... Programming in Python – Exercises - NeuralEnsemble Python for Rookies

Getting the Hang of GitHub A project is always more fun when you've got friends working with you, but how can do it when working on a coding project? I'll keep my keyboard to myself, thanks. Enter GitHub. Disclaimer This tutorial will assume that you're familiar with Git, arguably the best distributed version control software there is. Getting Started Of course, you'll need a GitHub account if you're to experience any of the social coding goodness. Creating an Account There are several different plans you can use, depending on your needs. Open up your terminal and type this: ssh-keygen -t rsa -C "your@email.com". Warming up to the Interface When you first log in, you'll see the dashboard; it's something like this: In the top right corner, you can see a toolbar with options for controlling your account. The main panel offers a number of actions; later, it will be used to keep you up to date on projects you're interested in. It's all about Repos Creating a repository is pretty simply. Commits Network Graphs Fork Queue

Python Fundamentals Tutorial : Variables A variable in Python is defined through assignment. There is no concept of declaring a variable outside of that assignment. >>> ten = 10 >>> ten 10 In Python, while the value that a variable points to has a type, the variable itself has no strict type in its definition. >>> ten = 10 >>> ten 10 >>> ten = 'ten' >>> ten 'ten' >>> 'Day ' + 1 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: cannot concatenate 'str' and 'int' objects This behavior is different from some other loosely-typed languages. d8> 'Day ' + 1 Day 1 In Python, however, it is possible to change the type of an object through builtin functions. >>> 'Day ' + str(1) 'Day 1' This type conversion can be a necessity to get the outcome that you want. By converting one of the operands to a float, Python will perform float division and give you the result you were looking for (at least within floating point precision). >>> float(10) / 3 3.3333333333333335 >>> 10 / float(3) 3.3333333333333335

Getting Started: Building a Chrome Extension Extensions allow you to add functionality to Chrome without diving deeply into native code. You can create new extensions for Chrome with those core technologies that you're already familiar with from web development: HTML, CSS, and JavaScript. If you've ever built a web page, you should feel right at home with extensions pretty quickly; we'll put that to the test right now by walking through the construction of a simple extension that will give you one-click access to pictures of kittens. Kittens! We'll do so by implementing a UI element we call a browser action, which allows us to place a clickable icon right next to Chrome's Omnibox for easy access. Clicking that icon will open a popup window filled with kittenish goodness, which will look something like this: If you'd like to follow along at home (and you should!) The very first thing we'll need to create is a manifest file named manifest.json. The next block defines the extension's name, description, and version.

Python Training Course | Classes | Courses | Class | Public | Private | Online | Onsite | Individuals | Hands-on | Bootcamps - Firebox Training Advanced Python Programming – PYT200 – 3 Days This Advanced Python three day training class covers topics from basic syntax to more advanced topics such as metaclasses. Our Advanced Python training Class includes the syntax for both Python 2 and 3. The Advanced Python course is 3 days and covers more advanced topics compared to our introduction class. Advanced Python training course provides participants intermediate/advanced level topics of using the Python programming language. Check out the quick Python video tutorial to see some of what you will learn! Advanced Python Programming – PYT 200 – 3 Days ENROLL NOW - Individuals & Small GroupsGet a Group Quote This Advanced Python training class covers topics from basic syntax to more advanced topics such as metaclasses. Location Instructor-Led Online Course ID: PYT200 Duration: 3 days Audience: Open to all those that are new to the Python programming language. Advanced Python Training Course Outline Python Classes Unit Testing Working with XML

A Python Book: Beginning Python, Advanced Python, and Python Exercises 2.2 Regular Expressions For more help on regular expressions, see: 2.2.1 Defining regular expressions A regular expression pattern is a sequence of characters that will match sequences of characters in a target. The patterns or regular expressions can be defined as follows: Literal characters must match exactly. Because of the use of backslashes in patterns, you are usually better off defining regular expressions with raw strings, e.g. r"abc". 2.2.2 Compiling regular expressions When a regular expression is to be used more than once, you should consider compiling it. import sys, re pat = re.compile('aa[bc]*dd') while 1: line = raw_input('Enter a line ("q" to quit):') if line == 'q': break if pat.search(line): print 'matched:', line else: print 'no match:', line Comments: We import module re in order to use regular expresions.re.compile() compiles a regular expression so that we can reuse the compiled regular expression without compiling it repeatedly. 2.2.3 Using regular expressions Notes:

Python:Basics:Strings - Python From Python Strings are variables that hold a contiguous group of characters. Strings in the Real World A string in the real world is a cord, wire, gut, or, well, "string" of some substance that holds together from beginning to end. The term "string" has become so intuitive to us that we use it in other contexts. Strings in Python In Python, a string is more than just a contiguous group of characters. Suppose that I want to make a string, and then turn it to upper case. $alphabet = "abcdefghij"; $upperCaseAlphabet = strtoupper($alphabet); In Python, I would write: alphabet = "abcdefghij" # Using method of string object upperCaseAlphabet = alphabet.upper() or import string # Using string class itself upperCaseAlphabet = string.upper(alphabet) In PHP, $alphabet is just that, a group of letters from a - j. However, in Python, the statement creates a string object with all of the properties and methods of the string class. alphabet knows how to upper case itself. stringNumber = "9" print stringNumber + 9

Related: