Blog

Herein you shall find hopefully informative tidbits related to software development, especially on the web.  Mostly these are my notes I’ve written so next time I have to do some task I can look up how I did it before.

Comments are disabled, for now.  Please use the contact form or email me if you what to say “that’s great” or “this is completely wrong, wrong, wrong”.

Cheers.

Debian no public keys available message Posted in: Linux - sudo aptitude install debian-keyring debian-archive-keyring
Disable ipv6 Posted in: Linux - What services are using ipv6 on the server?   None!   Sounds like a potential security issue.  These notes cover disabling ipv6 on Debian Wheezy. Edit /etc/sysctl.conf and add those parameters to kernel. Also be sure to add extra lines for other network interfaces you want to disable IPv6. net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 … Continue reading Disable ipv6
Enable SELinux on Xen guest running Debian Wheezy Posted in: Linux - This post describes how to get SELinux running on a Xen guest (domU) that is running Debian Wheezy. First, you need a guest that is booted by pvgrub and running a distro-supplied kernel ie, a regular (non-Xen) linux image. All that is convered in my previous post on booting unprivileged domains in Xen with pvgrub … Continue reading Enable SELinux on Xen guest running Debian Wheezy
Using PvGrub to Start Xen Guests on Debian Wheezy Posted in: Linux - Goal: Have guest domains boot with their own kernel, or in other words, be able to run a kernel different than the host. Moreover, this means maintainer of the guest can be responsible for dealing with kernel updates. You can do this with pygrub, but there are reasons you may want to use pvgrub. Note … Continue reading Using PvGrub to Start Xen Guests on Debian Wheezy
JavaScript Check for Duplicate IDs on Page Posted in: JavaScript - Using jQuery: function check_for_duplicate_ids() { // iterator over every element on page w/ id attribute set $('[id]').each(function(){ // find all elements on page by id where id is this.id var ids = $('[id="'+this.id+'"]'); if(ids.length>1 && ids[0]==this) { // we have more than 1 id and the id is same as // element we are iterating … Continue reading JavaScript Check for Duplicate IDs on Page
CIDR Notation Explained Simply Posted in: Uncategorized - A range of IP addresses can be expressed very simply with CIDR notation. I don’t want to discuss why classless inter-domain routing was developed, but only demonstrate how you can figure out what the CIDR notation for a range of IP addresses, or determine what the range of IP addresses are represented by a CIDR … Continue reading CIDR Notation Explained Simply
Bash one-liners Posted in: Linux - Get a list of URLs for a website using wget: wget -r -nv -nd –delete-after “your-url-goes-here” 2>&1 | sed -n ‘/->/{/URL:/s/.*URL:\([^ ]*\).*/\1/;/^[ ]*$/d;p}’
Capture Fatal PHP Errors for Logging Posted in: PHP - When code runs without a user interface, for example a script invoked by cron, there often is not an easy way to see what errors are occuring. Another example would be php invoking another php script using exec(), for example. Here are some common fatal errors: unknown class referenced, unknown method called and parse error. … Continue reading Capture Fatal PHP Errors for Logging
Burn CDs from the Command Line Posted in: Linux - To burn cd images from the command line in Debian squeeze you need two packages: (1) genisoimage (2) wodim To make an ISO image of a directory simply type: genisoimage -o outfile_name some_directory To burn the image use wodim. First figure out which optical drive to use by asking wodim for a list: tom@osmium:~$ wodim … Continue reading Burn CDs from the Command Line
log4php example Posted in: PHP - This log4php example demonstrates how to the log4php library in a non-trivial way. log4php is a version of the Apache log4J package ported to PHP5. Please refer to the apache project for complete details. log4php is a powerful logging mechanism that allows you to use a configuration file to specify what types of messages you … Continue reading log4php example