Based on various code snippets that I found on the Internet, here is how to do it:
(Please contact me if you are the original author of the functions)
function getDocHeight(doc) {
var docHt = 0, sh, oh;
if (doc.height) {
docHt = doc.height;
}
else if (doc.body) {
if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
if (sh && oh) docHt = Math.max(sh, oh);
}
return docHt;
}
function fnResizeIframe(sIFrameName) {
var iframeWin = window.frames[sIFrameName];
var iframeEl = window.document.getElementById? window.document.getElementById(sIFrameName): document.all? document.all[sIFrameName]: null;
if ( iframeEl && iframeWin ) {
iframeEl.style.height = "auto";
var docHt = getDocHeight(iframeWin.document);
if (docHt) iframeEl.style.height = docHt + "px";
}
else { //firefox
var docHt = window.document.getElementById(iframeName).contentDocument.height;
window.document.getElementById(iframeName).style.height = docHt + "px";
}
} //end of function getDocHeight(doc)
Programming solutions, source code, solutions to tech problems and other tech related stuff.
Sunday, January 27, 2008
Tuesday, January 22, 2008
Remove Background Image for Login Screen on Windows Terminal Services
1. Open Windows Registry and find 'HKEY_USERS\Default\Control Panel\Desktop'
2. Look for the key 'Wallpaper' and delete the value from it, leaving it blank.
3. You're done. Log-off terminal services and log back in.
2. Look for the key 'Wallpaper' and delete the value from it, leaving it blank.
3. You're done. Log-off terminal services and log back in.
Thursday, January 17, 2008
Converting WAV to GSM an d Vice Versa
Sunday, January 13, 2008
Concatenating PDFs with Ghostscript
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf 1.pdf 2.pdf 3.pdf 4.pdf 5.pdf 6.pdf
Pesky URLEncoder, JSP and UTF-8
Seems like request.getParameter in JSP doesn't like dealing with UTF-8 encoded strings much. Here's what I did to solve it:
Call from Java:
sURL += "?myparam="+URLEncoder.encode(sMyUTF8String, "UTF-8");
Necessary Code in JSP:
<%@ page contentType='text/html; charset=UTF-8' %>
request.setCharacterEncoding("UTF-8");
String sMyParam = new String(request.getParameter("myparam").getBytes("ISO8859_1"),"UTF8");
Call from Java:
sURL += "?myparam="+URLEncoder.encode(sMyUTF8String, "UTF-8");
Necessary Code in JSP:
<%@ page contentType='text/html; charset=UTF-8' %>
request.setCharacterEncoding("UTF-8");
String sMyParam = new String(request.getParameter("myparam").getBytes("ISO8859_1"),"UTF8");
Subscribe to:
Posts (Atom)