Random Musings of a Coffee Technologist

Month

January 2011

8 posts

Adding Dynamic SVG Charts to Typica

image

With the changes in reports mentioned previously, I thought that I would be able to start adding SVG graphics to reports since I was using the same object to display the report as I had previously used for printing roast profiles. Due to the content getting to that object through a slightly different code path, it turned out that I needed to add 25 characters to the new code to turn that feature on.

image

The difference is specifying an application/xhtml+xml MIME type for the data. Without this, the SVG content is simply ignored. With this change and a bit of algebra, it’s possible to construct graphical representations of any quantitative data that can be gathered from the database. The top image shows a graph with four data series showing cumulative roasted coffee production for every day of the year to date, the same data for the previous year, the percent change, and a seven day rolling average of the percent change. Note that the axis ticks and labels are not hard coded, but are selected based on the data being plotted.

Jan 27, 2011
#Typica #coffee #data systems #SVG #charts #programming
Improved Reporting in Typica

image

Recently I wanted to add a new report to Typica. This was a report showing an itemized comparison of year to date roasted coffee production compared to previous year to date roasted coffee production (with totals and changes) to make it easier for me to see on an ongoing basis how I’m doing compared with production goals (which in turn is a good proxy for sales). Unfortunately, I quickly discovered a problem. My mastery of SQL is not sufficient to get the itemized data out of a single query and the old reporting framework was not sufficiently flexible to handle the way I knew how to get that data.

It turned out that if I added less than 2 dozen lines of code, I could repurpose some code that had been written to support printing roast profile data to instead generate more complex reports. When I did this, I also discovered that generating reports in this way produced nicer looking and easier to read reports. The difference was striking enough that I decided that I would depreciate the old report framework and rewrite the existing reports to be generated in the new way.

While doing this, I also noticed that it would be easier to make parameters of the reports customizable. The examples provided with the next release of Typica will take advantage of this to add some requested features to the existing reports along with some changes that I find useful myself. These include changing the sorting order of information in the reports (see picture above) and allowing new ways to filter the data to make it easier to get at the information you want.

The new code opens up a lot of possibilities for new reports in Typica. Hopefully all of you using this will also enjoy these changes.

Jan 18, 201114 notes
#coffee #roasting #data systems #Typica #reports #programming
“Sattinger’s Law: It works better if you plug it in.” —Arthur Bloch, Murphy’s Law and Other Reasons Why Things Go Wrong (1977)
Jan 17, 2011
#quote
Sliders and Documentation

Lately most of my software development time has been spent on a mobile application for coffee evaluation. I’d say that it’s a cupping app, but this would cause people to expect that it is similar to other programs for handling cupping data (including the last two that I wrote) when it goes beyond cupping to a more general problem. Between consideration of some of the other use cases and experience using a prototype of the application, I decided that I needed a new user interface element.

A slider widget is a user interface element that allows the selection of value from a finite range. As they allow direct manipulation, they are particularly well suited to touch oriented interfaces. For numeric input, there are a few alternatives. Text fields can be constrained to only accept numeric input, but typing values can be cumbersome. A spin box provides controls for incrementing and decrementing a value, but it takes too long to change the value from one side of the range to the other. The basic slider widget also has its limitations, but with the ability to quickly tap a value near the desired one and drag across the widget if needed to fine tune that selection, it’s probably the fastest option, but I wanted a few features a slider does not provide.

Consider evaluating a coffee for quality assurance purposes. There would exist a specification for that coffee: a list of scored attributes with an accepted range of values for each attribute. It would be useful for the slider widget to provide a visual indication of whether the selected value is within the specified tolerance. This can be done by subclassing a slider class, replacing the code that draws the widget, and providing a way to specify what color to draw the value area for various value ranges. Tick marks could be drawn across the widget at the edges of differently colored regions to provide an additional visual aid when selecting values.

Next, there is the problem that sliders do not display their value. When a program is used on a device with a large screen, this isn’t a problem. If the selected value needs to be visible, it can be shown on a label next to the slider. Unfortunately, the usability of a slider widget depends on both the width of the widget and the number of distinct values the slider represents. On a mobile device with limited screen space, it would be better to display the value in the widget rather than next to it.

Finally, there are many cases where a person would like to be able to select fractional values, but slider widgets only select integer values. As long as the number of selectable values is finite and enumerable, it is possible to map those values onto a set of integers the slider can use.

While writing the classes that implement these features in a slider widget, I decided to try providing two different styles of documentation. Typically, when documenting software, the author will document either the interfaces provided by that software or the design of that software. Put another way, the documentation describes either how to use the software or how the software works. For these slider widgets, I decided I would do both and see which set of documentation is most useful in the long term.

To document how the software works, I wrote the classes and documentation in such a way that it could be run through CWEB. This is a system that allows me to write the source code as comments to the documentation. It also allows me to split functions into named chunks which can be documented separately. For example, the code that handles drawing the described widget looks like this:

image

The full documentation can be read here.

The other style of documentation is generated by Doxygen. This takes specially formatted comments and produces documentation what parts make up that software and how to use them. That documentation is available here.

Jan 12, 20113 notes
#CWEB #Catimor #documentation #programming #slider #Doxygen #C++ #Qt
Jan 10, 201140 notes
Roast Magazine → roastmagazine.com

Today Roast Magazine wants the word spread on their new site design. Roast is, in my opinion, the most useful trade journal for the professional coffee roaster to read. On the site, you can go to the Education Tab and click Roasting 101 to get a sense of the informative content delivered in each issue.

Jan 6, 2011
#coffee #roasting
Jan 5, 2011
#coffee
A Year of Roasting

One of the nice things about having my roasting records in a database is that when I want to know some bit of trivia about my roasting, it’s often just a query away. With the new year, I thought I’d look back and see what I did at the roaster last year.

Number of batches roasted: 1,418

Pounds of roasted coffee produced: 14,618.56

Lots of green coffee used: 73

Pounds of green coffee purchased: 18,966.53

Average weight loss of approved production batches: 16.24%

Shortest roast duration: 11 minutes 44 seconds (Ethiopia)

Longest roast duration: 19 minutes 26 seconds (Sulawesi)

Total roasting time (only counting time with coffee in the drum): 370 hours 30 minutes 7 seconds

Not bad for a single location roaster/retailer with minimal wholesale sales (wholesale sales accounted for 0.4% of total sales).

Jan 4, 20111 note
#coffee #roasting #statistics
Next page →
2012 2013
  • January 44
  • February 29
  • March 52
  • April 50
  • May 33
  • June 22
  • July
  • August
  • September
  • October
  • November
  • December
2011 2012 2013
  • January 62
  • February 42
  • March 49
  • April 43
  • May 74
  • June 42
  • July 74
  • August 70
  • September 40
  • October 130
  • November 66
  • December 52
2010 2011 2012
  • January 8
  • February 11
  • March 12
  • April 6
  • May 14
  • June 28
  • July 30
  • August 30
  • September 42
  • October 49
  • November 57
  • December 80
2010 2011
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December 11