Archive for December 2008

nullpx image issue in Jasper HTML report

report

I was creating a HTML Jasper Report. It was working fine, but I saw many failed images. When I see the source, I found many image tags like the following.

<img alt="" src="nullpx" style="width: 20px; height: 24px;"/>

When I googled, I found an image property need to be set to give the proper image name.

JRExporter exporter = new JRHtmlExporter();
...
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER,printWriter);
...
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,"image?image=");
....
exporter.exportReport();

I need to search whether we can avoid it. anyway this is a temporary solution. I created a servlet to create transparent empty GIF and called it over here.

Filename in response

folder

I was writing a servlet whose response is PDF, CSV, XLS etc. This works fine, but when I tried to save it HDD the url is given as the filename. I was wondering how to explicitly specify the filename. Here is the solution.

response.setHeader("Content-Disposition", "inline; filename=xyz.pdf" );

When we set this header property in the response, The filename will be xyz.pdf. Nice na!

First page in PHP

PHP logo

I am thinking about this for long time. I am not able to write a single page in php. Today I did it. Just to share it with you :)

<?php
//title
$title = 'PHP Test';
?>
<html>
<head>
<title><?php echo "$title";?></title>
</head>
<body>
<?php
//create an array
$myArray = array('this', 'is', 'a', 'PHP', 'Test');
for ($i=0; $i<5; $i++)
{
echo "$myArray[$i]";
echo '<br>';
}
?>
</body>
</html>

Prints the following in the browser

this
is
a
PHP
Test

Nice! need to see the data types and database connectivity!

Live internet radio stream extractor

radio.jpg

Friends,

This is to give you a code pack I wrote today. I was listening to one of the internet radios in Tamil. I want to store it on my hdd, the tools I searched dint helped me much. I want a simple tool, that saves my time. And It should be able to work in my absence. I wrote couple of classes, which I am going to test it now.

Why dont you test it youself :)
It doesnt require any installation. you need only three files.

mp3_stream_extractor.jar, The execution binary,
RUN.CMD, the invoking script
radio.properties, where you configure the radios

run the run.cmd, The audio is extracted to your home folder automatically.

Enjoy.

Download MP3 stream extractor

radio properties