• 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
  • Piggybak on Heroku

    Steph Skardal

    By Steph Skardal
    November 12, 2012

    Several weeks ago, we were contacted through our website with a request for Heroku support on Piggybak. Piggybak is an open source Ruby on Rails ecommerce platform developed and maintained by End Point. Piggybak is similar to many other Rails gems in that it can be installed from Rubygems in any Rails application, and Heroku understands this requirement from the application’s Gemfile. This is a brief tutorial for getting a Rails application up and running with Piggybak. For the purpose of this tutorial, I’ll be using the existing Piggybak demo for deployment, instead of creating a Rails application from scratch.

    a) First, clone the existing Piggybak demo. This will be your base application. On your development machine (local or other), you must run bundle install to get all the application’s dependencies.

    b) Next, add config.assets.initialize_on_precompile = false to config/application.rb to allow your assets to be compiled without requiring creating a local database.

    c) Next, compile the assets according to this Heroku article with the command RAILS_ENV=production bundle exec rake assets:precompile. This will generate all the application assets into the public/assets/ directory. …


    ecommerce hosting piggybak rails

    Postgres alter column problems and solutions

    Greg Sabino Mullane

    By Greg Sabino Mullane
    November 9, 2012


    Image from Flickr user ell brown

    A common situation for database-backed applications is the need to change the attributes of a column. One can change the data type, or more commonly, only the size limitation, e.g. VARCHAR(32) gets changed to VARCHAR(42). There are a few ways to accomplish this in PostgreSQL, from a straightforward ALTER COLUMN, to replacing VARCHAR with TEXT (plus a table constraint), to some advanced system catalog hacking.

    The most common example of such a change is expanding a VARCHAR declaration to allow more characters. For example, your “checksum” column was based on MD5 (at 32 characters), and now needs to be based on Keccak (Keccak is pronounced “catch-ack”) (at 64 characters) In other words, you need a column in your table to change from VARCHAR(32) to VARCHAR(64). The canonical approach is to do this:

    ALTER TABLE foobar ALTER COLUMN checksum TYPE VARCHAR(64);

    This approach works fine, but it has two huge and interrelated problems: locking and time. This approach locks the table for as long as the command takes to run. And by lock, we are talking a heavy “access exclusive” lock which shuts everything else out of the table. If your table is small, this …


    database postgres sql

    Using cec-client to Control HDMI Devices

    Matt Vollrath

    By Matt Vollrath
    November 8, 2012

    Maintaining the horde of computers it takes to run Liquid Galaxy installations in all corners of the globe is a big job. As of November of 2012, we’re monitoring 154 computers at permanent installations in addition to keeping our development and testing systems running like the well-oiled machines we want them to be. All that fluff aside, end users never see the fruits of our labor unless the TVs are working as expected! Without methods for getting and setting the status of displays, we are completely blind to what people are actually experiencing in front of a Liquid Galaxy.

    Enter HDMI-CEC. CEC is a protocol that allows HDMI-connected devices to control each other in various ways. It has a set of standard features that make it easy for home users with a stack of DVD players or TiVos or other devices to change the active source, put everything on standby, control the volume, and some other handy tricks.

    We typically use Samsung TVs which support CEC under the trade name “Anynet+”. To interface between computers and TVs, we use Pulse Eight’s USB-CEC adapters which, in conjunction with libCEC, give us a command line interface for arbitrary commands to the TV.

    libCEC is available on …


    visionport sysadmin

    Getting Started with the Perl Debugger

    Jeff Boes

    By Jeff Boes
    November 7, 2012

    The Perl debugger is not an easy system to leap into unprepared, especially if you learned to program in the “modern era”, with fancy, helpful GUIs and other such things.

    So, for those of us who are old school, and those who aren’t but wondering what the fuss is about, here’s a very gentle introduction to debugging Perl code interactively.

    First, an aside. You may think to yourself, “Hey, command-line scripting is passé; nobody does that any more. All my code runs within a website (maybe a modern MVC framework), so how can I make use of a command-line debugger?”

    Well, that’s where test-driven development and its related methodologies come in. If you have developed using a Perl test framework, you can use the approach outlined here.

    The debugger is invoked by using the “-d” switch on the command line. You control the execution of your code with the “n” command:

    $ perl -d debug.pl Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or h h' for help, or man perldebug’ for more help. main::(debug.pl:1): my $x = 1; DB<1> n1 main::(debug.pl:2): $x = $x …


    perl

    cPanel no-pty ssh noise removal

    Jon Jensen

    By Jon Jensen
    November 6, 2012

    We commonly use non-interactive ssh for automation of various tasks. This usually involves setting BatchMode=yes in the ~/.ssh/config file or the no-pty option in the ~/.ssh/authorized_keys file, and stops a tty from being assigned for the ssh session so that a job will not wait for interactive input in unexpected places.

    When using a RHEL 5 Linux server that has been modified by cPanel, ssh sessions display “stdin: is not a tty” on stderr. For ad-hoc tasks this is merely an annoyance, but for jobs run from cron it means an email is sent because cron didn’t see an empty result from the job and wants an administrator to review the output.

    You could quell all output from ssh, but then if any legitimate errors or warnings were sent, you won’t see those. So that is not ideal.

    Using bash’s set -v option to trace commands being run on the cPanel server we found that they had modified Red Hat’s stock /etc/bashrc file and added this line:

    mesg y

    That writes a warning to stderr when there’s no tty because mesg doesn’t make sense in non-interactive environments.

    The solution is simple, since we don’t care to hear that warning. We edit that line like this:

    mesg y 2>/dev/null

    This tip …


    hosting redhat sysadmin

    Piggybak: Roadmap Status Update

    Steph Skardal

    By Steph Skardal
    November 6, 2012

    About a month ago, I shared an outline of the current Piggybak Roadmap. Piggybak is an open-source Ruby on Rails ecommerce platform created and maintained by End Point. It is developed as a Rails Engine and is intended to be mounted on an existing Rails application. Over the last month, Tim and I have been busy at work building out features in Piggybak, and completing refactoring that opens the door for better extension and feature development. Here’s a summary of the changes that we’ve finished up.

    Real-time Shipping Lookup

    One of our Piggybak clients already had integrated USPS and UPS shipping, but we decided to extract this and combine it with FedEx, to offer real-time shipping lookup shipping in Piggybak. This extension leverages Shopify’s open-source ActiveShipping Ruby gem. When you are ready to get your Piggybak store up and running, you can include this new extension and configure USPS, UPS, and FedEx real-time shipping lookup immediately.

    Installer process

    Tim Case updated the installation process to be more streamlined. The previous installation process was a bit crufty and required changes to your Gemfile, routes, layouts, and precompiled assets. Tim …


    ecommerce open-source piggybak ruby rails

    How to make a PostgreSQL query slow

    Szymon Lipiński

    By Szymon Lipiński
    November 5, 2012

    Some applications can be very vulnerable to long running queries. When you test an application, sometimes it is good to have a query running for, let’s say, 10 minutes. What’s more it should be a normal query, so the application can get the normal results, however this query should run for some longer time than usual.

    PostgreSQL has quite a nice function pg_sleep which takes exactly one parameter, it is the number of seconds this function will wait before returning. You can use it as a normal PostgreSQL function, however it’s not very sensible:

    # SELECT pg_sleep(10);
    
     pg_sleep
    ----------
    
    (1 row)
    
    Time: 10072.794 ms

    The most interesting usage is adding this function into a query. Let’s take this query:

    # SELECT schemaname, tablename
      FROM pg_tables
      WHERE schemaname <> 'pg_catalog';
    
    Time: 0.985 ms

    As you can see, this query is quite fast and returns data in less than 1 ms. Let’s now make this query much slower, however returning exactly the same data, but after 15 seconds:

    # SELECT schemaname, tablename
      FROM pg_tables, pg_sleep(15)
      WHERE schemaname <> 'pg_catalog';
    
    Time: 15002.084 ms

    In fact the query execution time is a little bit longer, …


    postgres

    How to Build a Command Line Executable Installer with Rubygems and Thor

    Tim Case

    By Tim Case
    November 2, 2012

    Gems for Rails often need the user to do something more for installation than just adding the gem to a Gemfile and running bundler install. Sometimes it’s a simple matter of copying over some migration files and sometimes it’s just setting up a config file, and most of the time these simple installation steps are best handled with a well written installation section in the README file. When the installation process is more complex a long README might not be so enticing to the potential gem user, in a world where everyone has a finger on the back button it’s nice to be able to create an installer that allows the user to complete complex installation tasks by executing a one liner and that’s where an installer made through Gem executables and Thor can come in handy.

    We wanted to make it easier for new users of Piggybak to get started and decided that an installer was the best way to do that. Creating a binary installer that is installed by Rubygems is one of those esoteric things that may not be thought of as one of the core strengths of Rubygems and Rails but it’s a bonus to be able to do something like this without a whole lot of fuss.

    Creating an …


    piggybak rails
    Previous page • Page 132 of 222 • Next page