It is possible to use the comments system built into Facebook directly on your WordPress site. But why would you want to do this?
More Conditional Logic in Ruby!
Following from the previous tutorial on Conditional Logic in Ruby, look at this example:
# Let the user guess. print "Enter heads or tails? " hort = gets.chomp unless hort == 'heads' || hort == 'tails' print "I _said_ heads or tails. Can't you read?\n" exit(1) end # Now toss the coin. toss = if rand(2) == 1 then "heads" else "tails" end # Report. print "Toss was ", toss, ".\n" print "You Win!\n" if hort == toss
Some more amazing if
lore:
- The
unless
keyword is likeif
, but uses the opposite sense of the test: The code is run if the test is false. - As with many things in Ruby,
if
may look like a statement, but it is actually an expression, with a return value. - The
if
has a postfix form where the condition comes last. This works withunless
as well.
Conditional Logic in Ruby
This is the conventional use of the if
in perl. Notice that there is no need for curly braces ({
and }
). The body of the if
ends with the appropriate keyword, end
, else
or elsif
. The then
word is generally optional, though you need it if you want to put start the body on the same line as the if
, the way the last statement does.
Create a virtual encrypted disk within a file and mount it as a real disk
VeraCrypt is a free open source disk encryption software for Windows, Mac OSX and Linux based on (the now defunct) TrueCrypt 7.1a. Features include:
- Creates a virtual encrypted disk within a file and mounts it as a real disk.
- Encrypts an entire partition or storage device such as USB flash drive or hard drive.
- Encrypts a partition or drive where Windows is installed (pre-boot authentication).
- Encryption is automatic, real-time(on-the-fly) and transparent.
- Parallelization and pipelining allow data to be read and written as fast as if the drive was not encrypted.
- Encryption can be hardware-accelerated on modern processors.
- Provides plausible deniability, in case an adversary forces you to reveal the password: Hidden volume (steganography) and hidden operating system.
Subversion Server Howto
Your personal code repository in DkIT can be accessed using the following URL, replace [yourusername] with your login username.
https://svn.comp.dkit.ie/repos/[yourusername]
e.g. for bloggsj
https://svn.comp.dkit.ie/repos/bloggsj
How to Style Contact Form 7 Forms in WordPress
Contact Form 7 can manage multiple contact forms in WordPress, plus you can customize the form and the mail contents flexibly with simple markup. The form supports Ajax-powered submitting, CAPTCHA, Akismet spam filtering and so on.
The biggest downside is that the out of the box forms you add are very plain looking. Thankfully, Contact Form 7 can be easily styled using CSS in your WordPress theme. In this turorial, we will show you how to style contact form 7 forms in WordPress.
Parallel Assignment in Ruby
A parallel assignment sets several variables at once. All right sides are computed before any variable is assigned, so all right side values are computed with the old variable values. This is very convenient for swapping two values without using a temporary.
GIMP as a Photoshop Alternative
For those of you who are unaware of GIMP, here is how the software describes itself:
GIMP is the GNU Image Manipulation Program. It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Understanding the Linux file system
File I/O in Ruby
This version opens a file for writing, and writes its output to a file selected by the user. The second argument to open is the same as the second argument to a plain C fopen, except it will default to reading.
The object returned from open is class File.