• 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
  • Our Blog

    Ongoing observations by End Point Dev people

    Ruby Ecommerce with Sinatra: Admin and Products

    Steph Skardal

    By Steph Skardal
    January 22, 2011

    Last week, I wrote about creating a very simple ecommerce application on Ruby with Sinatra. This week, we continue on the yellow brick road of ecommerce development on Ruby with Sinatra.

    yellow brick road

    A yellow brick road.

    Part 2: Basic Admin Authentication

    After you’ve got a basic application running which accepts payment for a single product as described in the previous tutorial, the next step is to add admin authorization to allow lookup of completed orders. I found several great resources for this as well as a few Sinatra extensions that may be useful. For the first increment of implementation, I followed the instructions here, which uses Basic::Auth. The resulting code can be viewed here. I also introduce subclassing of Sinatra::Base, which allows us to keep our files a bit more modular and organized.

    And if we add an “/admin” method to display orders, we can see our completed orders:

    Completed orders.

    Part 3: Introducing Products

    Now, let’s imagine an ecommerce store with different products! Whoa! For this increment, let’s limit each order to one product. A migration and model definition is created to introduce products, which contains a name, description, and price. For this increment, …


    ecommerce rails sinatra

    check_postgres without Nagios (Postgres checkpoints)

    Greg Sabino Mullane

    By Greg Sabino Mullane
    January 21, 2011

    Version 2.16.0 of check_postgres, a monitoring tool for Postgres, was just released. We’re still trying to keep a “release often” schedule, and hopefully this year will see many releases. In addition to a few minor bug fixes, we added a new check by Nicola Thauvin called hot_standby_delay, which, as you might have guessed from the name, calculates the streaming replication lag between a master server and one of the slaves connected to it. Obviously the servers must be running PostgreSQL 9.0 or better.

    Another recently added feature (in version 2.15.0) was the simple addition of a –quiet flag. All this does is to prevent any normal output when an OK status is found. I wrote this because sometimes even Nagios is overkill. In the default mode (Nagios, the other major mode is MRTG), check_postgres will exit with one of four states, each with their own exit code: OK, WARNING, CRITICAL, or UNKNOWN. It also outputs a small message, per Nagios conventions, so a txn_idle action might exit with a value of 1 and output something similar to this:

    POSTGRES_TXN_IDLE WARNING: (host:svr1) longest idle in txn: 4638s
    

    I had a situation where I wanted to use the functionality of check_postgres …


    database monitoring open-source postgres

    Ecommerce on Sinatra: In a Jiffy

    Steph Skardal

    By Steph Skardal
    January 17, 2011

    Several of us at End Point have been involved in a non-ecommerce project for one of our clients running on Ruby, Sinatra, Unicorn, using DataMapper, PostgreSQL, PostGIS, with heavy use of JavaScript (specifically YUI). Sinatra is a lightweight Ruby web framework – it’s not in direct competition with Rails but it might be a better “tool” for lightweight applications. It’s been a fun project to work with Sinatra, DataMapper, and YUI as I’ve been working traditionally focused on their respective related technologies (Rails, ActiveRecord, jQuery).

    Out of curiosity, I wanted to see what it might take to implement a bare-bones ecommerce store using Sinatra. Here is a mini-tutorial to develop an ecommerce store using Sinatra.

    A snapshot of our final working app.

    Getting Started

    I create a new directory for the project with the following directories:

    sinatrashop/
      db/
        migrate/
      models/
      public/
        images/
         stylesheets/
      views/
    

    Data Model

    Now, let’s look at the data model. Since this is a bare-bones store, I have one order model which contains all the order information including contact information and addresses. We’re not storing the credit card in the database. Also, since …


    ecommerce ruby sinatra

    Zayda Internet joins End Point

    Jon Jensen

    By Jon Jensen
    January 17, 2011

    End Point is pleased to announce the merging of web hosting firm Zayda Internet into our company as of December 2010.

    Zayda Internet was a small hosting company that started in 1999 and focused on Linux web and email hosting and consulting for many small businesses and individuals, and a few larger sites including most prominently the busy community site OSNews.com.

    We’re happy to welcome all Zayda Internet customers into the End Point fold and look forward to working with them in the future.


    company

    DBD::Pg, UTF-8, and Postgres client_encoding

    Greg Sabino Mullane

    By Greg Sabino Mullane
    January 13, 2011

    Photo by Roger Smith

    I’ve been working on getting DBD::Pg to play nicely with UTF-8, as the current system is suboptimal at best. DBD::Pg is the Perl interface to Postgres, and is the glue code that takes the data from the database (via libpq) and gives it to your Perl program. However, not all data is created equal, and that’s where the complications begin.

    Currently, everything coming back from the database is, by default, treated as byte soup, meaning no conversion is done, and no strings are marked as utf8 (Perl strings are actually objects in which one of the attributes you can set is ‘utf8’). If you want strings marked as utf8, you must currently set the pg_enable_utf8 attribute on the database handle like so:

    $dbh->{pg_enable_utf8} = 1;
    

    This causes DBD::Pg to scan incoming strings for high bits and mark the string as utf8 if it finds them. There are a few drawbacks to this system:

    • It does this for all databases, even SQL_ASCII!
    • It doesn’t do this for everything, e.g. arrays, custom data types, xml.
    • It requires the user to remember to set pg_enable_utf8.
    • It adds overhead as we have to parse every single byte coming back from the database.

    Here’s one proposal for a new …


    database dbdpg perl postgres

    SSH config wildcards and multiple Postgres servers per client

    Greg Sabino Mullane

    By Greg Sabino Mullane
    January 7, 2011

    The SSH config file has some nice features that help me to keep my sanity among a wide variety of servers spread across many different clients. Nearly all of my Postgres work is done by using SSH to connect to remote client sites, so the ability to connect to the various servers easily and intuitively is important. I’ll go over an example of how a ssh config file might progress as you deal with an ever‑expanding client.

    Some quick background: the ssh config file is a per‑user configuration file for the SSH program. It typically exists as ~/.ssh/config. It has two main purposes: setting global configuration items (such as ForwardX11 no), and setting things on a host‑by‑host basis. We’ll be focusing on the latter.

    Inside the ssh config file, you can create Host sections which specify options that apply only to one or more matching hosts. The sections are applied if the host name you type in as the argument to the ssh command matches what is after the word “Host”. As we’ll see, this also allows for wildcards, which can be very useful.

    I’m going to walk through a hypothetical client, Acme Corporation, and show how the ssh config can grow as the client does, until the final example …


    clients linux postgres ssh sysadmin tips

    New Year Bug Bites

    Benjamin Goldstein

    By Benjamin Goldstein
    January 6, 2011

    Happy New Year! And what would a new year be without a new year bug bite? This year we had one where figuring out the species wasn’t easy.

    On January 2nd one of our ecommerce clients reported that starting with the new year a number of customers weren’t able to complete their web orders because of credit card security code failures. Looking in the Interchange server error logs we indeed found a significant spike in the number of CVV2 code verification failures (Payflow Pro gateway error code “114”) starting January 1st.

    We hadn’t made any programming or configuration changes on the system in the recent days. We double-checked to make sure: nope, no code changes. So it had to be a New Year’s bug and presumably something with the Payflow Pro gateway or banks further upstream. We checked error logs for other customers to see if they were being similarly impacted, but they weren’t. Our client contacted PayPal (the vendor for Payflow Pro) and they reported there were no problems with their system. The failures must indeed be card failures or a problem with the website according to them. We further checked our code looking for what we could possibly have done that might be the cause, …


    analytics ecommerce interchange javascript

    jQuery code for making a block level element clickable while maintaining left/middle/right clicking

    Ron Phipps

    By Ron Phipps
    January 4, 2011

    While working on a recent redesign for a client we needed the ability to click on a div and have it function as a link to a product page. The initial implementation used the jQuery plugin BigTarget.js. The plugin searches within the div for a link and when the div is clicked changes the location to the link that is found. This plugin worked fine and was fairly easy to setup, however there was one drawback that we found once it was released in the wild. Most people expect to be able to right click, middle click, shift click, and control click to get the context-sensitive menu, open in a new window, or open in a new tab.

    Enter Superlink.js, a jQuery plugin that uses a cool trick of moving the location of a link to the location of the mouse within the block level element (such as a div, li, tr, td, etc.). With this implementation the mouse is actually over a link so that the various ways of clicking function as expected. Initially I started moving the clickable area within a table, as shown in the example, but then quickly realized there was no reason this shouldn’t work within a div or li. One other neat thing with this plugin is that the events attached to the block will continue to …


    javascript jquery tips
    Previous page • Page 170 of 220 • Next page