April 2015 Posts

Weird HTTP Error, HTTP Request Parameter Not Detected When Using JavaScript canvas.toDataURL and Base64 Ajax Post

I have a simple Java web application that use Ajax image upload using canvas.toDataURL and base64 encoder. Usually it run well, but I have a very weird error that happen intermittently. Somehow my application cannot detect any http request parameters that send by my Ajax requests. After I spend a while researching, it seems that this error only happen when uploading multiple big images.

At first I thought that it was my Java or JavaScript issue, but then I realized that this is an issue on my Application Server, which is Apache Tomcat. Its default value for maximum POST size is 2MB (2097152), and after I resize it, the error went away.

I add “maxPostSize” property on server.xml, to increase maximum POST size that Apache Tomcat can handle. In this example, i increase it into 20MB.

    <Connector connectionTimeout="20000" 
        port="8080" protocol="HTTP/1.1" 
        redirectPort="8443" maxPostSize="20971520"/>

;-)

Google+

Generating an SVN Log File in a HTML Format

Basically, we can see our SVN history from IDE, but today i have a very weird request from one of my user, they want to see our svn logs progress but in HTML format. After sometimes googling, i found a workaround using XSLT to change svn log XML output file into HTML file.

This is how i do it, i run this command from command prompt, dont forget to register svn.exe on your environment.

svn log -v --limit 100 --xml > outfile.xml

it will create an xml file (outfile.xml) which consist of last 100 svn commit logs.

Next is creating an xsl file, style.xsl, which will become our html template file.

<?xml version="1.0" encoding="ISO-8859-1"?>  
<xsl:stylesheet version="2.0"  
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  
<xsl:template match="/">  
<html>  
<body>  
<h2>Versioning Log</h2>  
<table border="1" style="table-layout:fixed;width: 100%;">
	<tr>
		<td width="5%">Rev No.</td>
		<td width="10%">
				Date				
		</td>
		<td width="5%">
					Author
				
		</td>
		<td width="">
					Message
				
		</td>
	</tr>
	<xsl:for-each select="log/logentry">  
		<tr>			
			<td>				
				<pre><xsl:value-of select="@revision"/> </pre>
			</td>			
			<td>
				<pre><xsl:value-of select="substring(date, 0, 11)" /></pre>
			</td>		
			<td>
				<pre>
					<xsl:value-of select="author"/> 
				</pre>
			</td>		
			<td>			
				<pre>
					<xsl:value-of select="msg"/>
				</pre>
			</td>
		</tr>
	</xsl:for-each>  
</table>  
</body>  
</html>  
</xsl:template>  
</xsl:stylesheet>  

Next step is converting outfile.xml into html file, im using saxon library for handling this. I run this command from command prompt, it will create a html file.

java -jar saxon9he.jar -o:version.html outfile.xml style.xsl

The final result is version.html, which looks like this,
svn versioning html

With a little effort, it’s not so hard to automate this task via maven task. ;)

Google+