SSL is based on the mathematical intractability of resolving a large integer into its also-large prime factors. Using this, we can encrypt information using what’s called a “private-public key pair”. Certificate authorities can issue SSL certificates that verify the authenticity of such a secured connection, and on the same note, a self-signed certificate can be produced without third-party support. By the end of the tutorial, you will have a web server accessible via HTTPS using a self-signed certificate.
Understanding Binary
The basic building block in all computers is the binary number system.
This system is chosen since it consists of 1s and 0s only. Since computers contain millions and millions of tiny ‘switches’, which must be in the ON or OFF position, this lends itself logically to the binary system. A switch in the ON position can be represented by 1; a switch in the OFF position can be represented by 0.
Basic I/O in Ruby
The built-in gets
function simply reads a line and returns it as a string. The chomp
method from class String trims the line terminator. The prompts are generated with ordinary prints lacking a final newline.
# Get the parts of speech print "Please enter a past-tense verb: " verb = gets.chomp print "Please enter a noun: " noun = gets.chomp print "Please enter a proper noun: " prop_noun = gets.chomp print "Please enter a an adverb: " adv = gets.chomp # Make the sentence. print "#{prop_noun} got a #{noun} and\n#{verb} #{adv} around the block.\n"
Similarly, the to_f
method of class String converts the input string to a floating-point number.
print "Triangle height: " h = gets.to_f; print "Triangle width: " w = gets.to_f; area = 0.5*h*w print "Triangle height ", h, " width ", w, " has area ", area, "\n"
Play Background Audio on your WordPress website
Sometimes it is nice to low ambient sound effects in the background of your website, to set a mood or for some other purpose. There are plenty of websites where you can download such files, or you can make your own. It’s best to go for something that seamlessy loops and is not to distracting to the user.
Line Breaking with Ruby
Ruby generally uses line breaks instead of semicolons to separate statements. Lines can be continued by using a \ at the end, but this is rarely needed. If the line ends with pretty much anything that suggests there should be more, Ruby will continue on to the next line. This includes such things as ending with an operator, or inside parentheses or something else which needs to be closed.
The PDF Toolkit
Creating and reading PDF files in Linux is easy, but manipulating existing PDF files is a little trickier. Countless applications enable you to fiddle with PDFs, but it’s hard to find a single application that does everything. The PDF Toolkit (pdftk) claims to be that all-in-one solution. It’s the closest thing to Adobe Acrobat that we’ve found for Linux.
Setting Up a Linux Based Tomcat Server (for Java Applications)
Apache Tomcat is a web server and servlet container that is used to serve Java applications. Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies, released by the Apache Software Foundation. This tutorial covers the basic installation and some configuration of Tomcat on your Linux server.
Setup a Non-root User on a Linux Server (Ubuntu)
Having only one user, which is root, can be dangerous. Running your own personal server allows you the freedom of doing whatever you wish, so let’s make use of this by adding a user with sudo access instead of direct root access.
Ruby Hashes
Ruby hashes are similar to maps or dictionaries in other languages. They are essentially arrays whose subscripts are not limited to integer values. You can create them with the curly-bracked list notation shown below, but you can also assign to a subscript expression to add members. It’s not at all unreasonable to create a hash with empty brackets, then add members using subscripting.
How to Create a List of Forbidden Words for WordPress Titles
If you manage a multi-author blog and want authors to avoid using certain words or phrases, then this will come in handy. If an author has publishing rights, then the unwanted words can go live on your website. You can prevent this by taking away publishing privileges from users, but this means more work for you as you will have to review and publish posts yourself. So in this tutorial, we will show you how to create a list of forbidden words for WordPress titles.