Skip to content

coding

How Complex Is It To ‘Re-skin’ WordPress Pages

Someone asked me this recently, and further explained themselves:

I have a WordPress template that I’m using and I want to completely re-design a couple of pages (visual changes only). I can create the front-end layouts, but I’m interested in learning about how complex/lengthy the process can be to implement said front-end layout, or if it’s a fairly minimal task.

Here’s what I said back: It depends on how familiar with frameworks where the front-end is generated on the server-side (HAML with Ruby, say, as another example.) WordPress uses PHP based server-side rendering –

Read More →

Some Common Tricks with Ruby on Rails

Today we will use Ruby on Rails along with some Javascript libraries to code a few common patterns –

  • Autocomplete in a text box
  • Uploading files by dragging and dropping them into an area inside a browser.

Autocomplete

The Javascript library, jQuery.token-input, is great for quickly building a Javascript-based autocomplete solution. You have to do only three things to get started:

Read More →

Setting Up A New Ubuntu Box: My Personal Recipe

Here are all the things I like to do when I am setting up a new Ubuntu box (works on Ubuntu 14.04 x64, YMMV).

This first set of steps is best executed as the root user on the system.

    1. Update your Debian repositories: apt-get update
    2. Install Emacs (this is my personal favorite editor) – apt-get install emacs25
    3. Set up Apache2 with
      apt-get install apache2
      a2enmod userdir

      This also installs ufw.

    4. Secure Apache – make sure to add the UserDir directive. The above module will allow it. Restart Apache.
  1. Create a www-data user, and a home folder (/var/www). Give ownership of the home folder to this user, use bash as the login shell, and set up a password. Set up SSH for this user, enable them to login to the home directory, give them sudo privileges.
    usermod -s /bin/bash -d /var/www www-data
    usermod -G sudo www-data
    
  2. Enable ufw to only allow ports 22, 80, 443 – additionally, enable 220 and change the SSHD configuration to listen at port 220 instead of 22 by editing (more security tips at the OpenSSH configuration page):
    apt-get install vim
    vim /etc/ssh/sshd_config
    service ssh restart
    
  3. Apache will need the following modules enabled:
    1. a2enmod ssl
    2. a2enmod rewrite
  4. You need to be able to compile new packages – you need apt-get install build-essential
  5. Some useful packages don’t come pre-installed:
    apt-get install zip sendmail
  6. Sendmail: Configuring this is weird. You need to do a bunch of stuff to enable TLS and SASL, and then configure /etc/hosts to have an FQDN.
  7. Install some goodies for Rails – namely, Ruby, Ruby Gems, QT, Phusion Passenger and Postgres. See more details below.

Read More →

Why Is There NoSQL? Who Took All The SQL?

I’ve been meaning to wade into the NoSQL debate for a while but couldn’t figure out exactly where to start. A comment on a Reddit post about what “backend to choose” got me excited enough to write:

What is a NoSQL DB? That term means nothing – all DBs need a “structured query language” to convert its storage schema into an abstraction you use in your code. “NoSQL” usually means ‘NoSchema’ – or rather, “NoFixedSchema.”

Read More →

HTML and SQL Basics Using A Ruby Web Scraper Example

In this lesson, we will learn some basics about two languages that are fundamental to how (many) web applications work – HTML and SQL. To make this a bit real, the goal of this exercise will be to write a script in Ruby that can do the following: look at the newest stories on Reddit, and insert into a local database the following information about the top 10 of those stories – the author, how many points it has, its category, its title, and the date it was posted.

HTML, or Hypertext Markup Language, is the syntax understood by most browsers. It has been around for over thirty years and was designed initially by Tim Berners-Lee (who recently appeared on the Internets pleading for your help in keeping the Internets open – go watch this video!)

SQL, or Structured Query Language, is used in creating and querying what are called “relational” databases – where the stored data refers to various objects that have relationships to each other (a typical example would be an e-commerce database, where products are related to the companies that sell them.)

Read More →

Configuring Postfix and Dovecot: A Few Gotchas

There’s plenty of information online on how to configure Postfix and Dovecot but it turned out that there were a few last-mile steps that aren’t adequately documented. I remember my first go-around was pretty hairy, but the second time, I found a better starting point and learned from the first experience. So I decided to set things down, both for my benefit and that of others.

Read More →