Archive for October, 2008

simple bc widget

Wednesday, October 22nd, 2008

I’ve knocked up a simple calculator dashboard widget for OS X. It doesn’t look that pretty, but it utilises the power of bc, and provides a quick and easy front end for it.

simple bc screenshot

The release notes:

 * Simple bc Widget * URL:
 * Author: Ethan Smith
 * Created: 22/10/08
 * Simple dashborad calculator utilising the baisc calculator, bc. This is really just an interface that
 * passes exactly what you enter to the bc command and prints out the result. The idea behind this widget
 * is to make it really quick and easy to perform simple calculations.
 * Some of the things that this widget does (aka why this is better than the commandline):
 *	- Typing anywhere on the widget will start typing in the sum box
 *	- Pressing enter will perform the calculation
 *	- Pressing escape will clear the textfield
 *	- Starting a calculation with an arithmetic operator (+-/*) will perform the calculation against
 *	  the previous result
 *	- The "previous result variable" allows you to substitute the previous result at any point in
 *	  the current calculation (note that this can be a single letter or a longer word, but you'll have
 *	  all sorts of problems if you try to use a number!)
 * Some of the bc features that are known to work:
 *	- Enter almost anything and bc will do it's best to make a calculation out of it
 *			Example "xyz + 14 - ff * 2 - (v + c)" = 14
 *	- multiline calculations are supported, with a semicolon between each calculation. The results
 *	  will also be separated by semicolons.
 *			Example: "10+4; 10+5;" = 14;15
 *	- variable assignment works. Just be careful that variable names don't get trodden on by the
 *	  "previous result variable".
 *			Example: "x=12; x=x+48; x-10" = 50
 * Notes on the implementation of bc:
 *	- this widget really just passes through the calculation almost exactly as entered. Try running
 *	  bc from the commandline, see "man bc" or for more
 *	- the scale (number of decimal places) is set to 3 by the widget

Download simple-bc widget for OS X (zip, 48kb)