Heh, no, actually I just x'ed out the actual site (just in case the wife is reading this forum for some random reason).
boohiss
@boohiss
Best posts made by boohiss
Latest posts made by boohiss
-
RE: PHP generating Excel file over SSL
-
RE: PHP generating Excel file over SSL
That's a good idea. I just did it, but I'm not really making any sense of it. Here's the headers (I use Live HTTP Headers Firefox extension):
First, without SSL.
GET /ezr3/test.xls HTTP/1.1
Host: www.xxx.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,/;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,;q=0.7
Keep-Alive: 300
Connection: keep-alive
If-Modified-Since: Tue, 23 Oct 2007 15:40:03 GMT
If-None-Match: "30b506-3600-471e15d3"
HTTP/1.x 304 Not Modified
Date: Tue, 23 Oct 2007 15:41:11 GMT
Server: Apache
Connection: close
Etag: "30b506-3600-471e15d3"
----------------------------------------------------------
And here's with SSL.
GET /ezr3/test.xls HTTP/1.1
Host: www.xxx.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,/;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.x 200 OK
Date: Tue, 23 Oct 2007 15:41:41 GMT
Server: Apache
Pragma: no-cache
Cache-Control: no-cache
Last-Modified: Tue, 23 Oct 2007 15:40:03 GMT
Etag: "30b506-3600-471e15d3"
Accept-Ranges: bytes
Content-Length: 13824
Connection: close
Content-Type: application/x-msexcel
----------------------------------------------------------
I'm going to look at these and experiment a little bit, but does anything obvious jump out?
-
PHP generating Excel file over SSL
I am having a devil of a time trying to figure out how to get this to work in IE. It works fine for Opera and Firefox, but none of my users use those, and it's not feasible to convince them to do so.
Here's the problem:
I have a PHP page which dynamically generates an Excel file for download. When an IE user clicks on the link, they get an error (can't download from cache, can't download from this site, etc). This is a pretty well documented problem with IE, as I've found while scouring Google for answers. Every single forum/blog I've been to has its own recipe of header()'s to use to fix the problem (Pragma-this, Cache-Control-that) but none of them have worked, and I've tried about 50 different combinations at this point. I've tried different content-types, dispositions, cache-controls, pragmas, etc.
The only thing I've done that's gotten it to work is to use http:// (i.e., not using SSL), but this almost entirely defeats the purpose of having an SSL certificate in the first place. I am right out of ideas, and I'm hoping someone here can shed some light. Here's some of the relevant code:
<?php
session_start();
// do some database stuff and write to these strings
$header = "excel headers";
$data = "excel data";
// etc...
// print out the data as an excel file for download
// note that I've changed these up a billion times, but this is my original coding
// that's worked fine for every non-IE browser and/or non-SSL session to date
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=what_ever.xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$header\n$data";
exit();
?>
Please note that I don't have access to any .ini files as far as I know. A browser setting change would probably also work as an acceptable solution, but I've tried a bunch of those with no avail either.
-
RE: MS SQL Query Performance
My experience is that you can almost always avoid a subquery (derived table). It may take an extra join condition or some kung-fu with aggregate functions, but you can almost always do it.
However, if you need to do it: do it. -
RE: ASP.NET tree structure
AJAX might be a little too fancy for what we need. I think you are right on the speed issue: it's not an issue. Very seldom maintainence after initial setup.
The main issue I had (and I guess I should have made this more clear) is the actualy display element--how do we display this type of structure based on the table layout.
What we've come up with since I first posted is working really good: a recursive function that creates a bunch of TreeNodes and adds the top level TreeNodes to the TreeView. This is working fine, albeit with the multiple SQL calls.
The next issue is this: the TreeView renders as a table, which in some cases is fine, it makes semantic sense, but in other cases, it doesn't. For instance: navigation should be an unordered list, not a table. Any ideas? -
ASP.NET tree structure
This board has been so helpful in the past, thanks for all your responses and input. I've got a problem that we've come up with a few solutions for already, but I really don't like any of them. I'm hoping to get some new opinions.
We are migrating to ASP.NET for our content management systems, which are permission based. Our permissions are in tables are have a tree structure, like so:
permission table: permid (id, key), permission_name, permission_file, parent
Where 'parent' is the parent permission (if any). Currently in our legacy ASP system, we select all permissions that don't have parents (top level permissions), display as we loop through those, then select all the children, and recursively display a tree-like set of checkboxes. This works fine, of course, but it can potentially cost a lot of SQL calls. Additionally, in ASP.NET, we are using code-behind pages and are trying to keep all programming logic and layout seperate.
Question, then:
Is there any easy way to display a tree of checkboxes like below, given the table structure I've described above without using code (or minimal code) in the layout and using the minimal amout of SQL calls? Stored procedures are not necessarily out of the question, though preferably we don't want to use one (we haven't thought of a good way to use one anyway).
An example page would then look like:
[] Manage Articles (top level)
-----[] Add Article (child)
-----[] Delete Article (child)
[] Manage Galleries (top level)
-----[] Add Gallery (child)
-----[] Delete gallery (child)
[submit]
Where [] is a checkbox that an administrator can check, click [submit], and give a user the permissions he checked. In our legacy ASP, if they click a child permission, the system will check to make sure the corresponding parent permission(s) is (are) given as well.
Any ideas or comments are appreciated, even if they are alternatives to the framework I've layed out or even if you think we are doing it completely wrong.
-Matt -
RE: Select * is evil, still?
LIMIT is not available on all databases; SQLServer and Sybase understand it, Oracle doesn't. (Oracle has a rownum pseudocolumn that can do the same, though)
Unless LIMIT is new to SQL Server 2005 or something else I'm unaware of, you can't use it on SQL Server. You *can* use "SELECT TOP 50" or "SELECT TOP 10%", which functions like LIMIT in many ways, but it's not the same.
Unless, again like I said, it's new to SQL Server 2005, which would be great.