September 21, 2015 by Daniel P. Clark

Introspection by Design in Ruby

If I have one pet peeve in Ruby it’s knowing state at a certain point in the program’s process.  Sure they make plugins for advanced diagnosis of this.  And when you start out learning to program it’s common practice to use puts everywhere to see what’s going on.  But this causes a lot of back…

Continue Reading »

August 15, 2015 by Daniel P. Clark

Install Ubuntu 15 Over the Network PXE/BootP/TFTP NetBoot

No Floppy?  No CD/DVD?  No Bootable USB ports?  No Problem! What I used for the installation: Debian based Linux Distro (CrunchBang++) on my Netbook to act as a Network boot server. Crossover cable (possible with 2nd hub/router setup) External USB Wifi adapter Software for implementation: atftpd lftp isc-dhcp-server Ubuntu 15.04 (Vivid Vervet) Netboot The Process…

Continue Reading »

July 25, 2015 by Daniel P. Clark

Play HD Youtube from the Raspberry Pi Command Line

Quick tip for most Linux distros.  You can just use the mpv player to play a Youtube video from the command line.  It’s a take off on mplayer2, and it has quvi built in.  Unfortunately it’s not available for the Raspberry Pi architecture. Now the Raspberry Pi has some pretty good graphics built in.  But…

Continue Reading »

July 23, 2015 by Daniel P. Clark

Ruby on the Raspberry Pi (free distro image)

I’ve customized my own Raspberry Pi distro (Raspbian) with Ruby 2.2.2 on it.  It’s available for download for you to use.  Here are the details. 4 GB image with 370Mb of free space at a download size of 1.9Gb DOWNLOAD Custom Ruby 2.2.2 on Raspbian Distro (ruby_rpi.img.bz2) User: pi Pass: raspberrypi Checksum:

This Raspbian…

Continue Reading »

June 21, 2015 by Daniel P. Clark

Ruby Refinements – Not quite ready for production

I recently looked for a method on Array for a boolean response on its uniqueness.  As Ruby currently doesn’t have one I figured it’s easy enough to write one.  Now Ruby’s refinements are fairly new and a nice feature to have around.  So I decided to write a benchmark for different ways to test the…

Continue Reading »

May 28, 2015 by Daniel P. Clark

Rails’ HashWithIndifferentAccess

A Ruby Hash is a very powerful collection type to use in Ruby.  When working in Rails sometimes you’ll have symbols as keys or sometimes they will be strings.  If you use a normal Hash these will store as different keys for the same name.

Rails has another version of Hash that will map…

Continue Reading »

May 16, 2015 by Daniel P. Clark

Switching From Unicorn to Puma on Heroku is Easy!

I’ve had my project running on Heroku with Unicorn for some time now.  Not that long ago Heroku put out a notice advising people to switch over to Puma as Unicorn doesn’t do well with low latency connections.  And you know that with the internet you’re always going to have people with slow connections accessing…

Continue Reading »

May 15, 2015 by Daniel P. Clark

Speed Up Your Rails Views By Deferring Changes

Nobody likes a slow website.  And the more notifications and content privileges you calculate beforehand the longer your web requests take to load and send.  The most efficient way to change this is to make as much of your site static as you can and defer your changes to after the page has fully loaded. …

Continue Reading »

May 13, 2015 by Daniel P. Clark

Rails: Don’t “pluck” Unnecessarily

Using pluck in Rails is both quick and efficient.  But there are cases where it’s not what you want to use.  For example if you’re selecting all users who have contacts, you might see something like this.

Rails’ where method allows for Arrays of items for lookup so the above code might turn into…

Continue Reading »

May 12, 2015 by Daniel P. Clark

Fake a SMTP Server with Python for Rails Testing

So I’ve been in the process of writing an integration test to verify the flow of registration through some unique conditions.  One thing I ran into while writing my Rails test was this error. Connection refused – connect(2) for nil port 25 After looking around at documentation on what to do for testing it seemed…

Continue Reading »

Page 3 of 11
1 2 3 4 5 11
1 2 3 4 5 11