9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] plan9 program to balance your checking account
@ 2001-03-03  2:34 tad
  0 siblings, 0 replies; 4+ messages in thread
From: tad @ 2001-03-03  2:34 UTC (permalink / raw)
  To: 9fans

I got sick of trying to balance my checking account on 
paper and by hand.  It's much easier to rearrange and
fix incorrect transactions in your favorite text editor
such as acme(1) or sam(1).

So, I threw together a simple program to help me out.

You can find it at:

	http://www.csh-east.org/~tad/plan9/

-Tad

P.S.  It's not very efficient, but then again, I average
about one transaction per day, so it doesn't have to be.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] plan9 program to balance your checking account
@ 2001-03-06  9:23 okamoto
  0 siblings, 0 replies; 4+ messages in thread
From: okamoto @ 2001-03-06  9:23 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 87 bytes --]

>i'm still in the red.

You can use colormap to change red to blue.  :-)

Kenji


[-- Attachment #2: Type: message/rfc822, Size: 1621 bytes --]

From: forsyth@caldo.demon.co.uk
To: 9fans@cse.psu.edu
Subject: Re: [9fans] plan9 program to balance your checking account
Date: Sat, 3 Mar 2001 11:02:38 0000
Message-ID: <20010303110428.43ABE199E4@mail.cse.psu.edu>

i tried tad's program and i was disappointed.
it didn't balance my account at all.
i'm still in the red.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] plan9 program to balance your checking account
@ 2001-03-03 11:02 forsyth
  0 siblings, 0 replies; 4+ messages in thread
From: forsyth @ 2001-03-03 11:02 UTC (permalink / raw)
  To: 9fans

i tried tad's program and i was disappointed.
it didn't balance my account at all.
i'm still in the red.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] plan9 program to balance your checking account
@ 2001-03-03  7:06 Russ Cox
  0 siblings, 0 replies; 4+ messages in thread
From: Russ Cox @ 2001-03-03  7:06 UTC (permalink / raw)
  To: 9fans

The C program admittedly does more than this,
but I've been quite happy with:

g% cat balance.awk
/^#/	{ next; }
NF>=3 && $1 == "+" { total += $3; next; }
NF>=3 && $1 == "-" { total -= $3; next; }
NF>=3 && $1 ~ /^[0-9]+$/ { total -= $3; next; }
NF>=3 && $1 == "=" {
	n = total - $3;	
	if(n < -0.005 || 0.005 < n)
		printf("%s:%d: computed total %.2f expected %.2f\n",
			FILENAME, NR, total, $3);
	next;
}
{ printf("%s:%d: syntax error: %s\n", FILENAME, NR, $0); }

END{ print total }
g%

The input file is a sequence of lines of the form
	+|-|=|checknumber	mm/dd/yyyy	amount	comment

Russ


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-03-06  9:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-03  2:34 [9fans] plan9 program to balance your checking account tad
2001-03-03  7:06 Russ Cox
2001-03-03 11:02 forsyth
2001-03-06  9:23 okamoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).