This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.

Sachin Joshi

Ranch Hand
+ Follow
since Mar 23, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Sachin Joshi

Originally posted by Ameya Thakur:
I wanted my Resultset to get only the last 'n' records from the resultSet.

Say for Example, My Query Return 10 rows and i wanted to display only the last 4 records of the query.



Hi Ameya,

This can be done in java as well as on DB side. Which way you want to do it depends on your total number of records and some other factors.

1. In java approach, fetch all records from DB. Then using ScrollableResultSet, display only certain number of records each time.

2. In DB approach, write a query such that you will only fetch those records which are to be displyed. Here, for showing next set of records, you have to query the DB again. I have not used this approach much, but these queries are usually written using default "ROWNUM" field (I am talking about Oracle).

I Hope this will help.

Sachin

Originally posted by Satish Gopalakrishnan:
I would like to know the methodology to modify excel sheets and save them from a JSP where they are displayed .
I have a page with two frames. One in which an Excel sheet is displayed. I want to the user to have the ability to save the changes he made by pressing a Save Button in the other frame . What is the best way to go about doing this. Any suggestions?





Hi Satish,

I do not know about your application requirements. But, usually we use Excel files for display and storage of application data. The modifications you can easily carry out using JSP pages. Later the modifications can be saved back to Excel.

To answer your query, there is a API on ( !! it is Jakarta Stuff !! No cost) Jakarta site that allows you to read and write Excel files. That jakarta project is Jakarta POI project.
Now you need to display the Excel file and save the changes done by the user. So, you can use this Jakarta API to read and display Excel file as well as to save the changes to the Excel file.

(I have not used this API much,so you need to diggin more if you need. )


Regards,
Sachin
20 years ago
JSP

Originally posted by eloimachado eloimachado:
Hello!

When I am trying to run my Tibco Hawk Display, I get the window of Tibco Hawk Display Startup... telling me "Initializing WorkspaceManager..." for ever!

Why this happens? What shoud I do to solve this problem and start the Hawk Display?

Note: I use W2k.




Hi,

Do check you have all the things installed as per the requirements specified in Tibco Hawk Manual. i.e. check this

1. Required O.S. Version
2. Required JDK Version(this is important)
3. environment variables are set or not
4. Are you runnning the Hawk Display with required user grants i.e. if the manual specifies "root" user to run the hawk.

Hope this helps.

Sachin

P.S. Do visit Naming Policy of the Ranch site.
20 years ago

Originally posted by sonu arora:
Bear

I want to read a config file inside a java file and then this java file will return the include directive (from config) to the calling jsp file which shld include the content of that included jsp.
That config file may have 0 or n number of jsp's to be included.




Hi sonu,

I will try to answer your query. See, slightly going in the details of Page Life Cycle of JSP page, you must be knowing that

*JSP file is translated into the servlet class.
* During the translation process, all the code written in the scriptlets (<%..%> and Expressions(<%= ..%>
is put in the _jspService() method as a Java statements.
*Once the translation process is complete, this java class is compiled, created a instance of it and the output
written to the JspWriter is displayed on the screen.

Now, taking your code,

*<%= testing.get() %> is a Expression type statement, so on translation it will put the following line in _jspService() method.

out.print(testing.get());

* So, during the runtime, it will write the output of get() method on the screen. Your get() method is returning
this "<jsp:include page='test.jsp' />" statement. Hence, it will print this STRING on the screen.

It is happening correctly as per what you have coded. But, you want something different.

You want this include statement to be executed by JSP Engine. Now, for this to happen, you should have
<jsp:include page='test.jsp' /> statament in your JSP file before the page is translated into the servlet. So that, during the translation process, JSP engine will translate your INCLUDE statement by actually putting the output of the said files in the output of your JSP file.


I Hope, it will help you.

Regards,
Sachin
20 years ago
JSP

Originally posted by Ashish Agrawal:
Yesterday it rained heavily in Pune. It was the first rain of the season. I and my friends n'joyed a lot..

- Ashish Agrawal



Hi Ashish

Enjoy Pune Rain and Sinhgad...and then Garam Garam Bhaji on Sinhgad...I am missing it here a lot.

Sachin
20 years ago

Originally posted by Shabir Husain:
hi..
i wana create a bridge between apache and tomcat for jsp to servlet and servlet to jsp..so, what will be the configuration of apache and tomcat..
i have installed apache 2.0.49 at XP and tomcat 3.3.1...
Thanx
Shabir



Hi shabir

Try this link.

http://www.onjava.com/pub/a/onjava/2002/11/20/tomcat.html

Hope it helps.

Sachin
20 years ago

Originally posted by Ko Ko Naing:
Yes, WhizLabs SCWCD 1.4 covers the latest exam from Sun... The version of the exam simulator is 5.2.0.0...



Thanks Ko Ko Naing for the reply.

sachin
Hi,

Does the Whizlabs exam software covers the updated SCWCD exam ?

Regards,
Sachin
Hi,

How's the market for experience in TIBCO Products, in pune ?

I am looking for a change.

Sachin
20 years ago

Originally posted by Kiran Kanade:
Are there any companies in Pune
interested in Japanese.
How much time it will take to
find the Job.
Do i need to do any certification



Hi kiran,

I am also in Japan...Just give me ur cell no....in case if I find anything, I will inform you.

Sachin
20 years ago

Originally posted by Chris Ramsey:
Thanks Sachya Joshi,

So the FlashCardSet class is a part of the model layer and not the controller. You are saying that I need a class I'll call FlashCardController that will check the answer and move the flash card to its appropriate list depending on if the answer she gave is correct or not and update the view to report whether her answer was correct or not.
This means that it needs to have a reference to the FlashCardSet, to get the flash card solution to compare her answer with and the FlashCardUI display the result. So is the textfield that she enters her answer in actually a part of the controller layer and not the view, like I was thinking?



Hi Chris,

ya, I would suggest FlashCardSet is a part of Model and controller class like FlashCardController will use it as a data.So, once the user enters the answer, your controller will take appropriate action and will update the Data (Model).
But, I differ on what u said that FlashCardUI is part of controller. NO, I would suggest it to be a part of View. Once FlashCardController completes the data updations, it will refresh the View. As the View class is using the data class from Model layer to display the result, it will get the refreshed data to display till this time.

Regards,
Sachin
Hi Chris,

I will try to answer some of your questions. I have used MVC pattern in the applications that needs to access some Database. My view of looking at this pattern is like :

Model ->
This layer will depict a Data Model. So, in case of database applications, if I am accessing any data, the structure that stores the data will be stored in Model Layer Classes. In your application, I feel, FlashCardGenerator will fit in this Layer, as it is responsible for generating the cards in first place.
Regarding having a separate class as FlashCard, I would suggest you should have it. A separate class will be a good way to represent your Flashcard data. Also, it would be a flexible approach in case tomorrow if you need to add some more details for each flash card.

Controller ->
This layer contains the business logic or application logic to modify the data. I feel, you should have 1 more class that will be responsible for handling your applications logic like Deciding the answer is right or wrong, whether the current card is active or error card and so on. FlashCardSet class described by you can still be stored in Model Layer as it is storing the Cards. and it can be used as a data for Controller Layer class.

View -->
These are the classes that creates the front end of the application. Usually, this layer is created using JSP pages, Html pages, Swing applications, etc. Above said FlashCardUI class can be a good fit here.

So, in usual cycle of operations, View Layer class will be responsible for interacting with the user actions and take the user inputs. After taking the inputs, it can call Controller Layer classes to handle those inputs. In turn, controller can use Model Layer classes as their data to be acted upon. After the controller is ready with the response, it can refresh View layer classes to update the UI and display the results.

I hope this should push your road block a step ahead. Do reply with your views on this.

regards,
Sachin


Originally posted by Chris Ramsey:
I am writing a FlashCard application for my daughter. At the same time I want to learn and implement a design pattern that will allow me to add functionality easily and one that I can re-use for future apps. I've looked at MVC, EventManaging, Visitor and I feel I understand what they do, but it falls apart when I try to implement them. Here's a description of the what I think the classes I have so far and what role I think they play within the app:

1. FlashCardGenerator: (MODEL?)
The FlashCardGenerator class creates FlashCards. It's createFlashCard method is called to generator 2 random numbers and make an addition or subtraction flash card. (multiplication and division to be added later).

I'm not sure whether I should have an actual FlashCard class or a member variable of the FlashCardGenerator since its primarily just a string that holds the numerals, operator and the solution.

2. FlashCardSet: (VIEW of FLASHCARDMODEL?)
I am not sure if this class is necessary. It is an array list that holds the FlashCards generated by the FlashCardGenerator. This way the user can determine how many cards they want to solve for each round. I guess an alternative would be just to loop a call to FlashCardGenerator.createFlashCard method. One reason for having this class it that if any flash cards are answered incorrectly 3 times they are marked as incorrect and stored so that at the end of the round the program will inform her of how many were answered incorrectly and if she would like to try them again. So this class would have two ArrayLists (active and error) The active set holds the flashcard she is currently working on and the error set would house the incorrectly answered cards.

3. FlashCardUI (CONTOLLER TO FLASHCARDSET AND FLASHCARD)
This class has the flashcard panel, the progress panel and the skip and reset buttons. This is where I really want to know which pattern would best fit this scenario.

The basic program flow is this:
a. flash card is displayed
b. flash card is answered
c. answer checked against solution
d. progress panel updated
e. next flash card in set displayed

The skip button allows her to move to the next flash card in the set. The reset button clears the set and asks her if she would like to create a new set of cards. The progress panel has 2 labels (correctLabel and incorrectLabel) that are updated each time she answers the equation based on whether the answer is correct or not. My road block is here. Which class should be responsible for checking her answer against the solution and updating the UI based on the outcome? I have explored creating an AnswerEvent object that would hold her answer and go to some class to be checked against the solution. But again, should there be a separate class that does this? Should the UI class create the answerEvent? Maybe a CheckAnswer class that listens for answers and then returns a status of right or wrong? My thinking is that a design pattern will answer the questions and help me sort out who and where to do what, but which one. Thanks for your patience.

[ June 02, 2004: Message edited by: Chris Ramsey ]

[ June 02, 2004: Message edited by: Chris Ramsey ]

Originally posted by Sachya Joshi:
Hi all,
I am getting following error on tomcat start up...Can anybody guide me in this ?
Apache Tomcat/4.0-b4-dev
XmlMapper: Can't find resource for entity: -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN --> http://java.sun.com/dtd/web-app_2_3.dtd "null"
PARSE error at line 2 column -1
java.net.UnknownHostException: java.sun.com
XmlMapper: Can't find resource for entity: -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN --> http://java.sun.com/dtd/web-app_2_2.dtd "null"
PARSE error at line 2 column -1
java.net.UnknownHostException: java.sun.com
XmlMapper: Can't find resource for entity: -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN --> http://java.sun.com/dtd/web-app_2_3.dtd "null"
PARSE error at line 2 column -1
java.net.UnknownHostException: java.sun.com
XmlMapper: Can't find resource for entity: -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN --> http://java.sun.com/dtd/web-app_2_2.dtd "null"
PARSE error at line 2 column -1
java.net.UnknownHostException: java.sun.com
XmlMapper: Can't find resource for entity: -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN --> http://java.sun.com/dtd/web-app_2_3.dtd "null"
PARSE error at line 2 column -1
java.net.UnknownHostException: java.sun.com
XmlMapper: Can't find resource for entity: -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN --> http://java.sun.com/j2ee/dtds/web-app_2_2.dtd "n
ull"
PARSE error at line 3 column -1
java.net.UnknownHostException: java.sun.com

I am using SOlaris platform to run the tomcat.
My Guess:
1. during the tomcat startup, it is making call like
resolveEntity('-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN', 'http://java.sun.com/j2ee/dtds/web-app_2_2.dtd')
Now during this call, it gets the DTD file and then validates the web.xml file with it. But, if during this process if it is not connected to the internet, it will not find the required resource i.e. DTD file and hence it will throw the above exception. Is it right ???
2. If that is the case, how can we tell tomcat not to go to net for DTD , but refer local DTD file ? is their any setting in context definition ?
Any help is appreciated.
Thanks,
Sachin


Hi group,
My problem is solved. Actually, it was problem of required JRE version. In my application tomcat was not standalone. But it was embeded in
another e-commerce server. The manual of that server was mentioning to use JRE 1.4 or lower. So I started with using 1.3. Finally,
after getting no clue for this error, I tried to use JRE 1.4 and it was solved.
Thanks, you might have put some efforts on this.
Sachin
20 years ago

Originally posted by Sachya Joshi:
hi,
I am studying EJB using Head First by Kathy & Bert. It is fundoo book. It nicely goes to the deeper level of eachdeployment process. BUT, I donot understand why the authors have not mentioned about passing the parameters while creating InitialContext Object in FIRST chapter of the book.
I followed all the steps as per the book, but on running the AdviceClient I am getting error as

D:\Projects\advice>java -cp .;AdviceAppClient.jar AdviceClient
javax.naming.NoInitialContextException: Need to specify class name in environmen
t or system property, or as an applet parameter, or in an application resource f
ile: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at AdviceClient.go(AdviceClient.java:33)
at AdviceClient.main(AdviceClient.java:26)

Can authors please guide me in this ?

Thanks a Lot in Advance
Sachin



HI,
My problem is solved. This forum helped me to narrow down my problem cause as CLASSPATH error. After solving that, I got a famous CORBA.BAD_OPERATION error. But, there was enough help on
http://www.wickedlysmart.com/HeadFirst/HeadFirstEJB/HeadFirstEJBNotes.html to solve that.
Thanks to the HF EJB Authors for keeping this update on the site.

Sachin

Originally posted by Dheeraj Thakur:
I found out the solution to this problem. It was the classpath settings and I have sorted it out.
Thanks for ur reply.
Dheeraj


hi dhheraj
I am facing same problem. What exactly was missing in your classpath ?
Can you tell us what changes u made to ur classpath ?
thanks
sachin