- Published:
- September 6, 2011 – 9:59 am
- Author:
- By Dave
Doing some integration work with WHMCS, I found the need to export some of the announcements into Wordpress. Since there isn’t any native implementation of this, I found the best way is to export it directly from the database. The PHP code to do this is fairly easy…
Categories: Code Samples,PHP
Tagged: PHP, sample code, templates, whmcs, wordpress
- Published:
- May 15, 2011 – 8:16 am
- Author:
- By Dave
At home I have an (admittedly small) ZFS array set up to experiment with this neat newish raid technology. I think it has been around long enough that it can be used in production, but I’m still getting used to the little bugs/features, and here is one that I just found.
After figuring out that I had 2 out of 3 of my 1TB Seagate Barracuda hard drives fail, I had to give the array up for a loss and test out my backup strategy. Fortunately it worked and there was no data loss. After receiving the replacement drives in from RMA, I rebuilt the ZFS array (using raidz again) and went along my merry way. After 6 months or so, I started getting some funky results from my other drive. Thinking it might have some issue as with the others, I removed the drive and ran Seatools on it (by the way, Seatools doesn’t offer a 64-bit Windows version – what year is this?).
The drive didn’t show any signs of failure, so I decided to wipe it and add it back into the array to see what happens. That, of course, is easier said than done.
Categories: Linux,Shell,System Administration
Tagged: arrays, RAID, zfs
- Published:
- April 29, 2011 – 12:13 pm
- Author:
- By Dave
The hald – Hardware Access Layer Daemon – runs several processes in order to keep track of what hardware is installed on your system. This includes polling USB Drives and ‘hot-swap’ devices to check for changes along with a host of other tasks. You might see it running on your system as follows: 12342474 ? S 0:00 \_ hald-runner 2481 ? S 0:00 \_ hald-addon-acpi: listening on acpid socket /var/run/acpid.socket 2487 ? S 0:00 \_ hald-addon-keyboard: listening on /dev/input/event0 2495 ? S 41:47 \_ hald-addon-storage: polling /dev/hdc If your system is static and the devices do not change, you can actually disable this service using a policy entry. Create a file in your policy directory, for example /etc/hal/fdi/policy/99-custom.fdi. Add the text: 123456789<?xml version="1.0" encoding="UTF-8"?>….
Categories: Configurations,Linux,Shell,System Administration
Tagged: daemon, hald, hardware access layer
- Published:
- February 21, 2011 – 10:35 pm
- Author:
- By Dave
I’ve been busy lately on a number of projects, one of which is a programming class I am currently taking. The class itself is interesting, we are learning about the different types of programming languages. For our latest project, we were tasked with writing a simple program in Pascal. Pascal isn’t used too much any more since it lacks some of the features that most modern languages have, but it is good to know at least a little bit about it in case you ever run across some old Pascal programs in the wild. The syntax for pascal is a bit verbose, that is the main complaint about it. There are a number of others, but that is beyond the scope of this howto. Installing The Pascal Compiler on Ubuntu Installing Pascal in modern Ubuntu is a cinch. The Free Pascal Compiler, or fpc, is all that you need to….
Categories: Code Samples,Other Code,Ubuntu
Tagged: pascal, programming, Ubuntu
- Published:
- December 21, 2010 – 9:49 am
- Author:
- By Dave
According to “official” system administrator rules and guidelines you shouldn’t be adding so-called vain scripts to the login prompt – only utilities that will add something useful to the system (for example, current system load, memory and disk usage, etc). However I have some systems that I frequently connect to and thought it would be neat to add a random quote script to my bash login. That being said, this should only be done on ‘non-production’ systems and adds a security vector so please be careful where you use this. The goal of this is to add a little quote, at random, every time you log into your system. My thoughts were to do it not only as a little source of inspiration but also to add perspective to what I’m doing sitting in front of the computer all of the time. Originally I was going to try to write….
Categories: Code Samples,Linux,PHP,Shell
Tagged: bash, PHP, quotes
- Published:
- October 19, 2010 – 4:45 pm
- Author:
- By Dave
On a website I was working on recently I added the Google Analytics tracking code to the footer of a Smarty template, like this: footer.tpl: 1234567891011121314151617<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-XX']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true; ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’; var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s); })(); </script> </body> </html> However, since the javascript used by Google Analytics includes { and } tags, also used by the Smarty template engine, it tries to interpret this code and depending on your settings will either fail silently or or with an error such as this: Smarty error: [in footer.tpl line 148]: syntax error: unrecognized tag ‘var’ The fix is simple. Enclose your Google Analytics code, or other javascript code, with {literal} and….
Categories: Code Samples,JavaScript,Webdesign
Tagged: google analytics, JavaScript, smarty