Tuesday, September 17, 2013

Shuffle an Array in Java with Easy or Fast way


Objects are a powerful software engineering construct, and Java uses them extensively. While developing Android applications you need fast way of doing something. For example:
Often u need randomized Array which u will save state of stage or something.
In that case how you change order of Array randomly???


There are 2 famous way for this:

Thursday, July 18, 2013

SOLVED: Unknown type '246 in column 2 of 3 in binary-encoded result set


Today at our firm was problem like as "Unknown type '246 in column 2 of 3 in binary-encoded result set" when selected table has column as decimal(10, 2) type. This errors cause because we use old version of mysql jdbc driver. Solution for this problem is:
  1. Download new version of driver
  2. Convert double column to char on selection.
    SELECT CAST(your_column AS char(15)) your_column FROM your_table;
    So in this case on java side u can get it as Double again.

Saturday, March 16, 2013

Create your web services with Spring

In this post I will show "Spring way" to build RESTful web services. It also explained how to produce multiple representations (JSON, XML and etc.), which is an important feature for RESTful web services.
This article explains another way to produce multiple representations using HttpMessageConverter, and examples in the article show how to use RestTemplate with HttpMessageConverter to communicate with services. HTTP requests and responses are text based, meaning a browser and server communicate by exchanging raw texts. With Spring, however, methods in the controller class return pure 'String' type and domain models (or other Java built-in objects). How can Spring serialize/de-serialize the objects to raw texts? This is handled by HttpMessageConverter. Spring has bundled implementations that can meet your common needs. Table 1 shows some examples.