Posts Tagged old

Java compound interest calculator

I wrote a thing to calculate compound interest and print out how much you’ve accrued after each period. It’s pretty basic but I was bored and didn’t want to do it via calculator. The code is in InterestCalculator.java, sample output is below:

Initial principal: 5000.00
Interest rate:     0.05 (4.93%)
# of ann. periods: 4
Total years:       5
Annual Addition:   500.0
Starting year 1 with $5000.00
Year 1, period 1, accrued $61.62, value is now: $5061.62
Year 1, period 2, accrued $62.38, value is now: $5124.01
Year 1, period 3, accrued $63.15, value is now: $5187.16
Year 1, period 4, accrued $63.93, value is now: $5251.09
Added $500.00 for the end of year 1, total is now: 5751.09
Starting year 2 with $5751.09
Year 2, period 1, accrued $70.88, value is now: $5821.98
Year 2, period 2, accrued $71.76, value is now: $5893.73
Year 2, period 3, accrued $72.64, value is now: $5966.37
Year 2, period 4, accrued $73.54, value is now: $6039.91
Added $500.00 for the end of year 2, total is now: 6539.91
Starting year 3 with $6539.91
Year 3, period 1, accrued $80.60, value is now: $6620.51
Year 3, period 2, accrued $81.60, value is now: $6702.11
Year 3, period 3, accrued $82.60, value is now: $6784.71
Year 3, period 4, accrued $83.62, value is now: $6868.34
Added $500.00 for the end of year 3, total is now: 7368.34
Starting year 4 with $7368.34
Year 4, period 1, accrued $90.81, value is now: $7459.15
Year 4, period 2, accrued $91.93, value is now: $7551.08
Year 4, period 3, accrued $93.07, value is now: $7644.15
Year 4, period 4, accrued $94.21, value is now: $7738.37
Added $500.00 for the end of year 4, total is now: 8238.37
Starting year 5 with $8238.37
Year 5, period 1, accrued $101.54, value is now: $8339.90
Year 5, period 2, accrued $102.79, value is now: $8442.69
Year 5, period 3, accrued $104.06, value is now: $8546.75
Year 5, period 4, accrued $105.34, value is now: $8652.09
Added $500.00 for the end of year 5, total is now: 9152.09
Final value: $9152.09

, ,

No Comments

Tuesday, September 11, 2007

sup dawg

No Comments

Java utility to reorganize photos by date taken (via EXIF metadata)

I wrote a little utility to reorganize my digital camera pics based on the EXIF date-taken data stored in the pic. It’s pretty simple, I hacked it together in about an hour,
but I thought it might be worth sharing for anyone else looking to do something similar. My camera organizes stuff as it sees fit sometimes, I am particular about my directory structure. This is probably a job best left to perl, but I don’t feel like getting Perl running on my Windows box where all the pics are. Now I can finally burn all my images to DVD.

  • Drew Noakes’s Metadata Extractor – this is
    a required library used to do the actual reading of the exif data.

  • FileOrganizer.java – Abstract base class that moves
    files from a source to a target directory based on criteria specified in the subclass.
  • JpegFileOrganizer.java – Subclass that
    accepts jpeg files and generates the correct path based on the EXIF data stored
    in the image’s header. So if picture pic00001.jpg was taken on August 20, 2004, and the supplied
    target directory is “/pics”, the directory to which the image would be moved would be
    /pics/2004/08/20/pic00001.jpg.

The main() method is in JpegFileOrganizer, its arguments are [sourceDir] [targetDir].

, , , , , , ,

No Comments

Wednesday, August 30, 2006

Oh snap here it is!

Froogle wish list

No Comments

June 6, 2006

I played around with a Canon PowerShot A540 at Staples the other day and I like it. It takes pictures really quickly… no waiting at all. The 530 may also do that, I’ll have to play around some more.

A530 and A540 compared

No Comments

Apocryphal post #6

EXCITING UPDATE

No Comments

Apocryphal post #4

This is not a “blog.” I hate that term and always have. This is just my page, which I update manually by SSHing to this box and typing all this text in vi. I don’t use any fancy schmancy “content management” stuff, that’s for newbs.

So Christmas has come and gone, I got an Xbox (not 360, which is crap). I used a soft-mod tutorial on it because I have no interest in playing Microsoft’s crappy offerings, and I’m cheap. So I put Xbox Media Center on it and a bunch of emulators, and relived the joy of The Legend of Zelda for NES on my Xbox. I got up to level 5 in a couple of hours. I got a few other emulators running on it, including Xenesis and Surreal64, and I played Zelda64 for a bit as well, though the emulator does some weird stuff with the graphics.

I also decided to put up this Amazon affiliat store crap that I wrote a long time ago that’s just been rotting on my repository machine. Maybe I can make some side cash this way! Some recommended products:

No Comments

Apocryphal Post #3

I wrote a crappy perl script to read all the .flac files in a directory and convert them to MP3 using LAME, extracting the meta-data and inserting it as ID3v2 tags. I figured this might be somewhat useful to others, so here you go: flac2mp3.pl

No Comments

Apocryphal post #2

I watched Chocolat tonight; it was pretty good. So much stuff is going on that I can’t even begin to explain it. The job is good and everything else is ok, or ok enough for now. One thing is clearer to me now than ever before: I was never meant to follow in anyone’s footsteps.

On a less ominous note, here’s a pic of a spider that’s been weaving its web on my front porch for the past 3 weeks, despite my repeated walking right through it. This web is huge, like 3 feet in diameter now.

Free Image Hosting at www.ImageShack.us

No Comments

Apocryphal post #1

This morning, with the help of archive.org, I found a paper I’d put up on my website way back in 1997. It was written for my 12th grade AP English class, during the peak of my Stevie Ray Vaughan fanboy phase. I converted it to PDF because the original ASCII text version looked kind of crappy. Anyway, here it is: Stevie Ray Vaughan’s music as an example of “Flow”.

No Comments