• 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
  • Localize $@ in DESTROY

    Mark Johnson

    By Mark Johnson
    July 26, 2010

    I have been conditioned now for many years in Perl to trust the relationship of $@ to its preceding eval. The relationship goes something like this: if you have string or block eval, immediately after its execution, $@ will either be false or it will contain the die message of that eval (or the generic “Died at …” message if none is provided). Implicit here is that evals contained within an eval have their effects on $@ concealed, unless the containing eval “passes on” the inner eval’s die.

    To quickly demonstrate:

    use strict;
    use warnings;
    
    eval {
        print "Some stuff\n";
        eval {
            die 'Oops. Bad inner eval';
        };
    
        printf '$@ in outer eval: %s', $@;
    };
    
    printf '$@ after outer eval: %s', $@;
    print $/;

    produces the following output:

    [mark@sokt ~]$ perl demo.pl 
    Some stuff
    $@ in outer eval: Oops. Bad inner eval at demo.pl line 7.
    $@ after outer eval: 
    [mark@sokt ~]$ 

    Only if the containing eval itself dies do we find any data in $@:

    use strict;
    use warnings;
    
    eval {
        print "Some stuff\n";
        eval {
            die 'Oops. Bad inner eval';
        };
    
        printf '$@ in outer eval: %s', $@;
        die 'Uh oh. …

    perl tips

    PostgreSQL: Migration Support Checklist

    David Christensen

    By David Christensen
    July 22, 2010

    A database migration (be it from some other database to PostgreSQL, or even from an older version of PostgreSQL to a nice shiny new one) can be a complicated procedure with many details and many moving parts. I’ve found it helpful to construct a list of questions in order to make sure that you’re considering all aspects of the migrations and gauge the scope of what will be involved. This list includes questions we ask our clients; feel free to contribute your own additional considerations or suggestions.

    Technical questions:

    1. Database servers: How many database servers do you have? For each, what are the basic system specifications (OS, CPU architecture, 32- vs 64-bit, RAM, disk, etc)? What kind of storage are you using for the existing database, and what do you plan to use for the new database? Direct-attached storage (SAS, SATA, etc.), SAN (what vendor?), or other? Do you use any configuration management system such as Puppet, Chef, etc.?

    2. Application servers and other remote access: How many application servers do you have? For each, what are the basic system specifications (OS, CPU architecture, 32- vs 64-bit, RAM, disk, etc)? Do you use any configuration management system …


    database postgres scalability

    Spree: Working with Sample Product Data

    Steph Skardal

    By Steph Skardal
    July 21, 2010

    It’s taken me a bit of time to gain a better understanding of working with Spree sample data or fixtures, but now that I am comfortable with it I thought I’d share some details. The first thing you might wonder is why should you even care about sample data? Well, in our project, we had a few motivations for creating sample data:

    1. Multiple developers, consistent sample data provides consistency during development. End Point offers SpreeCamps, a hosting solution that combines the open source Spree technology with devcamps to allow multiple development and staging instances of a Spree application. In a recent project, we had a two developers working on different aspects of the custom application in SpreeCamps; creating meaningful sample data allowed each developer to work from the same data starting point.
    2. Unit testing. Another important element of our project includes adding unit tests to test our custom functionality. Consistent test sample data gave us the ability to test individual methods and functionality with confidence.
    3. Application testing. In addition to unit testing, adding sample data gives the ability to efficiently test the application repeatedly with fresh sample data. …

    ecommerce rails spree

    Why is my load average so high?

    Josh Tolley

    By Josh Tolley
    July 15, 2010

    One of the most common ways people notice there’s a problem with their server is when Nagios, or some other monitoring tool, starts complaining about a high load average. Unfortunately this complaint carries with it very little information about what might be causing the problem. But there are ways around that. On Linux, where I spend most of my time, the load average represents the average number of process in either the “run” or “uninterruptible sleep” states. This code snippet will display all such processes, including their process ID and parent process ID, current state, and the process command line:

    #!/bin/sh
    
    ps -eo pid,ppid,state,cmd |\
        awk '$3 ~ /[RD]/ { print $0 }'

    Most of the time, this script has simply confirmed what I already anticipated, such as, “PostgreSQL is trying to service 20 times as many simultaneous queries as normal.” On occasion, however, it’s very useful, such as when it points out that a backup job is running far longer than normal, or when it finds lots of “[pdflush]” operations in process, indicating that the system was working overtime to write dirty pages to disk. I hope it can be similarly …


    environment hosting monitoring optimization

    Spree vs. Magento: Feature List Revisited

    Steph Skardal

    By Steph Skardal
    July 13, 2010

    A little over a month ago, I wrote an article on Spree vs. Magento Features. Recently, a client asked me to describe the features mentioned in that article. I thought this was another great opportunity to expand on my response to the client. So, here I am, revisiting ecommerce features in Spree and Magento. The original article can be referenced to compare availability of these features in Spree and Magento.

    Features on a Single Product or Group of Product

    • Product reviews and/or ratings: functionality to allow customers to review and rate products. See a Backcountry.com product page for an example.
    • Product QnA: functionality allow customers to ask and answer questions on products. See a Backcountry.com product page for an example.
    • Product SEO (URL, title, meta data control): functionality to allow site administrators to manage product URLs, product page titles, and product meta data.
    • Advanced/flexible taxonomy: functionality to build a custom taxonomy / navigation structure for product browsing. For example, build multiple categories and subcategories with complex hierarchy. The taxonomy at Spree’s demo includes two categories of brand and category and subcategories in each.
    • SEO …

    ecommerce rails spree cms magento localization

    Views across many similar tables

    Jeff Boes

    By Jeff Boes
    July 13, 2010

    An application I’m working on has a host of (a dozen or so) status tables, each containing various rows that reflect the state of associated rows in other tables. For instance:

    Table "public.inventory"
    ...
    status_code      | character varying(50)       | not null
    
    Table "public.inventory_statuses"
    code          | character varying(50)       | not null
    display_label | character varying(70)       | not null
    
    SELECT * FROM inventory_statuses;
    
      code    | display_label
    -----------+---------------
    ordered   | Ordered
    shipped   | Shipped
    returned  | Returned
    repaired  | Repaired

    etc.

    Several of the codes are common to several tables. For instance, “void” is a status that occurs in seven tables. The application cares about this; there are code-level triggers that will respond to a change of status to “void” in one table, and pass that information along to another table higher up the chain.

    Since I wasn’t present at the birth of the system (nor do I have unlimited memory to keep 180+ codes in my head), I needed a way to answer the question, “In which table(s) does status ‘foo’ occur?” This was made rather easier by attention to detail early on: each of the status tables …


    database postgres

    Mock Testing with Perl

    Sonny Cook

    By Sonny Cook
    July 9, 2010

    I’ll start by saying that I probably should have started with Test::MockObject and saved myself all of this trouble. But sometimes things don’t work out that way.

    So, I’m building unit tests in Perl the hard way. By the hard way, I mean that I am constructing ever more elaborate, interdependent, complex, and brittle test data sets to test the functions that I am hacking on. The data model is moderately complex, so there really isn’t any way around it (since I’m doing it the hard way, after all).

    At one point, one function (which I am not testing) returns a result that I need for the function I am testing. The problem is that it reaches pretty far away into a section of the data model that I’d rather not set up test data for at the moment just to get that one value. This is where I’m sitting there wishing I had mock objects more than usual, since this would be a perfect place to mock the method. Since I couldn’t be bothered to see if someone had written such a handy module, I looked for a hard way to do it. Turns out that there is one.

    It’s not actually hard, but it could be considered complex if you are not familiar with typeglobs and the workings of the symbol table in Perl. A …


    perl testing

    Upgrading Spree with the help of Git

    Steph Skardal

    By Steph Skardal
    June 28, 2010

    Lately, I’ve upgraded a few Spree projects with the recent Spree releases. Spree is a Ruby on Rails ecommerce platform that End Point previously sponsored and continues to support. In all cases, my Spree project was running from the Spree gem (version 0.10.2) and I was upgrading to Spree 0.11.0. I wanted to go through a brief explanation on how I went about upgrading my projects.

    Spree

    First, I made sure my application was running and committed all recent changes to have a clean branch. I follow the development principles outlined here that describe methodology for developing custom functionality on top of the Spree framework core. All of my custom functionality lives in the RAILS_ROOT/vendor/extensions/site/ directory, so that directory probably won’t be touched during the upgrade.

    steph@The-Laptop:/var/www/ep/myproject$ git status
    # On branch master
    nothing to commit (working directory clean)

    Then, I tried the rake spree:upgrade task with the following results. I haven’t upgraded Spree recently, and I vaguely remembered there being an upgrade task.

    steph@The-Laptop:/var/www/ep/myproject$ rake spree:upgrade
    (in /var/www/ep/myproject)
    [find_by_param error] database not available?
    This …

    ecommerce rails spree git
    Previous page • Page 182 of 223 • Next page