June 25th, 2010 by Eric
On a recent project, I was submitting a web form to a page, processing the POST variables, then redirecting to the same page. The server is IIS running in a FastCGI environment. I found that the POST data existed within the PHP environment after the redirect. Here is some test code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| <?php
ob_start();
session_start();
if(isset($_GET['redirect'])){
var_dump('<pre>get set',array('post' => $_POST,'get' => $_GET,'request' => $_REQUEST),'</pre><br />');
unset($_POST);
}
if(isset($_POST['sub'])){
var_dump('post set<br />');
session_write_close();
header ("Location: ".$_SERVER['SCRIPT_NAME']."?redirect=1");
exit;
}
else {
var_dump('<pre>get set',array('post' => $_POST,'get' => $_GET,'request' => $_REQUEST),'</pre><br />');
}
ob_flush();
?>
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
<input name="test1" type="text" />
<input name="test2" type="text" />
<input type="submit" value="submit" name="sub" />
</form> |
If you run this on a typical Apache installation, it will behave as expected, POST data being local to the first request. If you run this code on IIS, it will not. I am not sure if this is an IIS or PHP bug. Either way, I now check for a GET variable, redirect. If it exists, I destroy the POST data. This cost me several hours of my life. I hope it helps you more.
Posted in PHP | No Comments »
April 20th, 2010 by Eric
http://news.bbc.co.uk/2/hi/asia-pacific/8627335.stm
From the article.
An Australian publisher has had to pulp and reprint a cookbook after one recipe listed “salt and freshly ground black people” instead of black pepper.
Posted in proofreading | No Comments »
April 8th, 2010 by Eric
I use Emacs a lot for programming. It is a very useful editor, arguably the best. One great feature is the ability to map keys (hot keys). It even maps keys to specific types of files (C, PHP, XML). I recently started using TCL. Emacs’s key binding for DELETE was effectively backspace. It was driving me nuts. I finally found a solution.
http://www-user.tu-chemnitz.de/~uwp/download/.emacs
Here is the excerpt I wanted.
(add-hook 'tcl-mode-hook
'(lambda ()
(define-key tcl-mode-map [ delete ] 'delete-char)))
It took way too much googling to find this. Here were some of my key words: xemacs, tcl-mode, tcl-mode.el, key binding, key mapping, delete, default bahavior, major mode, override
Posted in emacs, text editors | No Comments »
December 11th, 2009 by Eric
Posted in wordpress | No Comments »
December 10th, 2009 by Eric
I recently upgraded my Macbook Pro’s operating system. The upgrade cost was an incredible $29, an order of magnitude cheaper than Microsoft’s latest upgrade. And, it is not just an upgrade, its a full install too. I popped in the DVD, and an hour later, my laptop was running OS X 10.6. I ran the software upgrade tool and everything is fantastic.
One of the reasons I upgraded was the rumors surrounding the necessary disk space needed for the OS was reduced. I gained an additional 10GB by installing the update. Additionally, Mail seems to run much faster.
All in all, it was an easy enjoyable experience to upgrade my Mac. It was very easy and anyone could probably pull it off. Just remember to backup using Time Machine before you run the upgrade.
Posted in Mac | No Comments »