Friday, December 15th, 2006

flwyd: (Trevor shadow self portrait)
At work we use iText, a free library for manipulating PDFs. The library's author makes his money by giving away cool software that's complicated enough that developers are motivated to buy the book so they can use it well. We just bought said book, and I want royalties:

Trevor armed and ready to do battle with code
flwyd: (java logo)
Save me Edsgar! I just wished I could use a goto statement in Java. My code's primary purpose is to take a bunch of fixed-width data and save it to another file in a tab-delimited format. I decided to add the ability to save the layout. If the layout file already exists, I prompt the user with a Yes/No/Cancel dialog to overwrite. If they cancel, I don't want to write anything (layout or data) and just return from the function. If they say no, I won't write the layout file, but I still need to write the data. If they say yes, or if the file didn't already exist, I write the layout file and then write the data. With a goto, I could break out of my if conditions and just write the data. But without the goto, my options are to set a status flag, write a function to prompt and write the layout, returning a boolean if it was canceled so I can refrain from writing data (probably the best solution), or the following solution: write a one-iteration for loop and break to a label, like so:
Read more... )
August 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 2017

Most Popular Tags

Expand Cut Tags

No cut tags
Page generated Thursday, September 21st, 2017 12:25 pm
Powered by Dreamwidth Studios