Pages

Thursday, December 29, 2016

A Concept Diagram is a graphic organizer that clarifies central concepts in a reading selection and in relating similar or associated information to this key idea. The steps to build a Concept Diagram:

Convey the central idea.Offer the overall concept.Note any key words.Classify characteristics.Explore examples and non-examples.Practice with new examples.Tie down the definition.

This sequence of steps provides a process for organizing and interpreting the content of a reading selection.

Steps to a Concept Diagram:

Select a reading text for discussion.

Have students identify the overall theme of the document and the major subthemes or concepts that together make up the document.

Ask students to write down all key words in the selection and then group these terms in logical categories.

Encourage students to suggest examples and non-examples of the key terms and concepts identified.

Have the students produce a final, formal definition of key words and concepts by combining the things they learned when categorizing the words and providing examples.

This screencast covers the basics of GraphQL. Demonstrates a simple hello GraphQL program using graphql gem and exposing a person has many friends nested ActiveRecord relationship as an API using graphql. The Rails engine graphiql-rails is used to play with the backend API.

Sunday, December 25, 2016

Orthogonality is one of the most important properties that can help make even complex designs compact. In a purely orthogonal design, operations do not have side effects; each action (whether it's an API call, a macro invocation, or a language operation) changes just one thing without affecting others. There is one and only one way to change each property of whatever system you are controlling.

- The Art of UNIX Programming

Orthogonality means that features can be used in any combination, that the combinations all make sense, and that the meaning of a given feature is consistent, regardless of the other features with which it is combined.

- Programming Language Pragmatics

An orthogonal language is one in which you can express a lot by combining a small number of operators in a lot of different ways.

- On Lisp

The Principles of Modular and Maintainable Design by Jens Dietrich

Orthogonality is a concept often used to describe modular and maintainable software. The concept of orthogonality is based on the Greek word orthogōnios, meaning "right-angled." It is often used to express the independence between different dimensions. When an object moves along the x-axis in a three-dimensional space, its y and z coordinates don't change. Change in one dimension does not cause change in another dimension, which means that one dimension cannot cause side-effects for others.

This explains why the concept of orthogonality is often used to describe modular and maintainable software design: thinking about systems as points in a multi-dimensional space (spawned by independent, orthogonal dimensions) helps software developers to ensure that our changes to one aspect of system will not have side-effects for another.

Orthogonality is a powerful concept because it enables us to establish a relatively simple mental model for complex application use cases. In particular, we can focus on one dimension while ignoring other aspects.

Testing is a common scenario where orthogonality is useful. We can test the functionality of log levels using a suitable fixed pair of an appender and a layout. Orthogonality ensures us that there will be no surprises: log levels will work the same way with any given combination of appender and layout. Not only is this convenient (there is less work to do) but it is also necessary, because it would be impossible to test log levels with every known combination of appender and layout. This is especially true given that Log4j, like many software tools and utilities, is designed to be extended by third parties.

Designing and coding for orthogonality

The key idea is to use abstraction. Each dimension of an orthogonal system addresses one particular aspect of the program. Such a dimension will usually be represented by a class. Each of these classes represent a dimension, while the objects represents the points within the given dimension.

Peter Keen has evaluated some of the options available and he says in his blog:

sqlite3 has built-in FTS but I would have to build a bunch of stuff around it.xapian is a FTS engine but like with sqlite3 I'd have to build stuff.elasticsearch would work but it's an external process that I'd have to run and it's an awful lot of overheadSome kind of hosted elasticsearch or solr provider would work, but again lots of overhead and not free and I'm then dependent on their uptime.

Whistlepig is a small text search index. This is written in C. Small as in not very many features and not much code, but the features that are there are perfect for my needs:

Saturday, December 24, 2016

You can use Curl with -I switch to test if the Cloudfront configuration is working. You can see that when I hit
media subdomain, the first time it misses the Cloudfront, the next request hits the Cloudfront. This means Cloudfront is configured properly.

3. Upload the image to the S3 bucket. You can also access the image using SSL like this: https://s3.amazonaws.com/images.rubyplus.com/no-op-cgol.png

This is the image for my upcoming book TDD in Ruby to be released by Apress in 2017. The SSL is important because when your site uses SSL and some of the links are not https, the browser will show SSL errors in the SSL padlock.

Tip: Use http://jsonlint.com to validate bucket policy and fix issues before configuring the bucket.

Use Amazon CloudFront CDN to Speed Up Image Access

Go to Cloudfront and click Create Distribution, provide the bucket name and accept the default values for other form fields. It will take some time for the changes to take effect.

Once the changes are complete, you can access the images using Cloudfront URL like this:
http://images.rubyplus.com.s3.amazonaws.com/no-op-cgol.png

Using your Own Subdomain to Access Assets

You can create CNAME using the UI provided by your host to map the URL:

http://xyz123.cloudfront.net to http://images.yourdomain.com

I host my Rails app on Linode. I used the dashboard of Linode to map images.rubyplus.com to the cloudfront.net URL by creating a CNAME. Now, we can access the same image without s3.amazonaws.com like this:

Wednesday, December 14, 2016

Bundler could not find compatible versions for gem "sass": In Gemfile: compass-rails (~> 2.0.4) was resolved to 2.0.4, which depends on compass (~> 1.0.0) was resolved to 1.0.0, which depends on sass (< 3.5, >= 3.3.13)

sass-rails (~> 4.0.2) was resolved to 4.0.2, which depends on sass (~> 3.2.0)

compass gem has an indirect dependency on sass gem version >= 3.3.13 or < 3.5compass-rails gem has indirect dependency on sass gem version == 3.2

Ideally, the software should state the cause of the problem and the resolution in a easy to understand language. In this case, The sass gem must be the same for sass-rails and compass-rails gems to install successfully.

Have all necessary information before you start (data,references,tables,figures,etc.)

Before you Start

Spend time thinking about the content. Write down ideas in a free form. Create a general outline:

What is the message?

What is the new contribution you want to describe?

What do you want to convince people?

Summarize these ideas in bullets that each will eventually become a paragraph. This is like a To Do list. Later, you will categorize this list according to the structure of the book.

Organize bullets in a logical structure and develop them into a few key sentences. Don't worry about the correctness, details at this point. Once you categorize your notes for each category, you start expanding those bullets in each category into sentences.

If this outline is convincing, the chapter is successful. At this stage, have a technical reviewer review your outline.

I wanted to find out what is depending on eventmachine in my project. Because, concurrent-ruby is a better alternative to eventmachine. My suspicion was that sucker_punch gem was using it. I was wrong because as you see in the about output, it is not the culprit. The version 2.0 of sucker punch uses concurrent-ruby. Luckily, only the development environment has dependency on the eventmachin gem.

Shitty error message when the Internet connection is turned off. When you do:

git remote show origin

Error is:

ssh: Could not resolve hostname bitbucket.org: nodename nor servname provided, or not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

This is meaningless error message. Does not tell the user in simple language the cause of the problem and how to resolve it. How about:

Hey, you dummy, you are not connected to the Internet. Check your Internet connection and try again.