OS X Leopard and Cashboard, sitting in a tree
In the spirit of feeling (and being) productive, I’ve started tracking all the development hours I spend working on Cashboard. Up until now I’ve skipped it, estimating how long I spend working on it every month.
It’s interesting to see exactly how much time it takes to get things accomplished, and keeps me motivated on those days I don’t feel like working.
I also finally took the plunge and upgraded my development machine to Mac OS 10.5.4 yesterday.
One of the great things in Leopard I’m enjoying so far is the web clip capability. It allows you to select any part of a web page, and use it as a desktop widget.
I’ve created a web clip widget to display all of my hours from inside Cashboard. It’s positioned right next to my Cashboard time tracking widget.
Now I know how long I’ve worked, and I can keep tabs on how many more hours I need to put in for the rest of the day.
Interesting feedback loop, if nothing else.
Updated Cashboard feature tour
Just spent the better part of the last two days working on this update to the Cashboard feature tour.
The old tour was long in the tooth, and did a horrible job of communicating why Cashboard is better than the myriad of invoicing software apps out there.
I’d imagine this new tour will spike registrations, and spark a renewed interest in the program.
Time will tell…
Don't take it personal
As most of you know, we released a product last year, Cashboard, which handles time tracking, invoicing, and project quotes (or estimates).
Since the release I’ve refined the product based on my own needs and the multitude of feedback I’ve received via email, forums, and comments strewn across blogs all over the web.
Cashboard is my baby. I pour my blood, sweat, and redbull into it each and every day. Working on something so hard and so often, one starts to develop a relationship with the work…an attachment.
I also handle the majority of customer support and potential customer emails. It’s great because I get to keep my finger on the pulse of what needs attention. However, the downside comes in the form of insane rants, negative comments, and downright outlandish demands a few people make.
Some days it takes all my restraint not to fire off an email that looks more like the lyrics to a gangsta rap track than a customer support response. I’ve slipped a couple of times, but I’m getting better at sleeping on things. It’s a crucial skill.
I try not to take jabs against my baby as a personal attack, but it’s hard. Yet another skill I’m still trying to master.
Of course, a lot of these comments are valid, once you strip away the venom and bile. Being able to sift through the garbage and determine the meaning has paid off multiple times now in the form of design updates, and changes to Cashboard.
So next time someone bashes something you’ve done, instead of immediately lashing out – sleep on it and take it in stride. Discard the way the comment was delivered, and get to the real meaning.
Who knows, there might even be some value in it.
Cashboard is an official sponsor of Rails Rumble 2007
I’m proud to announce that Cashboard is an official sponsor of the Rails Rumble 2007.
The Rails Rumble is a competition to test your Ruby on Rails hacking skills, build some cool new web apps, and make some friends.
The concept is simple: you get 48 hours to design, develop, and deploy a web application from scratch. After those 48 hours are up, you’ll be judged by the community through a peer-ranking system in a variety of categories (see Rules for more information). After about a week of controlled mayhem, judging wraps up and the dust settles. Winners are then declared, and awarded some cool prizes. We’ll be announcing what those prizes are shortly.
We will be giving away 6 year-long Maple subscriptions (a $1080 value each) to Cashboard as prizes, one for each category winner.
HTML / CSS to PDF using Ruby on Rails
Ever tried to save a web page and send it to someone? What about printing a web page? Both pretty much suck.
A lot of people are talking about printing with HTML and CSS these days but what they don’t tell you is the following:
With CSS you can’t…- Determine where page breaks happen.
- Set page size or type (landscape or portrait).
- Print background colors…some browsers don’t even print images.
- Set page footers.
Wow, that’s lame.
Ever tried sending someone a web page? Not a link, but the actual web page. It doesn’t work well at all.
A little history
I wanted to be able to print or send estimates and invoices from our Ruby on Rails application, Cashboard. A good majority of our users felt the same way.
Just sending a link to someone to view a HTML document online doesn’t cut it. What if you want to snail mail that document? Shouldn’t it look the same on the page as it does on your screen?
When I used to create invoices manually I’d always save PDF files for my clients and email them.
PDF handled printing well, was portable, and my clients couldn’t edit the file.
We needed PDF for Cashboard.
The Prince of PDFs
I spent a good week just researching all of the PDF libraries and programs out there.
The ones I found for Ruby wanted me to re-create my documents in some PDF-specific layout language. That wasn’t going to cut it. See, in Cashboard we already had these documents designed in HTML. On top of that, we allow users to customize the colors and upload their logo for invoices. Duplicating the layout wasn’t an option.
After exhausting those possibilities I started looking into HTML to PDF programs. I found a few, but none that were any good at converting HTML and CSS to PDF.
This all changed when I ran across Prince XML. Not only is Prince great at converting HTML and CSS to PDF, it even passed the Acid2 test. They had a ton of demos available on their web site, and provide their program free for evaluation purposes.
Making it happen
Prince is a command line program, available for whatever platform you’re probably running.
It can take a variety of inputs including files on disk, or even HTTP urls. We run a pretty tight ship on Cashboard, and everything is password protected.
Luckilly Prince also can take input from standard in, and can even pass its output back to standard out. This means if you don’t want to mess with saving files and dealing with cleaning them up you don’t have to.
prince.rb, pdf_helper.rb
I cooked up a very simple Ruby library to call Prince and a helper module to include on my Rails controllers. I store them both in the lib folder of my Rails application.
Here’s the full helper, slightly modified for simplicity:
# We use this chunk of controller code all over to generate PDF files.
#
# To stay DRY we placed it here instead of repeating it all over the place.
#
module PdfHelper
require 'prince'
private
# Makes a pdf, returns it as data...
def make_pdf(template_path, pdf_name, landscape=false)
prince = Prince.new()
# Sets style sheets on PDF renderer.
prince.add_style_sheets(
"#{RAILS_ROOT}/public/stylesheets/application.css",
"#{RAILS_ROOT}/public/stylesheets/print.css",
"#{RAILS_ROOT}/public/stylesheets/prince.css"
)
prince.add_style_sheets("#{RAILS_ROOT}/public/stylesheets/prince_landscape.css") if landscape
# Render the estimate to a big html string.
# Set RAILS_ASSET_ID to blank string or rails appends some time after
# to prevent file caching, fucking up local - disk requests.
ENV["RAILS_ASSET_ID"] = ''
html_string = render_to_string(:template => template_path, :layout => 'document')
# Make all paths relative, on disk paths...
html_string.gsub!("src=\"", "src=\"#{RAILS_ROOT}/public")
# Send the generated PDF file from our html string.
return prince.pdf_from_string(html_string)
end
# Makes and sends a pdf to the browser
#
def make_and_send_pdf(template_path, pdf_name, landscape=false)
send_data(
make_pdf(template_path, pdf_name, landscape),
:filename => pdf_name,
:type => 'application/pdf'
)
end
endThis simple module has two methods. Both take an ERB template path as an argument, then a pdf file name.
Make_pdf renders the template to a string, then does some modifications to make all requests within local. I’m passing in all CSS files locally as well, so I don’t have to deal with authentication.
I’ve created some special CSS files for printing, and even can pass in if I’d like the page to be laid out in a portrait or landscape format.
When it’s done it returns the PDF file as data. Nothing is rendered to disk. This method is useful for not only sending the PDF file to the client (as in make_and_send_pdf), but when generating PDF files for email attachments.
Creating PDF files from the controller
Both of these files make creating a PDF file dead easy.
Here’s a slimmed down version of Cashboard’s estimate controller.
class Provider::EstimatesController < Provider::BaseController
include PdfHelper
# Sends pdf of an estimate out...
#
def pdf
# @estimate is set with a before_filter and isn't relevant for this how-to ;)
make_and_send_pdf('/client/estimates/show', @estimate.pdf_name)
end
endDoes it get any easier than that? Check out an example of a PDF file generated with Prince, straight from Cashboard. (Right click and save to your disk…)
Download
Here again are the libraries I’ve created for using Prince XML with Ruby on Rails:They’re free to use, download em and check em out.
Cashboard presentation at May's Silicon Valley Rails Meetup
![]()
I’ll be giving a presentation about Cashboard at the upcoming Silicon Valley Ruby on Rails meetup. If you want some of the behind-the-scenes insight on the product it’ll be worth attending.
For times and directions click here.
Hope to meet some of you there!
Cool Cashboard review over at SolutionWatch
Brian over at SolutionWatch wrote a glowing review of Cashboard today.
Thanks Brian!
Cashboard Timer Widget Drops
Entering your time into Cashboard just got a lot easier.
Cashboard Timer lets you log time without keeping a web browser open.
This was my first widget, and a lot of fun. It took longer than I expected (around three days) but I’m really happy with the results.
There were some quirks debugging with dashboard widgets that I didn’t expect, like errors being logged to the console.
At least the rails part was easy using ActionWebService...
Could a Cashboard open API be coming soon? Hrm….........
Cashboard Manifesto
For those of you interested in the reasons behind why we created Cashboard, be sure to check out the Cashboard Manifesto.
It just went live on the Cashboard Info site.
It might just shed some light on how Cashboard can help your small business as well.
Go to page:
1 2
(Showing 1 - 10 of 16 articles total.)



