Win a copy of Emmy in the Key of Code this week in the General Computing forum!

Dinkar Chaturvedi

Ranch Hand
+ Follow
since Mar 27, 2007
Dinkar likes ...
Android Java Spring
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dinkar Chaturvedi

A very warm welcome to this forum Adam! I am sure your book has come at a very opportune time.

I had a couple of questions regarding reactive programming as given below:

  • Though I have read many articles and posts regarding reactive programming, I sometimes see a mention of functional programming thrown around carelessly which tends to confuse. My question is around, how both these paradigms affect each other and how far do you see them go together?
  • As I understand reactive programming, I believe, to realize its full potential, reactive support is required end to end in any stack otherwise you don't get the full benefits of being reactive. Given that many systems are gradually warming up to this idea and have started releasing support for reactive, I wanted to know if there is an easy way to make an informed decision of choice based on available options that provide reactive support.


  • 3 weeks ago
    A very warm welcome to you Nicolai!

    My question is around the conceptual analogy of modules in other platforms / tools such as Maven or OSGi. What I would like to know is:

    1. How is this similar and different from modularization provided by Maven and OSGi (though these may not be comparable per se but I wanted to understand from an analogy point of view)
    2. Will these technologies work together and strengthen the notion of modules or do you think they are incompatible?
    2 months ago
    Thanks Marco for your response!

    I completely agree with your statement about this being a big topic and I certainly hope one of your next book covers this. Looking forward!

    Regards
    Dinkar
    A very warm welcome Marco! Glad to see new JDBC books coming up that emphasizes the importance of basics.

    I had a couple of questions:
  • Does this book dwell into best practices, especially around writing scalable applications that can work on heavy loads?
  • Given that sometimes framework's (eg. Hibernate) own approach becomes a bottleneck in applications demanding high performance, are they are recommendations around having pure framework based applications or a mixed approach?

  • A ver warm welcome to Heartin Kanikathottu!

    I have been reading articles and blogs about serverless programming and AWS lamdas for some time now. However, some of them raise concerns about the drawbacks of the same for instance, vendor lock-in etc.

    Does this book address these problems and provide solutions or workarounds?

    Also, does the book provide guidelines on the kind of problems this is suitable for and where it is not?

    Thanks!
    7 months ago
    Not at all. There isn't any specific thing that is bothering us with Eclipse. Its just that we wanted to explore what options do we have and if they are any better than eclipse or even worth the investment. If yes, we could evaluate how better they are in comparison to eclipse and decide if we want to use them.
    5 years ago
    Yes we are using GSON. However, I believe Spring internally uses Jackson for all its JSON conversion needs (though I maybe wrong).

    Spring configuration might be overwhelming because we have more than 20 modules as part of the build. What exactly are you looking for?

    Regards
    Dinkar
    5 years ago
    Hello everybody,

    I am using JDK 1.6 and Spring 3.1.3 to create a RESTful service that accepts an object as JSON which gets converted into a Java object by Spring that I have specified in my service method. Now Spring takes care of parsing the JSON into the Java object and everything works fine.

    The problem appears when I add a property to my primary object which is a superclass reference and can hold a reference to one of its many subclasses. When the JSON is received, the data for the superclass reference is equivalent to one of the subclasses. I found this link that talks about writing a custom deserializer (http://stackoverflow.com/questions/16872492/gson-and-abstract-superclasses-deserialization-issue) but I dont understand how to configure spring to use this.

    Any pointers?

    Regards
    Dinkar
    5 years ago
    Hi All,

    Though we have been using the bundled eclipse-based IDE for android that comes with the ADT, we wanted to explore better IDE options as we have received some budget to buy licenses and hence we are exploring options.

    I came across IntelliJ Idea which has an android development plugin which is known to provide its rich feature set while enabling Android - relevant features.

    Does anybody have experience with IntelliJ or would like to recommend other options to explore?

    Any inputs will be greatly appreciated.

    Regards
    Dinkar
    5 years ago

    Ulf Dittmer wrote:Sounds complicated. Why does it matter whether the file is served by a servlet or directly? Why not always serve it via the servlet? If performance is of utmost concern, the file contents can be cached in memory after it has been fetched initially, thereby avoiding disk access on all instances.
    If you have an Apache in front of the app server, you could put the file into a directory that is handled by Apache, thus avoiding the cluster issue altogether.



    The data in the file changes every minute and we would like to serve the latest content always. So caching is not an option. Performance is not a big concern however, I was just exploring if it is possible to serve the content directly by the container instead of having my servlet streaming the content in the response. Though in this case also, (please correct me if I am wrong) the content will be served by the container's default servlet so I guess I wont gain much here.

    Unfortunately, we dont have Apache but we have a load balancer before the cluster so the file has to be there on one of the cluster instances.

    Roberto Perillo wrote:So the problem is that there is some data that is generated externally, and since your application is in a clustered environment, it might be handled more than one time (i.e. the number of servers in the cluster), and if you save this set of data as a file, then it would exist in only one of the servers, and if a server different from the one the file is saved in handles a request, then the file won't be found.


    Exactly!

    Roberto Perillo wrote:Well, what you can do is, since this set of data is handled on regular intervals, you could create a Quartz job and configure it to work in a clustered environment


    The file contents are going to be a JSON format text which I would like to serve as is. Can Quartz be configured to fire the job to write a file instead of a database?
    5 years ago
    Hi All,

    Apologies if this is not the right forum but this seems to be the best fit for my question. So please feel free to move it around.

    I am working on an application that is deployed on a cluster of JBoss servers accessible via a load balancer. There is a set of data originating from another external service that I would like to expose as part of my application. But since this service is load sensitive, I would like to call this service from a separate standalone Java application only from one instance on regular intervals and put the data in a file which will be statically accessible over HTTP by the container itself. However, since this file will exist only one instance, if a request is routed to any other instance in that cluster, it will result in a 404 File Not Found. So this means that I need to make this file accessible on all instances.

    One approach that I was considering was to have a servlet with the servlet mapping url pattern match exactly as the file name that will hold the data. If the instance on which a request lands is the one instance where the file exists, it should serve the file or else the request goes to the servlet with the same url pattern as the file, which will then fetch the file from the one instance where the file exists and return that in response.

    However, when I use the same url pattern for a servlet as a static file, the servlet is picked up first and the static resource is not looked up at all. Is there a way I can tell the container to look for the static resource first before looking up the servlet?

    Second approach that I could think of was to use a filter with the same url pattern that will check for the existence of the file and if the file exists, let the container handle it or else get the file from instance where this file exists and return the same back in the response.

    Can you think of any other approaches and the pros and cons of each before I decide which approach to take forward?

    Regards
    Dinkar
    5 years ago
    Hi Ishan,

    Yes, that was the first thing I tried. Everything works fine outside attributes. I am able to see the expected output for both <%= %> and <jsp:expression> when used outside attributes.

    Regards
    Dinkar
    Howdy Ranchers,

    I decided to try the mock exam that comes free with the book. I found that the version indicated there is Java EE 1.4. However the book is meant to be used with the Java EE 6 version of the exam.

    Did anybody else notice the same discrepancy? Or Garner Press has not updated the exam at all?

    Regards
    Dinkar
    Thanks a ton Frits. You not only gave me the answers I was looking for but also guided me to the right place where to look for answers - the spec. It is indeed very helpful and now I mostly look there for answers. Sadly, you cant rely on the words of the book if they are not clear to you.

    Maybe Charles can fix this up in the next edition or include this in errata.

    Thanks once again.

    Regards
    Dinkar
    Howdy ranchers,

    Today I came across an interesting behaviour while trying to pass an object to tag attribute via scripting. Basically I wanted to test if both formats of scripting expression are identical in behaviour. From the output, I feel like they aren't. Not sure if this is correct behaviour or not.

    So I passed two attributes (using dynamic attributes) one with the usual syntax: <%=application.getAttribute("obj")%> and the other with <jsp:expression>application.getAttribute("obj")</jsp:expression>. The tag file simply prints the attributes with the details like name, value, type etc.

    JSP that calls my tag file. It simply passes two attributes with same values. The only difference is the syntax elements used to pass the objects.


    Tag file code is simple. It just iterates thru all the dynamic attributes and prints the name and value to the output stream along with their class type of the attribute value.


    Output:
    Please note that the mymodel.Dog's toString() method has been overriden to print the default implementation value (the object class@hashcode) + the name of the property in the object which is dalmatian by default as in this case.


    newScrVar='application.getAttribute("appDog")'----java.lang.String
    scriptingVar='mymodel.Dog@6e72d873: breed=dalmatian'----mymodel.Dog



    Is this the expected behaviour? If not, is this a bug? Or something wrong with my understanding or doing things?

    I am using Tomcat 7.0.46.

    Regards
    Dinkar