• Home

  • Custom Ecommerce
  • Application Development
  • Database Consulting
  • Cloud Hosting
  • Systems Integration
  • Legacy Business Systems
  • Security & Compliance
  • GIS

  • Expertise

  • About Us
  • Our Team
  • Clients
  • Blog
  • Careers

  • VisionPort

  • Contact
  • MySQL replication monitoring on Ubuntu 10.04 with Nagios and NRPE

    Brian Buchalter

    By Brian Buchalter
    January 21, 2012

    If you’re using MySQL replication, then you’re probably counting on it for some fairly important need. Monitoring via something like Nagios is generally considered a best practice. This article assumes you’ve already got your Nagios server setup and your intention is to add a Ubuntu 10.04 NRPE client. This article also assumes the Ubuntu 10.04 NRPE client is your MySQL replication master, not the slave. The OS of the slave does not matter.

    Getting the Nagios NRPE client setup on Ubuntu 10.04

    At first it wasn’t clear what packages would be appropriate packages to install. I was initially misled by the naming of the nrpe package, but I found the correct packages to be:

    sudo apt-get install nagios-nrpe-server nagios-plugins

    The NRPE configuration is stored in /etc/nagios/nrpe.cfg, while the plugins are installed in /usr/lib/nagios/plugins/ (or lib64). The installation of this package will also create a user nagios which does not have login permissions. After the packages are installed the first step is to make sure that /etc/nagios/nrpe.cfg has some basic configuration.

    Make sure you note the server port (defaults to 5666) and open it on any firewalls …


    hosting monitoring mysql ubuntu

    Importing Data with RailsAdmin

    Steph Skardal

    By Steph Skardal
    January 19, 2012

    Update #1: Read an update to this functionality here.

    Update #2: This article was written in January of 2012, and the code related to the RailsAdmin actions no longer applies to the current release. Please make sure to read the RailsAdmin documentation regarding current action implementation.

    I’ve blogged about RailsAdmin a few times lately. I’ve now used it for several projects, and have included it as a based for the Admin interface my recent released Ruby on Rails Ecommerce Engine (Piggybak). One thing that I found lacking in RailsAdmin is the ability to import data. However, it has come up in the RailsAdmin Google Group and it may be examined in the future. One problem with developing import functionality is that it’s tightly coupled to the data and application logic, so building out generic import functionality may need more thought to allow for elegant extensibility.

    For a recent ecommerce project using RailsAdmin and Piggybak, I was required to build out import functionality. The client preferred this method to writing a simple migration to migrate their data from a legacy app to the new app, because this import functionality would be reusable in the …


    ecommerce ruby rails

    Using Disqus and Ruby on Rails

    Brian Buchalter

    By Brian Buchalter
    January 14, 2012

    Recently, I posted about how to import comments from a Ruby on Rails app to Disqus. This is a follow up to that post where I outline the implementation of Disqus in a Ruby on Rails site. Disqus provides what it calls Universal Code which can be added to any site. This universal code is just JavaScript, which asynchronously loads the Disqus thread based on one of two unique identifiers Disqus uses.

    Disqus in a development environment

    Before we get started, I’d recommend that you have two Disqus “sites”; one for development and one for production. This will allow you to see real content and experiment with how things will really behave once you’re in production. Ideally, your development server would be publicly accessible to allow you to fully use the Disqus moderation interface, but it isn’t required. Simply register another Disqus site, and make sure that you have your shortname configured by environment. Feel free to use whatever method you prefer for defining these kinds of application preferences. If you’re looking for an easy way, considering checking out my article on Working with Constants in Ruby. It might look something like this:

    # app/models/article.rb
    
    DISQUS_SHORTNAME …

    javascript rails

    ActiveRecord Callbacks for Order Processing in Ecommerce Applications

    Steph Skardal

    By Steph Skardal
    January 13, 2012

    As I recently blogged about, I introduced a new Ruby on Rails Ecommerce Engine. The gem relies on RailsAdmin, a Ruby on Rails engine that provides a nice interface for managing data. Because the RailsAdmin gem drives order creation on the backend in the context of a standard but configurable CRUD interface, and because I didn’t want to hack at the RailsAdmin controllers, much of the order processing logic leverages ActiveRecord callbacks for processing. In this blog article, I’ll cover the process that happens when an order is saved.

    Order Data Model

    The first thing to note is the data model and the use of nested attributes. Here’s how the order model relates to its associated models:

    class Order < ActiveRecord::Base
      has_many :line_items, :inverse_of => :order
      has_many :payments, :inverse_of => :order
      has_many :shipments, :inverse_of => :order
      has_many :credits, :inverse_of => :order
    
      belongs_to :billing_address, :class_name => "Piggybak::Address"
      belongs_to :shipping_address, :class_name => "Piggybak::Address"
      belongs_to :user
      
      accepts_nested_attributes_for :billing_address, :allow_destroy => true …

    ecommerce open-source piggybak rails

    Interchange loops using DBI Slice

    Richard Templet

    By Richard Templet
    January 13, 2012

    One day I was reading through the documentation on search.cpan.org for the DBI module and ran across an attribute that you can use with selectall_arrayref() that creates the proper data structure to be used with Interchange’s object.mv_results loop attribute. The attribute is called Slice which causes selectall_arrayref() to return an array of hashrefs instead of an array of arrays. To use this you have to be working in global Perl modules as Safe.pm will not let you use the selectall_arrayref() method.

    An example of what you could use this for is an easy way to generate a list of items in the same category. Inside the module, you would do like this:

    my $results = $dbh->selectall_arrayref(
      q{
        SELECT
          sku,
          description,
          price,
          thumb,
          category, 
          prod_group
        FROM
          products
        WHERE
          category = ?},
      { Slice => {} }, 
      $category
    );
    $::Tag->tmpn("product_list", $results);

    In the actual HTML page, you would do this:

    <table cellpadding=0 cellspacing=2 border=1>
    <tr>
      <th>Image</th>
      <th>Description</th>
      <th>Product Group</th>
      <th>Category</th> …

    database interchange perl

    Take a snapshot in Cucumber and sync it with Dropbox!

    Mike Farmer

    By Mike Farmer
    January 10, 2012

    In a previous post I talked about running cucumber using capybara-webkit. In a recent project using this setup I noticed that I couldn’t use capybara in connection with launchy to open up a page in the browser for debugging tests. The “save and open page” step is one that I used a lot when I was developing locally. But now that I’m developing on a server, I don’t have any way save the page or open it for review.

    The solution I found to this comes in two parts. First, create a “take a snapshot” cucumber step that drops a snapshot of the HTML and a PNG of the page in a temp directory. Second, add that temp directory to dropbox so that it gets synced to my desktop automatically when it is created.

    Wait, seriously? Dropbox?

    Yes, absolutely. Dropbox.

    I often develop inside of my dropbox folder because A) all my code is automatically backed up, even with versions and B) because it’s really simple to sync my code to other computers. I’ll admit that one problem I had early on was that log files were using an awful amount of bandwidth getting copied up constantly, but I solved this by adding the log directory to an exclusions list. I’ll show you how to do that below.

    Step 1: Create a “take …


    rails

    Introducing Piggybak: A Mountable Ruby on Rails Ecommerce Engine

    Steph Skardal

    By Steph Skardal
    January 6, 2012

    Here at End Point, we work with a variety of open source solutions, both full-fledged ecommerce applications and smaller modular tools. In our work with open source ecommerce applications, we spend a significant amount of time building out custom features, whether that means developing custom shipping calculations, product personalization, accounting integration or custom inventory management.

    There are advantages to working with a full-featured ecommerce platform. If you are starting from scratch, a full-featured platform can be a tool to quickly get product out the door and money in your pocket. But to do this, you must accept the assumptions that the application makes. And most generic, monolithic ecommerce platforms are created to satisfy many users.

    Working with a large monolithic ecommerce platform has disadvantages, too:

    • Sometimes over-generic-izing a platform to satisfy the needs of many comes at the cost of code complexity, performance, or difficulty in customization.
    • Occasionally, the marketing of an ecommerce solution overpromises and underdelivers, leaving users with unrealistic expectations on what they get out of the box.
    • Customization on any of these platforms is …

    ecommerce piggybak rails

    Ruby on Rails: Attributes Management through Rights

    Steph Skardal

    By Steph Skardal
    January 5, 2012

    I’ve written a couple times about a large Rails project that a few End Pointers have been working on. The system has a fairly robust system for managing rights and access. The basic data model for rights, users, groups, and roles is this:

    In this data model, right_assignments belong to a single right, and belong to a subject, through a polymorphic relationship. The subject can be a Role, Group, or User. A User can have a role or belong to a group. This allows for the ability to assign a right to a user directly or through a group or role.

    In our code, there is a simple method for grabbing a user’s set of rights:

      class User < ActiveRecord::Base
        ...
        def all_rights
          rights = [self.rights +
                    self.groups.collect { |g| g.allowed_rights } +
                    self.roles.collect { |r| r.rights }]
          rights = rights.flatten.uniq.collect { |r| r.action }
    
          rights
        end
        ...
      end

    In the case of this data model, groups also have a boolean which specifies whether or not rights can be assigned to them. The allowed_rights method looks like this:

      class Group < ActiveRecord::Base
        ...
        def allowed_rights
          self.assignable_rights ? self …

    rails
    Previous page • Page 155 of 223 • Next page