Thank you for visiting! If you liked the site, please add a bookmark, else add a critical comment! Would you like to visit Greece? Traditional Greek flag This real estate site is only available in Greek! The holy mountain

Monday 19 July 2010

Comments on Applied Numerical Analysis, by Curtis F. Gerald, Patrick O. Wheatley, 3rd Edition

On the bright side, the text is well written in American English with few typographical errors. Its text is full of worked examples, figures, graphs and tables with actual results of approximations. The problems at the end of each chapter help the reader to become familiar with the techniques, in a practical way. There are also computer programs for the reader, to practice, that is reusable source code in c, FORTRAN and for other tools, common nowadays, such as Maple, etc.
On the dark side, there are no proofs of theorems, which are of theoretical interest, especially to the mathematicians.
All in all, the book is a huge success, now at the 7th edition, suitable for engineers, or readers fond of the practical view of mathematics.

Comments on Numerical Solution Of Partial Differential Equations: Finite Difference Methods, 2nd Edition by G.D. Smith, Oxford Press

On the bright side, the text is very well written, in British English, with a few spelling errors. It is quite clear and moderately easy to follow. In addition, the text is full of figures, graphs and worked examples.
On the dark side its second edition, (1977) which I have studied, has no unsolved exercises, problems or any questions to reinforce learning and apply the theoretical techniques. Moreover, the book is not accompanied by any program or source code for tools such as Matlab or Mathematica.
All in all, the book is a success, now in its 3rd edition. Its main readers should be mostly students of mathematics, but not of engineering.

Tuesday 13 July 2010

Getting the current date in your model layer

Besides the standard way of getting the current date as a String, one could come across the need of inserting in a database table column of date datatype. Thus, the well known code snippet won't be suitable:

 DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
 
 java.util.Date date = new java.util.Date();
 
 String datetime = dateFormat.format(date);
 
 System.out.println("Current Date Time : " + datetime);
 
In case you use ADF business components for your Model project, you get the 
current date in a slightly different way. Consider for example the following code snippet,
from an adf business components, employees entity object: 
 
import oracle.jbo.domain.Date;
...

              
protected void doDML(int operation, TransactionEvent e) {
                if (operation == DML_UPDATE) {
    ...
               histStartDate = row.getEndDate();
              /*Check whether end date equals current date*/
              if (histStartDate.equals(new Date(Date.getCurrentDate()))){
                  System.out.println("End date equals current date!");
                  }
      
In case you need to convert  oracle.jbo.domain.Date to java.util.Date, please consult this:

http://forums.oracle.com/forums/thread.jspa?threadID=2185902&tstart=15

or

http://www.ecotronics.ch/webdesign/javadate.htm
  

Finally, in case you prefer EJB's for your Model project instead, you might consider the following example:

/*Typical current date for DB inserts */
java.util.Date today = new java.util.Date();
java.sql.Date bidDate = new java.sql.Date(today.getTime());
/* public void setBidDate(Date bidDate)*/
newBid.setBidDate(bidDate);

Which is in a sense, the most paradox way of all, since in order to get the current date, you actually need to call getTime()!

References

More help about: using timestamps
http://download.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html