Skip to main content

Posts

Showing posts with the label java

Do I really need a service layer?

My web application is written using Spring MVC + Hibernate. My model is "Customer" entity POJO. I have got a DAO object "CustomerDAO", its method "saveCustomer(c)" contains the code interacting with Hibernate; Then I created a " CustomerService with a "saveCustomer(c)" method who simply pass the customer object to the dao for saving; Finally there are "CustomerController" and customer.jsp, who are responsible for the view layer, the jsp's form fields are bound to a Customer object on the controller side. The controller calls the service.

Java native launcher performance

I have a program written in Java and a native launcher written in C++, based on a sample at http://www.codeproject.com/Articles/17352/JVM-Launcher . A strange thing is that running my program with my native launcher take more CPU than using java.exe (~5% vs 15-20%). I have been giving this situation some thought but it still doesn't make much sense. I've tried increasing the JVM heap size, (re)built the native launcher in release mode, used different JRE version(1.6_24, 1.6_31, 1.7_03) but no luck.

Use system PIN dialog in Android application

Background I am trying to write an application which works like described below.

How much to grow buffer in a StringBuilder-like C module?

In C, I'm working on a "class" that manages a byte buffer, allowing arbitrary data to be appended to the end. I'm now looking into automatic resizing as the underlying array fills up using calls to realloc . This should make sense to anyone who's ever used Java or C# StringBuilder . I understand how to go about the resizing. But does anyone have any suggestions, with rationale provided, on how much to grow the buffer with each resize?

c2dm 401 error when sending messages after receiving id and auth token

I have seen many similiar questions but no good answer despite some of them being accepted. I have registered for C2DM. I received confirmation email. Then I wrote some simple app to register for C2DM. I get the id (tried on emulator and on real device). Then I got the auth token (with curl) for my email that I used for C2DM registration (the same email that I use in app for acquiring the id).