Thursday 9 September 2010
Comments on Mesoscale Meteorological Modeling, 2nd Edition Volume 78 By Roger A. Pielke, Sr.
On the dark side, the thermodynamics chapter has been reported to have some ambiguities about i.e. conservation of heat. During my postgraduate studies I was assigned to study the 1rst edition of the book, so as to be examined orally. Thus, in the absence of exercises or questions, I had to write my own, corresponding to each paragraph of text. I suppose having spent such a large amount of time and effort made me wonder, whether the newer edition offered such supplements. I am afraid it doesn't!
All in all, the book is advanced text and the reader is assumed to have perfect knowledge of several topics, especially statistical physics. Its second edition proves its success, but as far as the student is concerned, adding some sort of practice would mean great help.
Wednesday 8 September 2010
JDeveloper 11g:Using Log4j in stateful EJB
Since the use of log4j has proven to be a very popular subject for the readers, another code snippet for your Model project will be given as an example. In case you prefer ADF business components, you can find an example too. If you 'd also like an example for a backing bean for your ViewController project this time, you can have it here.
First, one has to double click the project, so that the window of the libraries appears, in order to add the Log4j jar library.
Second, navigate to C:\...\Model\src to create the log4j.properties file:
# **Set root logger level to DEBUG and its only appender to A.
log4j.rootLogger=DEBUG, A
# ***** A is set to be a ConsoleAppender.
log4j.appender.A=org.apache.log4j.ConsoleAppender
# ***** A uses PatternLayout.
log4j.appender.A.layout=org.apache.log4j.PatternLayout
log4j.appender.A.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
Finally, if one 'd like to use log4j within a stateful EJB class, the source code is similar:
...
import org.apache.log4j.Logger;
@Stateful(name = "PlaceOrder", mappedName = "ejb3inaction-Model-PlaceOrder")
@Remote
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class PlaceOrderBean implements PlaceOrder {
Logger logger =Logger.getLogger(this.getClass().getSimpleName());
...
@Remove
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public Long confirmOrder() {
...
em.persist(order);
if (logger.isDebugEnabled())
logger.debug("******************Order confirmed!**************");
return order.getOrderId();
}
...
}
Thus, one gets the following log output from the integrated Weblogic server:
Run startup time: 9656 ms.
[Application ejb3inaction deployed to Server Instance IntegratedWebLogicServer]
0 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO PlaceOrder_i7ibfi_Impl - ******************Order confirmed!**************
Finally, if you need more tips about appenders:
http://www.mobilefish.com/developer/log4j/log4j_quickguide_appenders.html
Sunday 5 September 2010
Comments on Teach yourself JavaScript in 24 hours by Michael Moncur, 4rth Edition
On the dark side, the reader has to know beforehand, some programming essentials, since the text does not analytically present some subjects in great length and depth, i.e. some complained about the coverage of loops.
All in all, the book is a success, now in its 4rth edition, offering an introductory course in JavaScript for experienced programmers. Moreover, it is very useful as a reference, offering a wealth of information in its appendixes: other JavaScript resources, tools etc.