Filed under: Cocoa
Reading Hillegass’s book and came across this issue on page 41.
Do not create a project based on CoreFoundation. There is a Foundation project.
You will come across issues as I did as stated here:
http://forums.macosxhints.com/archive/index.php/t-73684.html
Filed under: Web Performance
Filed under: Electronics
Looking at tvs for my dad and thought this monsterous TV is well worth the price based on reviews from Amazon and BestBuy:
Mitsubishi 73-inch WD-73737
http://reviews.cnet.com/flat-panel-tvs/mitsubishi-wd-73737/4505-6482_7-33604505.html
Filed under: JavaScript
So just keeping track of where I can find a good API for cookies. This is a personal reference for myself and others (if applicable):
Filed under: Java
I’ve decided to be the good samaritan engineer and document software issues that I spent hours trying to find in google. Hopefully, by giving a descriptive title, search engines will be able to pick up this blog quicker.
MessageFormat doesn’t replace {0}
MessageFormat class worked the other day for me, but then it stopped. I spent hours trying to figure out what exactly what was the problem. Why wasn’t the {0} getting replaced properly by the arguments that I provided? I looked at my code over and over, but I couldn’t find what I was mistyping or misunderstanding. The google results kept pointing me back to read the Java API specs.
So what was the culprit??? The APOSTROPHE or single quote.
e.g.
test.key=Bernard’s blog is trying to tell you something about {0}.
So if one runs the code:
Object[] args = {“nothing”};
MessageFormat formatter = new MessageFormatter(resources.getString(“test.key”));
String test = formatter.format(args);
System.out.println(test); //prints: Bernard’s blog is trying to tell you something about {0}.
Why? The apostrophe in “Bernard’s” tells the formatter that you want the text to be displayed literally.
I did find this Sun bug report and it explains everything. Here is the technical response in the bug (which ended up not to be a bug, but expected behavior):
“This is the specified behavior, although admittedly it’s somewhat confusing. An apostrophe (also known as “single quote”) in a MessageFormat pattern starts a quoted string, in which {0} is just treated as a literal string and is not interpreted. Two single quotes in sequence in the pattern result in one single quote in the output string. See http://java.sun.com/j2se/1.4/docs/api/java/text/MessageFormat.html#patterns for more information.”
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4839037
Resolution: Change the apostrophes to use '. This only applies in web contexts. Other solutions, you’re on you own.
If you found this blog to be the worth your time, then leave a message. This lets me know that I’ve done some good in this world by saving your time.