Harvinder Thakur

Ranch Hand
+ Follow
since Jun 10, 2008
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Harvinder Thakur

Hi Shoaib,

Why would you want to ensure that the application exits?

If a user does not exit the application and goes to the Home app. then we can assume that s/he is deliberately navigating away from your activity, thus making the process in which the activity is running into a "background process" I guess.

As per the Android Process lifecycle the OS would sooner or later kill the process depending upon the memory requirements.

So, if you really want to exit the app for some reason then maybe you could custom implement the onPause(), onStop() methods. e.g. if activity remains onPause() or onStop() for a specified duration of time then call onDestroy(). But then you need to be really sure that the user actually wants to exit your app and does not want to return to it at some later point in time and that's a bit difficult to guess.
12 years ago

I hope i've understood your question correctly!!

Since both the activities 1 & 2 would be accessed by a button click from the respective UI of the activity, it seems impossible to have a concurrent database access issue in case of these two activities. A user cannot click two buttons in two different UIs at the same time.

Does this answer your query?
12 years ago

I am not able to deserialize an object using java which has been serialized in .NET.
Are there any compatibility issues between serialization/deserialization implementation in Java and .NET?

Any help is appreciated.
14 years ago
Unfortunately, I am stuck up as i dont have time to experiment. I want the best way to go ahead. Anyways thanks for your response.
14 years ago
I need to create a web based ebook creator.
I need to generate Chapters/Sections, Table of Content, include content from HTMLs, images, PNG, JPG, Flash, PDF, DOC/TXT, PDF etc file types
and should be able to format it and generate a corresponding output ebook in PDF or FLASH format.

Can i use FSeek Editor to achieve this?
14 years ago
Thanks Anthany,
IText generates PDFs.

I also need to be able to include files of following types to create ebook content:

What API do i need to read all such content and then create PDF or Flash as output?
14 years ago
The ebook format can be pdf and flash.
14 years ago

Any idea how to create ebook in java.? do we have any API for that?
14 years ago
Aha....the answer is indeed B as per the specs even though my container behaves differently..
gud work kamal for digging it out....
Did you try the HttpServletRequest.getCookies() to verify your claim?
Yes i agree with you.
Choices b, c, d will be correct whether the desired attribute exists in any scope or not.

from the servlet code , it is a polymorphic reference

foo.Person p = new foo.Employee();
request.setAttribute("person", p);

so for the standard action , it will only work with this
<jsp:useBean id="person" type="foo.Person" class="foo.Employee" scope="request" />

The above will also work with following:

<jsp:useBean id="person" type="foo.Person" scope="request" />


<jsp:useBean id="person" type="foo.Employee" scope="request" />

if only the "type" attribute is mentioned then the attribute with the same id which in our case is "person" should exist in the "request" scope.

It seems the web container does a check of something like:

if ( person attribute exists in request scope
&& [object referred by attribute "person" stored in "request" scope] instanceof
[type= say "foo.Employee"]
return the reference to that object referred to by person attribute
throw an exception
Yes you are right. Servlet 2.4 specs does not have getContextPath() as a method under ServletContext. It should be marked as an HFSJ Errata.
for write problem:

# while(buffer.hasRemaining())
# socketChannel.write(buffer);

you can change above to

Now you don't need to worry about the buffer size when writing.

for read problem:
I suggest that you use selector to notify whenever there is data to be read from the TCP Buffers. When reading you can specify a high buffer size depending upon maximum data that can be sent by the server. I guess that is always predictable in most cases.
Even if the data does not fit into your buffer the first time you read you can always get the leftover data from the TCP buffers on the second read after you receive a OP_READ key from the selector.

I hope this helps.
Thanks luri for your reply.
Actually i've figured the problem is not related to NIO sockets but how TCP/IP sockets work.
The other process that you are talking about is the TCP/IP stack of my OS which takes care of buffering the data sent by the server which can be fetched even after there is a graceful close of the socket connection done by the server. In case of a sudden network failure the data cannot be fetched as it is discarded by the TCP receive buffers immediately on receipt of a RST coding bit in the TCP segment.

thanks anyways..