Install and Serve a Rails Application from PHP Subdirectory Using Apache, Phussion Passenger and Ruby Enterprise Edition
Here is how to install a Rails application out of a subdirectory (rather than as a subdomain) with the Apache web server(Apache2). In this example I'm going to use my own blog which is a Wordpress installation and serve a Rails application from the subdir...
Written by Sean Behan on 06/17/2012
How to Fix Raw query must include the primary key with Django ORM
When running raw SQL queries in Django you must include a primary key otherwise an invalid query exception is raised. Normally this is fine but when running more complex queries a primary key may not be available or even make sense.
There is a simple ...
Written by Sean Behan on 07/15/2017
How to Extract all Images from a Webpage with Ruby
Here is a little ruby snippet that will download all pictures from a webpage.
Rather than using XPath, we are going to first reduce the source code to capture everything inside of quotes. Some websites use JSON w/in a script tag to lazy load images an...
Written by Sean Behan on 08/01/2018
How to Log and Query SQL Queries Hitting Your Database with MySQL
Here is some code just in case you want to look at and query the queries hitting your MySQL database.
Enter this from the mysql client console.
mysql> SET GLOBAL log_output = 'TABLE'
mysql> SET GLOBAL general_log = 'ON';
mysql> select event_ti...
Written by Sean Behan on 03/17/2018
Wildcard VirtualHost with Apache2
Set your ServerAlias directive to *.domain.tld - Here is a quick example.
<VirtualHost>
ServerName example.com
ServerAlias *.example.com
DocumentRoot /var/www/path/to/site
</VirtualHost>
Now everything.example.com and anything.example.co...
Written by Sean Behan on 06/17/2012