Posts

Showing posts with the label Lets Get There

301 Moved Permanently, URLConnection and HTTPURLConnection

If a website has applied a redirection from " BaseUrl" to " BaseUrl /" then what you see the response by hitting " " in your browser "301 Moved Permanently" and redirected to " /" How to deal this situation when creating a URLConnection and know to what URL you have been redirected to? If you specify URLConnection con = new URL(uri).openConnection(); It would create a connection. Later if you try to get the URL from the "con" object. con.getURL().toString(); This would give you the "BaseUrl " and you would not get the redirected URL. But if you create a HttpURLConnection instead of URLConnection. HttpURLConnection httpURLCon = (HttpURLConnection) new URL(uri).openConnection(); then if you try to get the URL it would give the correct redirected URL "BaseUrl/" If anyone does get contradictory results, please do let me know.

Core Dump and Stack Tace on Linux of a Java process

Steps for taking the Core Dump Run the command # ps -ef | grep java get the process id of the java process you want to get the core dump. Next run the command # gdb --pid= Next gdb>gcore This should create a file core. in the /var/tmp location Remember its a binary file. If I find some other better way to take the dump, I would update. If you know other ways please let me know. Steps fr taking the stack Trace jstack [-l] pid (simple) Difference between core dump and Stack Trace Core dump prints the complete memory map of a process and stack trace prints the state of threads of a processs.

Behavior of AUTO INCREMENT column when max value has reached

I was looking on the net for the query that "What will happen in an InnoDB MySQL table with column of type AUTO INCREMENT if the max value has reached?" There is so much of information on the net regarding this but does not lead anywhere. I could not find any official word in this query. Most of the links say that it would throw an error. Some had other views that the behavior is not predictable http://www.dbforums.com/mysql/1207954-auto-increment-field-hit-maximum-integer-value.html So i tried a small test myself through mysqlcc by inserting the largest value in int(11) - AUTO INCREMENT type column (name "id"). Th maximum value i could insert manually was "2147483647" (the next number gives "Out of range value" error) The moment I inserted a new row, the new number assigned to the column "id" was "1000000000" Behavior was strange, might help someone that it did not give an error

Things to remember while developing web application (Some Practices)

Image
Below is a list of technical and non-technical high level points to be taken care. There can be definitely many more. (For exhaustive web application security specific guidelines please refer to http://www.owasp.org/index.php/Main_Page ) See to it!! Visual representation plays a big role in boosting customer involvement. The sooner customer is able to see the UI of the application, more he tends to get involved. The visual representation makes the customer come up with modifications sooner than later. Involved evolvement Customer should always be involved throughout the course of application development. Team should create the process to get the frequent feedbacks and directions. Lack of feedback should be taken up as a risk ASAP specially in case of extreme development with Agile. See the point Customers do need the complete application but are not willing to give time. It’s a known fact that application cannot be bug free. If get to understand the business aspect of t...

Error "Document could not be opened"

When we try to open any of the jasper reports in pdf, csv or rtf format, it results in an error saying that the document can't be opened. However, when we first save the report then it can be opened. This problem only occurs when we connect directly to Websphere 6.1. When there is a HTTP server in between, everything works ok. Analysis: We studied the HTTP header information being transmitted in both the cases; with HTTP Server and without HTTP server. Realized that the issue does occur because in case of no HTTP Server the HTTP had the cache settings as "Cache-Control: no-cache" Following is what we have suggested the customer: If you have 'CookiesConfigureNoCache' property already configured in your server, then please change its value to False, restart the server and try to replicate the problem. Otherwise, please add this property following the steps mentioned below. Steps to configure custom property CookiesConfigureNoCache on WAS 6.1: Login to the Administra...

One or more local transaction resources were rolled back during the cleanup of a LocalTransactionContainment.

You might have seen the following statement in your log file sometimes: [9/11/09 10:26:06:349 CEST] 00000033 LocalTranCoor W WLTC0032W: One or more local transaction resources were rolled back during the cleanup of a LocalTransactionContainment. [9/11/09 10:26:06:762 CEST] 00000030 LocalTranCoor W WLTC0033W: Resource Test Datasource rolled back in cleanup of LocalTransactionContainment. We also recieved the statement for one of our client running on Websphere 6.1 server. The solution was to change the data source settings. (GO TO Resources -> JDBC in Admin Console) Client had the Data Source settings under the option "Resources -> JDBC -> Data Sources (WebSphere Application Server V4)". This section specifies the data source to support older versions of EJB (i believe EJB 1.1) and Servlet (I think 1.1 and earlier). There may me other compatibility issues, please check the WebSphere site for details. For any other later specifications Data Source should be speci...

Soap request from JavaFX

I was searching on net to know how to send soap request from JavaFX. I could not get a straight answer. While looking at the JavaFX 1.0 API, I did find java.io.http.HttpRequest class to send HTTP asynchronous requests. The document says that you can invoke RESTful weservices through the class. Since HTTPRequest supports POST as a method for sending the request, I though of sending the SOAP message over HTTP. I wrote a simple utility class to facilitate the same and it did help me achieve my goal. The example is a simple class keping in mind that usually soap request are known through WSDL but we do mistakes while preparing a complete XML soap message. I would like to share some of the points for anyone trying the same. 1. Create a simple SoapRequest class as follows: public class SoapRequest extends HttpRequest{ 2. Define the variables to create xml tags, Soap envelop and body tags // xml header  var XML_HEADER:String = "";  // namespace for SOAP 1.1 message, this...