KidsCerts.com: an Award Certificate Maker for Students and Children

Note: Although I did the development for this site, I don’t carry its maintenance. If you visit it and you see some JavaScript errors, these were not in the delivered final version.

Note: this post was previewed and approved by the customer.

Completed: May 2014.

Kidscerts' Logo.

Kidscerts’ Logo.

KidsCerts allows easy creation of certificates for students and children. The niche market is parents and teachers and it features an user-friendly, easy-to-use interface written in HTML5 and jQuery.

Kidcerts.com home page.

Kidcerts.com home page.

In this project I took on a lead developer role. Our designer did the initial design in Photoshop and converted it to clean HTML5 templates. Then I did most of the coding, with occasional help from a a few freelancers we hired through Freelancer for graphics, rewriting, data entry, and other miscellaneous work.

Project coordination.

As we were a small team and the product owner was heavily involved during the process, we choose Trello for project coordination. Trello has a very intuitive user interface which is pretty straightforward even for non-technical users.

The Trello board we used for this project.

The Trello board we used for this project.

This is a screenshot of the project page (board) in Trello. You can see that there are several lists, each one containing several cards. This gives a quick visual overview of the project. Everything can be rearranged by drag and drop.

The timeline is along the right side. It is convenient to keep track of the progress of the project. You can also receive board updates via email.

A Trello board card detail.

A Trello board card detail.

This is the detail of one of the cards, where I discuss an improvement with the product owner. Trello does not have many of the features of other popular project trackers like reporting but we didn’t miss these for this project.

The previous site.

The previous design.

The previous design.

The original site was completly functional but the code and design was done to 90’s standards. It definitely needed a remake. There was little we could reuse from the user interface, so we decided to write it from scratch.

A new design

Here is a screenshot of the initial design made with Photoshop:

The new home page design in Photoshop.

The new home page design in Photoshop.

For the form designer, the tabbed input takes less space while being easy to use and visually attractive.

The new create page design in Photoshop.

The new create page design in Photoshop.

I really liked the way the designer structured the Photoshop project. He used a single PSD file with well-organized layers, which you can show or hide to see each individual feature.

Photoshop layer tree.

Photoshop layer tree.

The designer also delivered clean and table-less HTML5 templates:

Our initial HTML template.

Our initial HTML template.

Certificate creator user interface.

The user interface required highly customized forms and real-time updates. We used jQuery along with a mix of open source and custom plugins. This was a bit complex due to the amount of integration required but we got it working while achieving a fast and simple interface.

Kidscerts.com create certificate page.

Kidscerts.com create certificate page.

Tabs.

We used the EasyTabs jQuery plugin. It was a snap to integrate.

Frames.

We didn’t find any plugin for this, so we had to develop our own. It’s a jQuery horizontal hierarchical selector with several categories. Each contains several items. We found this very simple to use. It also took up little space.

There are also some frames which require a subscription. When selecting one of these, you will get an interactive tooltip asking you to subscribe. We used Tooltipster for these.

Tooltipster subscribe tooltip.

Tooltipster subscribe tooltip.

Text.

For the text inputs only CSS was required. We used msDropdown for customizing the dropdowns.

A jQuery rich text input.

A jQuery rich text input.

For the font chooser we used jQuery.customSelect. At the time of developing this, we couldn’t find a more specific one for this task. We used images instead rendering the fonts in the browser in order to speed up load times.

A jQuery font chooser.

A jQuery font chooser.

A customized version of the FontFace jQuery plugin was used for loading these fonts on demand.

For the color chooser, we used jQuery Simple Color. The original script didn’t allow us to use rounded borders for each color item, but the code was easy to customize.

A jQuery color chooser.

A jQuery color chooser.

Finally, for the multiline quote selector, we used imMultilineList. The possible values are populated automatically as function of the category selector at the left.

A jquery multiline select.

A jquery multiline select.

Backgrounds.

Custom backgrounds.

Custom backgrounds.

This is very similar to the frames tab. However, here you can also set the transparency level using a slider. We used the jQuery Slider plugin for it.

Registered users can also use custom frames:

Custom backgrounds deletion.

Custom backgrounds deletion.

These are stored on the server and can be reused or deleted:

Custom backgrounds deletion.

Custom backgrounds deletion.

We used the jQuery File Upload plugin for this.

Non-registered users will see the following interactive tooltip:

Custom tooltip for non-subscribers.

Custom tooltip for non-subscribers.

Live preview.

Below the form, there is a live preview of the certificate, which is updated as soon as you change anything in the form. This was custom developed.

In the images above, you can see that the live preview is resized automatically depending on the input area height, so its content is always visible.

PDF generator.

The old site had a functional pdf generator written in functional-style php. While a bit outdated for today’s coding standards, it well for the most part. Instead rewriting it from scratch, we decided to clean and refactor it, adding a few new features like the background transparency. Click here to download a sample PDF output.

We also made sure that the differences between the live preview and the pdf were minimal by comparing several screenshots in GIMP. Here is one of these. We made the browser output transparent, and then we placed it over the PDF one:

Checking the rendering differences between the browser preview and PDF versions.

Checking the rendering differences between the browser preview and PDF versions.

The maximum offset is 4px, due the different font rendering engines. While we could have improved these, we decided to stop here, as most people will not notice such small difference.

Members backend.

Kidcerts.com subscribe page.

Kidcerts.com subscribe page.

We decided to integrate aMember for subscriptions administration and billing. We chose 2Checkout as payment processor as we had positive experiences with it in the past. We skinned the members pages with a cleaned version of the old design. It was working well and looked acceptable so we left it. We will probably integrate it with the new design in a future iteration.

Kidscerts aMember integration.

Kidscerts aMember integration.

I can say that I’m happy to have driven this project to completion. Developing such a a complex jQuery interface was challenging, but also rewarding for the entire team. We will probably be adding more features in the future, and I will update this post accordingly.


Ebay to Shopify Data Extractor / Scraper

eBay Extractor / Scraper

Java desktop application using Google Chrome to extract eBay item data.

Note: this post was previewed and approved by the customer.

Completion date: February 2015.

In this project, we wrote a Java desktop application to control Google Chrome and extract item data from eBay. Through this method we achieved 100% accuracy.

The “Search URL” input will take a list of eBay search URLs. Clicking on the “Get Item Numbers” button will scrape each search URL and its next results pages, then add the item numbers found to the next input box.

You can add, edit or remove any item numbers in this box. You can even use it without scraping a search page first.

Finally, selecting an output file and clicking on the “Extract” button will extract data from each item page and populate a file in CSV format suitable for Shopify import.

If you need something similar, feel free to contact me.


Measure Twice, Code Once (or How To Make Your GUI Pixel Perfect with GIMP)

GIMP logo

GIMP logo.

Several of the projects I’m currently managing, like MockupData and MockupScreens, have complex graphical user interfaces. I have noticed that it’s hard to make this kind of program pixel perfect just by trying to measure the sizes and distances by eye, especially if you have an old/bad/small screen, so here is a small tutorial showing why GIMP should be another of your development tools.

1. Download and install GIMP.

GIMP (acronym of GNU Image Manipulation Program) is open source and completely free. It runs on several platforms, including Windows, Mac OS and Linux. Installation is pretty straightforward: just download and run the installer for your platform in Windows and Mac OS. In Linux, it’s probably already installed; if not you should be able to install it using your favorite software package management utility from your distribution.

2. Take a screenshot of your GUI.

Focus the window you want to capture and then press Alt+Print Screen in windows or Control+Command+Shift+3 in Mac OS. For Linux  you can check this site, which also contains more options for Windows and Mac OS. Then, open GIMP and select Edit → Paste as → New Image.

Alternatively, drag and drop an existing screenshot image file into the GIMP title bar, or use the File menu item to open an existing disk file or an image URL.

3. Use the GIMP measuring tool.

Take a look at the following icons. Are these of the same size?

Original buttons

Original buttons.

Let’s use the GIMP measuring tool. First use the zoom so you get a big image on the screen, and then click on the Measure icon in the toolbox, and then make sure the Use Info window checkbox is enabled. Next, left click on the starting point and drag with the mouse to the ending one, then release the mouse button. The distance between the two points will be displayed on the screen:

Measuring the left button with GIMP

Measuring the left button with GIMP. Click to enlarge.

Now let’s measure the second one.

Measuring the right button with GIMP

Measuring the right button with GIMP. Click to enlarge.

There is a 5 pixel difference. We asked our developer to fix this and make some other changes to the buttons:

  • Making  them smaller, as they looked so big compared to other items in our app. We resized them from 35*26px (left) and 30*26px (right), to 28*22px (both).
  • Adding 2 pixels between the icons.
  • Make the font a bit smaller.
  • Place the plus and minus signs just under the shadow line (this is the line where the background color of the icon changes, thus giving a 3D effect).

Here is the result. You can download and zoom it with GIMP if you want to check the changes:

Fixed buttons

Fixed buttons.

4. Use the GIMP color picker.

Now let’s look at the following toolbar:

Original toolbar

Original toolbar.

Are all buttons of the same color? Let’s check it with the color picker tool. Click on the pointed icon in the toolbox, and then check that the Show info window option is enabled. Click on the background of the Go Screen button.

Using the GIMP color picker on one of the correct buttons

Using the GIMP color picker on one of the correct buttons. Click to enlarge.

We get a color value of  eae8ed. Let’s check the Toggle Comments one.

Using the GIMP color picker on the incorrect button

Using the GIMP color picker on the incorrect button. Click to Enlarge.

Now we get f6f6f2, so the colors are actually different. We also fixed it, and here is how it looks now:

Fixed toolbar

Fixed toolbar.

5. Conclusion.

The appearance of your product is as important as its functionality. With similar features and functionality, a user will choose the one with better appearance, and even if you can’t notice them in your old laptop, people with modern monitors will be able to see them. GIMP allows you to make sure that your GUI elements will look homogeneous to every user with little time and effort, while being completely free software.


Agile management project: Python / wxPython based realistic test data generator for databases (III): selecting developers

Note: this post was previewed and approved by the customer.

In order to post a bid on behalf of the employer in vWorker (adquired by Freelancer on November 2012), he must give me subaccount permissions in his control panel. This is pretty straightforward, and the employer has control over the permissions I will have in his account. To do this, the employer needs to log in to vWorker, go to My account → My subaccounts, click on Add new sub-account and then follow the instructions there.

Once this is done, I can log in to the employer’s subaccount. I use several browsers, one with my main account and others with different subaccounts, so I don’t need to switch the account constantly.

Now it’s time to post a new project by clicking on the Post a new project link at the top left of the page. It’s important to be clear and concise about what you need. On freelance sites like vWorker, a developer needs to place a lot of bids to win a single project, so it’s better to write a small specification on the bid page, and put a full specification in an attachment. Here is a screenshot of the new project page:

vWorker New Project Page

Full page screenshot of the vWorker new project page. Click to enlarge.

From four interested candidates, we selected two developers who were in a nearby timezone, communicated well, offered us a reasonable price, and had demonstrable experience with wxPython development.

We started with a small test (fixing a minor bug) using pay for deliverables. In this way the developer has a good idea of what the work will involve and we can know more about his work before starting the bulk of the project. These tests were successful, so we switched to pay for time, as we consider it better suited to agile development than pay for deliverables.


Twilio Tutorial: Sending an SMS with the PHP REST API

Note: this post was previewed and approved by the customer.

Twilio Logo

Twilio Logo

Update: One day after publishing this post, Kevin from Twilio suggests in the comments to use the last version from Github instead the 3.2.3 twilio-php library zip archive from the Twilio page. That fixed an SSL certificate validation issue. This is what I call great support! In a recent project, I used the Twilio REST API to send SMS messages. Here is a very simple tutorial about it. If you need help integrating Twilio in your application, you can contact me.

1. Register your phone number with Twilio (or get  a production account).

At the time of writing this post, Twilio offers a trial account with $30 free credit. Just go to the Twilio site and create a new one. The trial account requires verification of the phone numbers you want to use with their service. You can do this, at no extra cost, by going to Numbers → Verify a number in their control panel. You will then receive a call to that number asking for confirmation. For your caller ID, you can use the sandbox number you will find after logging in to, buy a number from them or use a verified number. Alternatively, you can upgrade your account to a production one, which will allow you to use any phone number (you have to register a credit card with them, but you don’t need to make a payment until you spend the initial $30 credit).

2. The configuration file

Now, download the twilio-php library from their site (I used version 3.2.3 for this tutorial), or get it from Github  and install it in your server (I used the twilio-lib directory). In the root of your site (or in your test dir) create a twilio.config.php file with the following:

require_once("twilio-lib/Twilio.php");

$AccountSid = "Your Account SID";
$AuthToken = "Your Auth Token";

Replace the values with the ones you will find after login into Twilio.

3. Send an SMS.

This is pretty straightforward:

require_once("twilio.config.php");

try {
    // Instantiate a new Twilio Rest Client
    $client = new Services_Twilio($AccountSid, $AuthToken);

    /*
     * If you get an "Services_Twilio_TinyHttpException: SSL certificate problem [...]";
     * exception, uncomment the two lines below. More about this issue at
     * http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/
     *
     * UPDATE: using a twilio-php library version newer than 3.2.3 or the last version
     * from Github fixes this issue, making the two lines below unnecessary.
     */

     // $http = new Services_Twilio_TinyHttp("https://api.twilio.com", array("curlopts" => array(CURLOPT_SSL_VERIFYPEER => false)));
     // $client = new Services_Twilio($AccountSid, $AuthToken, "2010-04-01", $http);

    /*
     * The number we are sending from, it must be a valid Twilio number
     * You can use the default number which you will find in the sandbox,
     * buy a number from them or port your own number to Twilio.
     */
    $from = "415-599-2671"; // this is the default sandbox number
    // The number we are sending to - any phone number
    $to = "A Phone Number";
    // The SMS body
    $message = "Testing the Twilio SMS REST API";

    // Send a new outgoing SMS
    $response = $client->account->sms_messages->create($from, $to, $message);

    // Get the delivery status
    echo $response->status;
} catch (Exception $e) {
    echo "Caught exception: " . $e->getMessage();
}

4. Check the results.

If everything went well, you will receive an SMS message in your phone. You can also go to Logs → SMS in the Twilio site and see the results there:

Twilio SMS Logs

Twilio SMS Logs Screen

Any questions? Feel free to post a comment.


Braintree Payments Tutorial: Managing Subscriptions with the Server-to-Server (S2S) API

Note: this post was previewed and approved by the customer.

Braintree Logo White Background

Braintree Payments Logo

Recently I integrated Braintree Payments as part of a sales lead routing site project . Here is a small tutorial based on the example I wrote to learn how their API works. Their documentation is great and easy to follow, but I found that it sometimes lacked detail so I had to find some things looking at their (excellent) PHP library source code.

The code is just a quick demo, so it’s far from perfect. However it will be fine for the purposes of this tutorial.

If you need help integrating Braintree in your site, feel free to contact me.

1. Set up a plan in the sandbox.

After signing up with Braintree, you will get an email with your sandbox credentials. For this tutorial, we will create one plan with one add-on.

Go to Recurring Billing → Add-ons and Discounts → New Add-on and create a new one. You should end with something like:

Braintree Create Add-on

Braintree add-on created. Click to enlarge.

Next, go to Recurring Billing → Plans → New and do the same but selecting the add-on you just created in the step above in the “add-ons” section. You should get something like:

Braintree Create a Plan

Braintree plan created. Click to enlarge.

Now we can start to code.

2. The configuration file.

You will find the api keys in their sandbox. Just go to Account → My User → Authorization → Api Keys.

Now, download or clone from Github their PHP Client Library (I used version 2.12.3 for this tutorial) and install it in your server (I used the braintree-lib directory).

In the root of your site (or in your test dir) create a braintree.config.php file with the following:

require_once('braintree-lib/Braintree.php');

Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('yourmerchantId');
Braintree_Configuration::publicKey('yourpublicKey');
Braintree_Configuration::privateKey('yourprivateKey');

3. Create a customer record with a credit card.

You can do this in separate steps, but in this example we will do at once. Check that I have split the code in several parts, so you will have to join them.

require_once 'braintree.config.php';

$planId = 2000;
$addOnId = 1000;
$includeAddOn = false;

try {
    /* First we create a new user using the BT API */
    $result = Braintree_Customer::create(array(
                'firstName' => 'My First Name',
                'lastName' => 'My Last Name',
                'company' => 'My Company',
                // we can create a credit card at the same time
                'creditCard' => array(
                    'cardholderName' => 'My Name On Card',
                    'number' => '5105105105105100',
                    'expirationMonth' => "02",
                    'expirationYear' => "15",
                    'cvv' => '123',
                    'billingAddress' => array(
                        'firstName' => 'My Billing Address First Name',
                        'lastName' => 'My Billing Address Last Name',
                        'company' => 'My Billing Address Company',
                        'streetAddress' => 'My Billing Address Address',
                        'locality' => 'My Billing Address City',
                        'region' => 'IL', // Two letter code
                        'postalCode' => '60622',
                        'countryCodeAlpha2' => 'US'
                    )
                )
            ));
    if ($result->success) {
        echo("Customer ID: " . $result->customer->id . "<br>");
        echo("Credit card ID: " . $result->customer->creditCards[0]->token . "
");
    } else {
        foreach ($result->errors->deepAll() as $error) {
            echo($error->code . ": " . $error->message . "<br>");
        }
        exit;
    }

4. Create a subscription.

By default the subscription includes all associated add-ons, but you can remove them using an option.

    // Now we create a subscription
    $subscriptionData = array(
        'paymentMethodToken' => $result->customer->creditCards[0]->token,
        'planId' => $planId
    );

    // The addons are included by default, but we can remove them
    if (!$includeAddOn) {
        $subscriptionData['addOns'] = array(
            'remove' => array($addOnId)
        );
    }

    $result = Braintree_Subscription::create($subscriptionData);

    if ($result->success) {
        echo("Subscription ID: " . $result->subscription->id . "<br>");
        echo("Transaction ID: " . $result->subscription->transactions[0]->id . "<br>");
    } else {
        foreach ($result->errors->deepAll() as $error) {
            echo($error->code . ": " . $error->message . "<br>");
        }
        exit;
    }

5. Modify the subscription.

We add or remove the add-on depending on whether it had been added in the previous step.

When adding it, we can decide if we prorate the addon value. If not it will be charged next month.

    // we add or remove the addon depending on its state
    if (!$includeAddOn) {
        // add
        $result = Braintree_Subscription::update($result->subscription->id, array(
                    'options' => array(
                        'prorateCharges' => true,
                        'revertSubscriptionOnProrationFailure' => true
                    ),
                    'addOns' => array(
                        'add' => array(
                            array(
                                'inheritedFromId' => $addOnId
                            )
                        )
                    )
                ));
    } else {
        // remove
        $result = Braintree_Subscription::update($result->subscription->id, array(
                    'addOns' => array(
                        'remove' => array($addOnId)
                    )
                ));
    }

    if ($result->success) {
        echo("Subscription ID: " . $result->subscription->id . " updated<br>");
    } else {
        foreach ($result->errors->deepAll() as $error) {
            echo($error->code . ": " . $error->message . "<br>");
        }
        exit;
    }

6. Cancel the subscription.

This is pretty straightforward. In the last catch the getMessage() method of the thrown exception returns an empty string (a client library bug maybe?).

    // Finnally we cancel the subscription
    $result = Braintree_Subscription::cancel($result->subscription->id);

    if ($result->success) {
        echo("Subscription ID: " . $result->subscription->id . " cancelled<br>");
    } else {
        foreach ($result->errors->deepAll() as $error) {
            echo($error->code . ": " . $error->message . "<br>");
        }
        exit;
    }
} catch (Exception $e) {
    echo 'Caught exception: ' . $e . "
"; // $e->getMessage() is empty
}

7 .Check the result in the sandbox.

Go to Search → Subscriptions, click on “Search”, and then select the subscription id to be found in the output of the PHP program. If everything went right, you should find something like this:

Braintree Subscription Page

Braintree subscription page after running the program. Click to enlarge.

 


Agile management project: Python / wxPython based realistic test data generator for databases (II): defining an infrastructure

Note: this post was previewed and approved by the customer.

an infrastruture

An infrastructure (Soo Locks, source: http://en.wikipedia.org/wiki/Soo_Locks)

The customer already provided a complete high level project specification, so I will begin defining lower level requirements. First I will define an infrastructure for the project. This is a desktop application, which means defining infrastructure for it is usually simpler than it would be for a server application. We will use:

We divided this project into several iterations. In the first one we will use just two developers, so I will use just a few agile techniques (no product / sprint backlog and agile metrics for now).

I have found that many developers dislike the idea of using a heavyweight integrated development environment and prefer lightweight editors like notepad++, vi or emacs. But after many years as developer, I have found that a fully featured IDE saves a lot of time with features like code autocompletion, refactoring or the ability to show errors without having to compile the application.

Coding conventions are used to standardize the code structure and for improving code quality. Many developers prefer to do the coding “their own way”, but sometimes that is not an option when working in a team.

Basecamp will be useful for discussing high level features and milestones, as it provides a lot of collaborative tools customized to distributed software development: white boards, forums, project schedulers and trackers…

Low level development tasks will be managed via Trac, as it integrates pretty well a version control software (which allows to share the source code and see what each developer changed), a bug tracking system (where the issues and low level task are managed) and a wiki (what is useful for writing both internal and external documentation collaboratively). In the next articles I will explain more in detail how these work, and how I will use them in this project.

We will also use vWorker for selecting developers, and we will initially pay for deliverables, so we have a fixed cost. If the developers does a good work in the initial part we will consider using pay for time, as it give us more flexibility and it’s better suited for agile development.