Tuesday, October 9, 2012

Hide the browser toolbar in jsp

I am so tired with testers raising bugs they get when they click on the browser back button.
So, its better to hide the browser buttons altogether.

Here is the code.

My web.xml has my welcome file to index.jsp, which in turn just redirects the control to my Login.jsp.

web.xml


        /pages/Login.jsp

index.jsp

<%
response.sendRedirect("login.do");
%>

Where login.do is my action mapping.
Now, I change my index.jsp to



This opens my application in a new browser, where the browser toolbar and menubar do not appear...and I get rid of my Back and Forward button bugs. Hmpfffff!!!

Thursday, October 4, 2012

Read and wite a video in java

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class VideoTest {
    public static void main(String args[]) throws IOException {
        File file1 = new File("C:/Users/splashtechie/Pictures/test.mp4");
        FileOutputStream foStream = new FileOutputStream(file1);
        ByteArrayOutputStream oStream = new ByteArrayOutputStream();
        InputStream is2 = new FileInputStream("C:/Users/splashtechie/Videos/test.mp4");
        //InputStream is2 = rs.getBinaryStream(1);
        byte[] bytes = new byte[is2.available()];
        is2.read(bytes);
        oStream.write(bytes);
        System.out.println("writing....");
        oStream.writeTo(foStream);
       
        System.out.println("done!!!");
    }

}

REFACTORING

 What is Refactoring? A software is built initially to serve a purpose, or address a need. But there is always a need for enhancement, fixin...