Welcome to the Code Maven!
When you run a script written in Ruby you can put all kinds of values on the command line after the name of the script:
ruby code.rb abc.txt def.txt qqrq.txt
or like this:
ruby code.rb Hello --machine big -d -tl
The question though, how can the Ruby program know what was given on the command line?
Using simple values as in introduction to Ruby article will get you bored soon. It is much more interesting to create names that can hold values and then use those names. These names we call "variables", because usually their content can be changes.
Expect is tool to automate interaction with an application providing a CLI (Command Line Interface).
This can be anything you would type in on the command line and where you could C
Normally when you are using the command line you type in some command. That command prints out something.
You know that the command has finished by the appearance of the prompt. Then you know you can type in
something new to do something else. For example:
Normally when you are using the command line you type in some command. That command prints out something. You know that the command has finished by the appearance of the prompt. Then you know you can type in something new to do something else. For example:
While the two words crawling and scraping are usually interchangeable - at least when we are talking about the web - they still might have sime slightly different meaning. Crawling usually refers to the acto of going from page to page, traversing one or more sites. Scraping on the other hand usually refers to analyzing one or a very limited set of pages.
Or maybe I am just making up this distinction. Who knows what other means by these words?
Even though we are calling this applications "Single Page Applications", because we let the browser talk to the server behind the scenes, in the end in many application we'll have multiple "views". For example Gmail has the "list inbox" view and the "show single email" view and probably a few other views.
In the big counter example mostly we use programming languages, but this time I am going to use the MongoDB client to implement a counter. Later we can use this example to build counters using some programming language and MongoDB as the storage facility.
Ruby has two operators to generate a range of values. .. is inclusive and ... is exclusive.