Best way to initiate a download?

On a PHP-based web site, I want to send users a download package after they have filled out a short form. The site-initiated download should be similar to sites like download.com, which say “your download will begin in a moment.”

A couple of possible approaches I know about, and browser compatibility (based on a quick test):

1) Do a window.open pointing to the new file.

- FireFox 3 blocks this.  
 - IE6 blocks this.  
 - IE7 blocks this.

2) Create an iframe pointing to the new file.

- FireFox 3 seems to think this is OK. (Maybe it's because I already accepted it once?)  
 - IE6 blocks this.  
 - IE7 blocks this.

How can I do this so that at least these three browsers will not object? 

Bonus: is there a method that doesn’t require browser-conditional statements?

(I believe that download.com employs both methods conditionally, but I can’t get either one to work.)

Responses and Clarifications:

Q: "Why not point the current window to the file?"  
A: That might work, but in this particular case, I want to show them some other content while their download starts - for example, "would you like to donate to this project?"

read more

Can a Bash script tell what directory it’s stored in?

How do I get the path of the directory in which a Bash script is located FROM that Bash script?

For instance, let’s say I want to use a Bash script as a launcher for another application. I want to change the working directory to the one where the Bash script is located, so I can operate on the files in that directory, like so:

$ ./application

Can a Bash script tell what directory it’s stored in?

How to get rid of `deprecated conversion from string constant to ‘char*’` warnings in GCC?

So I’m working on an exceedingly large codebase, and recently upgraded to gcc 4.3, which now triggers this warning:

warning: deprecated conversion from string constant to ‘char*’

Obviously, the correct way to fix this is to find every declaration like

char *s = "constant string";

or function call like:

void foo(char *s);
foo("constant string");

and make them const char pointers. However, that would mean touching 564 files, minimum, which is not a task I wish to perform at this point in time. The problem right now is that I’m running with -werror, so I need some way to stifle these warnings. How can I do that?

read more

Can VS be configured to automatically remove blank line(s) after text is cut?

Is there a way (or shortcut) to tell VS 2008 that it cuts a line like this:

Before:

Some Text here  
This gets cut  
Some Code there

After:

Some Text here

Some Code there

What I want:

Some Text here  
Some Code there  

PS: I don’t want to select the whole line or something like this… only the text I want to cut.

Can VS be configured to automatically remove blank line(s) after text is cut?