Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Tarun Trehan

Ranch Hand
+ Follow
since Mar 16, 2012
Tarun likes ...
Android Eclipse IDE Java
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 Tarun Trehan

Implementing the method of activity solved the problem.
I tracked the navigation in a global stack and then handled the stack and invoked specific fragments/activities depending on the navigation history.
Custom history and back tracking for fragments is th best option especially when there are multiple entry points for one fragment.
4 years ago
I am writing an android application where when user clicks on a item on navigation drawer, a new fragment is initiated to handle the use case respective to the click.

There are several entry or trigger points for one fragment. Eg : List of posts is shown under various options; Recent Post List , Top Post List , Category Post List.
From these fragments, when user clicks on a post; the selected post is opened.

Now, I need to handle "back" button click here. As of now, clicking back exits the application.
If I add calls during fragments; it does not function in the desired manner and traversal history is not maintained.

I can post code snippets if required but for now i wanted to know where i am wrong and what is the solution i can try.
Looking forward to core concept associated here.

Added Code Snippet :
4 years ago
One simple example is stated in a post Ping Server For Status & Action
I had to monitor services on my blog i.e. whether it is responding or not.
Hopefully it will help you.
Thanks Ulf.

Looks like android does not have an API i am looking for.
However, i found this thread useful and may try to implement my functionality by leveraging it.

Android : How to Know Contact Change
6 years ago

I have developed a small android application : Contact Updater Utility

The app suggests updates to contacts that do not have country code appended in the beginning.

I want to add a functionality to this app which can alert the user to add country code when the contact is created or updated.
I had read about services that can run in background and check periodically for changed contacts; but that is not something i want to leverage.

So to implement this;"Can i have an event listener/receiver in android which gets triggered when a contact is created or updated ?"
If i can receive this broadcast, i can go ahead to add my functionality.
6 years ago
Thanks for the inputs.
Certainly helpful.
6 years ago
Thanks for the inputs Claude.

I agree for the 1st point of looking at the query; but we have a lot of data displayed from varied sources and hence the queries can take a long time especially during peak loads.

I continuation to the 2nd point;
  • Can you suggest the calculation guidelines for a connection pool ? Any reference material will also help ? I have a breif idea; but want to be sure.
  • The public websites like banking/payments must be having huge connection pool and ensuring short lived transactions only to satisfy a huge customer base;right ??

  • 6 years ago
    I have a web application developed in Java/J2EE connecting to a warehouse at the back end.
    We have IBM WAS as the application server and there is a data source defined in it for database connections.
    The connection pool has is set to a maximum pool size of 30.
    There are several times when the DB queries can take upto 1-2 minutes and hence user waits at the front end.

    What will happen in a scenario when 40 or more different concurrent users access a screen that is running a query at the back end taking 1-2 minutes.

    1. As per the WAS setting, there can be a maximum of 30 connections to DB,right ??
    2. WAS will wait untill a DB connection finishes processing and returns the connection to pool; so it can be assigned to next request in queue ??
    6 years ago

    Appreciate a response and inputs on this query.

    I am facing a similar situation and found the post useful with clear statement of "Connect Exception" the only way to know if server is up.
    However, is it Ok to put some processing/business logic in catch ??
    More details on my specific issue at the following link :
    Ping Server For Status & Action
    Hi All,

    I have a blog site for which i need to check the status and send an alert if the blog is not up and running.
    I need to repeat this task every 30 minutes(configurable in code). Though i have couple of other questions which i can come to later; my initial one is that:
    "If the server has not been started/not responding , there is problem and i should get a notification/alert for it.
    I wrote the java code for this. However, whenever the server is not started, i do not get a proper response code; instead i get a "Connect Exception".
    Hence, i have to call the alert/notification code from an exception."
    Is that correct (to initiate a business scenario from a catch block) or am i missing something here ??

    Following are some code snippets.

    I agree with you on Spring part. It allows method level interception(before-after).
    If you want method level interception for various methods, you might have to leverage regular expressions withing AOP.
    I haven't implemented these though.
    However, what you're looking for; i have not seen that in Struts.
    7 years ago

    SCWCD has its focus on Web Development.
    Preparing for the exam will take you through a typical request response cycle in J2EE. It will also take you through the concepts like filter and web deployment including security features.
    Whether you take the exam or not; preparing for it and studying can easily help you build a web application.
    "Head First Servlets & JSP" is a nice book that keeps you interested with its interactive interface and describes basics very well.
    I have studied this book; however i'm not a SCWCD; so can't say about the weight my advice carries
    All the Best !!!

    Thanks for you inputs.
    I was able to accomplish task with above code.
    Listed, entire solution description here.
    7 years ago

    I was assigned a task at work where i was involved in an ETL process to load data from source file to warehouse. The date formats in source files vary from one source provider to another.
    Hence, i needed a may to validate input string against multiple formats and implemented this solution.