MUSINGS

Gnucash with MySQL: Creating custom invoices with PDF output and template based email to the customer

Gnucash with MySQL: Creating custom invoices with PDF output and template based email to the customer

I’ve been using GnuCash for some time and have found it to be a great product. Where GnuCash falls short, in my opinion, is it doesn’t provide for scheduled automatic invoice generation. Additionally creating custom invoices involves learning Scheme which personally I don’t have time to get my head around. So I set out to fix these 2 issues using the tools I know well, namely MySQL, perl, and good old HTML. This post will cover custom invoice generation to html and pdf, and emailing the results to the customer using a template. GnuCash scheduled automatic invoice creation will be covered in another post in the near future. Read more about Gnucash with MySQL: Creating custom invoices with PDF output and template based email to the customer

How to have different shipping rates when using Paypal Hosted Buttons

How to have different shipping rates when using Paypal Hosted Buttons

Paypal web services allows you to specify a shipping rate when adding items to the cart by specifying an hidden input with the name set to shipping and the value set to the amount. The problem is that this doesn’t work when you are using hosted button’s which have shipping details already saved. Try it yourself. Set up a hosted button and then try using <input name=”hosted_button_id” type=”hidden” value=”abcdefghji”> and <input name=”shipping” type=”hidden” value=”0.0″> within the same form. You’ll find that the shipping input will be ignored and the settings you have setup in the hosted button will be used. So what is the solution?
Read more about How to have different shipping rates when using Paypal Hosted Buttons

What’s everybody tweeting? Twitter Translator – Google Chrome Extension

What’s everybody tweeting? Twitter Translator – Google Chrome Extension

I’ve recently coded a new extension for Google Chrome called the Red Mars Twitter Translator. It allows you to translate foreign language tweets within your twitter stream. The reason I made this extension was due to theĀ frustrationĀ of seeing tweets in another language and not knowing what they are saying. Read more about What’s everybody tweeting? Twitter Translator – Google Chrome Extension

How to centre a block element on the page using CSS

How to centre a block element on the page using CSS

In the past I’ve always used the following CSS code to centre a DIV (or other block element) on a page.

#divid {
  width: 620px;
  left: 50%;
  margin-left: -310px;
}

It works by setting the left edge of the div at 50%, which if it containing element is BODY then we are setting the left edge to 50% of the page. If we left it at that then the DIV would start at half way and not be centred at all. The trick is to set the left margin “margin-left” to be negative half of the DIV’s width. This forces the DIV back towards the left by half and therefore you end up with a DIV centred on the page.
Another method is to use the following. Read more about How to centre a block element on the page using CSS