Hard drive upgrades

One of the hard drives in my computer had been spitting out errors for a little while now, so over the weekend I revamped the storage in my computer. I’m also expecting the simulation work I’ll be doing for my PhD will require a decent amount of storage, so I picked up a couple 4 TB WD Blue hard drives from Newegg. They were a decent price, and brought my computer from a total of about 3 TB up to just over 10 TB of storage.

The failing drive (1 TB) got replaced, and I also took out an old 250 GB IDE drive that I was using as a place to temporarily dump files. That left a 1 TB drive, two 500 GB drives, and the 250 GB SSD.

After doing a bit of cable gymnastics in the case, the two new drives got installed and plugged in. Current configuration now has the SSD as the boot drive and root partition. I made the 1 TB drive my home directory, and decided to lump the 4 TB and 500 GB drives into a single LVM2 volume group for my primary storage. I considered a RAID 1 or 10 configuration, but with time and brain space constraints, a JBOD setup seemed like it would be easier. I might change my mind later on though.

If it turns out I need even more storage, the case still has one empty drive bay that I stick another drive into.

CPU transplant successful!

The Xeon W3690 transplant was a success!

A Xeon CPU upgrade for the computer

I picked up a used Xeon W3690 CPU from eBay to upgrade the Core i7-930 currently powering my computer. Browsing around eBay, I found several for under $80. For two extra cores and a few hundred more MHz, it seemed like a pretty good deal to me so I picked one of them and bought it.

The existing CPU still works fine, but after seeing a few friends talking about computer upgrades, I did a bit of research to see what I could put into mine to give it a bit of a boost without having to do a complete computer replacement.

My choices were dictated by the motherboard revision (a Gigabyte GA-X58A-UD5 Rev 1.0) and BIOS version (F7e). The best CPUs supported by this combination were the Core i7-970 and the Xeon W3690.

Doing my quasi-semi-annual computer cleaning and replacing the CPU will be a good weekend project. With luck, this computer will be up and running with a “new” and faster brain.

Validation in Laravel Artisan commands

One of the things I like most about using Laravel is that most everything I’ve needed to do so far is pretty intuitive.  If I try to code up something the way I think it’s supposed to work, usually it does.

I’ve been working on adding some new Artisan commands to my equipment database to handle some of the back-end administrative tasks that I’d normally have to fire up a browser for.

Naturally I want to validate the input.  Laravel’s got some really nice validation rules that would be nice to use in my new artisan commands.  The documentation covers doing validation on incoming HTTP requests, but isn’t clear on whether the Validator can be used more generically.

Looking at the documentation for manually creating validators, a Validator instance takes two arrays: an array with the data to be validated, and an array containing the validation rules.

It seemed like I could use the Validator facade pretty much anywhere as long as I had arrays of data and validation rules.  In my artisan commands, I added a use statement for the Validator facade,

use Illuminate\Support\Facades\Validator;

and the rest mostly followed the manual validator creation docs.

$validator = Validator::make($model->toArray(), [
  // validation rules

if ($validator->fails()) {
  // show validation errors and exit
else {
  // do stuff with validated data

Much happiness ensued when I tested things out and saw that the validations were working just like I thought they should.