Categories
Computing Web Development

JavaScript modal windows

I have an application for which I want to get some input from the user and since the UI is already overloaded, I decided to that using a pop-up window. Since I want to make sure the user is entering the information in the pop-up or returns to the application a modal (stays on top) window is one course of action.

This is the code I used in the window that opens the popup window:
<html>
<head>
<title>Parent Window</title>
<script type=”text/javascript”>

var popup = null;
var count = 0;
var pop_name = “offshoot”;
var pu_open = false;

function open_modal()
{
var pop_local = pop_name + count;
popup = window.open(“offshoot.html”, pop_local, “width=640,height=480,status=yes”);
count++;
}

function do_modal()
{
try
{
popup.focus();
}
catch(e)
{

}

}

document.onkeyup=do_modal;
document.onmousedown=do_modal;
document.onmousemove=do_modal;
</script>

</head>
<body>

<a href=”javascript:open_modal()”>Open modal popup</a>

</body>

</html>

As for the popup window:
<html>
<head>
<title>Offshoot window</title>

<script type=”text/javascript”>

</script>

</head>
<body >
<h1>This is modal?</h1>
<textarea cols=”40″ rows=”5″ id=”comment” name=”comment”></textarea>
</body>

</html>

There are two bits to look at:

  • The big idea deals with the popup window retaining the focus with the onblur="self.focus()"
  • Because IE exists, we have to circumvent some silly errors, such as:
    The callee (server [not server application]) is not availableand disappeared;all connections are invalid. The call did not execute.
    One way to avert that is follow this advice and modify the name of the pop-up window – which I do using the count variable.
Share
Categories
Computing

McAfee killed my machine. Now it is safe [McAfee Absolved]

UDPATE:::::::::
It appears that installing Thunderbird 1.0 (replacing Thunderbird 0.9) provided an improvement lightyears better than the issue that I am describing below. VirusScan is hereby completely absolved.
ORIGINAL POSTING:::::::::::::::
I am using a Dell laptop for work and although it is not a fire-breathing implement, it is no slouch. Then again, it was really discouraging to suddenly have to contend with the fact that CPU was running at 100% and the machine hated switching Windows (despite 128 MB video card) when I had Eclipse, Tomcat and gAIM running. Uncool.
The culprit – McAfee Security Center – part of the VirusScan online – which ran at 98% CPU usage. Unacceptable.

I am looking for virus protection from a different source. Thanks, but no thanks.

Share
Categories
Computing Java Web Development

Setting up jEdit for remote development using SSH and sFTP

I am taking a class about XML and XSLTat the Harvard Extenion.
We are supposed to essentially remotely log into the system through SSH and use emacs or any other editor of our liking for the development of our projects and solutions.

I am totally down with emacs but the fact that it does not have XSlide or any other context-sensitive helper functionality enabled on the server is disappointing. So I tried NetBeans, Eclipse and finally jEdit as alternatives with the following requirements:

1. Must be able to save and read file remotely using sFTP (FTP is not enabled on the server).
2. Must be useful with XML.
3. If possible, also allow to log in to the system using an internal SSH client.
4. Anything I use must be free and legal.

NetBeans is supposedly very good with XSLT. I did not get that far because it does not have internal sFTP or SSH.

Eclipse has a really cool sFTP plugin that allows you to synchronize to a remote folder using the ‘Team’ functionality. But its XSLT support is way limited and the free version of XML Buddy does not support it. It also can only SSH when it involves CVS. I could not find anything to decouple the two… probably need to write one myself.

jEdit, my favorite left-field option and definitely not as chi-chi as the other two, had all three.
It has so-so XSLT support.
It has internal sFTP support that virtually mounts the remote file system into jEdit’s own file manager. Very cool.
Finally, it has an available (surprisingly not through its plugin manager) SSH client that you need to download and install into the $home/.jedit/jars folder. If you do follow this advice, note that when you connect, the window that should pop up to request your user name and password does not really pop up but pops under so just notice any new windows appearing.

jEdit wins.

Share
Share