|
I have a php page that is leaking pretty bad. I'm not sure if this belongs in this forum or the php one but I don't think it's the php that giving me problems. I've tried to use tools like drip and sieve to help narrow the problem down, but I'm not exactly sure how to fix it. I've tried nulling and deleting variables to clean stuff up but it's still not helping. Can someone give me a hand at cleaning my code up? I'm fairly new at the mem leak stuff. Thanks.
Sorry for the large amount of code.
<?php
include_once $_SERVER["DOCUMENT_ROOT"] . "/include/header.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/include/dbfunctions.php";
header("Cache-Control: no-cache");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="3600">
<html xmlns:"http://www.w3.org/1999/xhtml">
<head>
<? include_once $_SERVER["DOCUMENT_ROOT"] . "/include/scripts.php"; ?>
<script type="text/javascript" src="/scripts/sortabletables.js"></script>
<script type="text/javascript" src="/scripts/reverse.js"></script>
<script type="text/javascript">
var updateTopObj;
var day = $.getUrlParameter("day");
var page = $.getUrlParameter("page");
$(document).ready(function(){
updateTopObj = new UpdatablePage({
updateFunction: updateTop,
interval: 4000,
dataType: "xml",
url: "/resources/Events.xml"
});
updateTopObj.update();
updateTopObj.start();
$('#EventsTable').styleTable({});
$('.table-sortable').click(function(){
$('tr','#EventsTable').removeClass("odd").removeClass("even");
$('#EventsTable').styleTable({});
parent.OMC.pause(frameId);
});
});
function updateTop(xml){
var $xml = $(xml);
var $root = $('eventsInfoTable', $xml);
var $numDays = $('eventRec', $root).length;
var $dayMenuTable = $('#DayMenuTable');
var $dayMenuBody = $('tbody',$dayMenuTable).empty();
var $newDayRow = $('<tr></tr>').appendTo($dayMenuBody);
var $date_xml = $('date',$root);
var $index_xml = $('dayIndex', $root);
var $pages_xml = $('numPages', $root);
var $records_xml = $('numRecords', $root);
var date_arr = [];
var index_arr = [];
var page_arr = [];
var records_arr = [];
$('eventRec',$root).each(function(i){
$date_xml = $('date',this).text().substring(0,5);
date_arr[i] = $date_xml;
$index_xml = $('dayIndex',this).text();
index_arr[i] = $index_xml;
$page_xml = $('numPages',this).text();
page_arr[i] = $page_xml;
$records_xml = $('numRecords',this).text();
records_arr[i] = $records_xml;
});
for(i=0; i<date_arr.length; i++){
if(date_arr[i] != "00/00"){
$dayParam = index_arr[i];
}
}
if(!day){ day = $dayParam;}
for(i=date_arr.length-1; i>=0; i--){
if(date_arr[i] != "00/00") {
$topPageNum = parseInt(page_arr[i])-1;
if(index_arr[i] == day){
if(!page){page = page_arr[i]-1;}
$cell = $('<td width=45><a href="/webpage/events.php?day=' + index_arr[i] + '&page=' + $topPageNum + '" class="submenuSelected" onclick="parent.OMC.play(frameId);">' + date_arr[i] + '</a></td>').appendTo($newDayRow);
$('#dayTitle').empty().append(date_arr[i]+' Events Log');
} else $cell = $('<td width=45><a href="/webpage/events.php?day=' + index_arr[i] + '&page=' + $topPageNum + '" class="submenuNormal" onclick="parent.OMC.play(frameId);">' + date_arr[i] + '</a></td>').appendTo($newDayRow);
}
}
$cell = $('<td><form action="CSV.php" target="_blank" method="GET"><input type="submit" class="genCSVLink" value="View Weekly CSV"/></form></td>').appendTo($newDayRow);
var $pageMenuTable = $('#PageMenuTable');
var $pageMenuBody = $('tbody',$pageMenuTable).empty();
var $newPageRow = $('<tr></tr>').appendTo($pageMenuBody);
for(i=date_arr.length-1; i>=0; i--){
if(index_arr[i] == day){
$totalPages = parseInt(page_arr[i]);
$pageInc = 20;
$totalInc = parseInt(($totalPages-1)/$pageInc)+1;
$currentPage = parseInt(page)+1;
$currentInc = parseInt(($currentPage-1)/$pageInc) + 1;
if($currentInc != 1){
$prevPage = ($currentInc-1)*$pageInc-1;
$cell = $('<td width=20><a href="/webpage/events.php?day=' + index_arr[i] + '&page=' + $prevPage + '" class="submenuNormal" onclick="parent.OMC.play(frameId);">Prev</a></td>').appendTo($newPageRow);
}
for(j=0; j<=page_arr[i]-1; j++){
$pageNum = parseInt(j)+1;
if(($pageNum >= ($currentInc*$pageInc)-$pageInc+1) && ($pageNum <= ($currentInc*$pageInc))){
if($pageNum == $currentPage){
$cell = $('<td width=20><a href="/webpage/events.php?day=' + index_arr[i] + '&page=' + j + '" class="submenuSelected" onclick="parent.OMC.play(frameId);">' + $pageNum + '</a></td>').appendTo($newPageRow);
} else{
$cell = $('<td width=20><a href="/webpage/events.php?day=' + index_arr[i] + '&page=' + j + '" class="submenuNormal" onclick="parent.OMC.play(frameId);">' + $pageNum + '</a></td>').appendTo($newPageRow);
}
}
}
if($currentInc != $totalInc){
$nextPage = ($currentInc*$pageInc);
$cell = $('<td width=20><a href="/webpage/events.php?day=' + index_arr[i] + '&page=' + $nextPage + '" class="submenuNormal" onclick="parent.OMC.play(frameId);">Next</a></td>').appendTo($newPageRow);
}
if($currentPage == $totalPages){
if(records_arr[i] == 0){
var $startRecord = 0;
var $endRecord = 0;
} else{
var $startRecord = ($currentPage-1)*100+1;
var $endRecord = records_arr[i];
}
} else if($totalPages == 0){
var $startRecord = 0;
var $endRecord = 0;
}
else{
var $startRecord = ($currentPage-1)*100+1;
var $endRecord = ($currentPage)*100;
}
$('#RecordsMenuTable').empty().append('Displaying records ' + $startRecord + ' to ' + $endRecord + ' of ' + records_arr[i]);
}
}
$.ajax({
type: "GET",
url: "/resources/DAY"+day+"_PG"+page+".xml",
dataType: "xml",
success: function(xml){
var $eventsXml = $(xml);
var $eventsRoot = $('eventsTable', $eventsXml);
var eventsBody = document.getElementById('EventsBody');
var numNewRows = $('eventRec', $eventsRoot).length;
var $currentRows = $('tr', $(eventsBody));
var numRows = $currentRows.length;
$('th', $('#EventsTable')).removeClass("table-sorted-asc").removeClass("table-sorted-desc");
var docFragment = document.createDocumentFragment();
var newTable = false;
if(numNewRows != numRows){
$(eventsBody).empty();
newTable = true;
}
var trElem, tdElem;
$('eventRec', $eventsRoot).reverse();
if(newTable) {
$('eventRec', $eventsRoot).each(function(i){
$record = $(this);
trElem = document.createElement('tr');
docFragment.appendChild(trElem);
$record.children('dateTime').each(function(i) {
tdElem = document.createElement('td');
trElem.appendChild(tdElem);
tdElem.innerHTML = $(this).text();
});
$record.children('type').each(function(i) {
tdElem = document.createElement('td');
trElem.appendChild(tdElem);
tdElem.innerHTML = $(this).text();
});
$record.children('source').each(function(i) {
tdElem = document.createElement('td');
trElem.appendChild(tdElem);
tdElem.innerHTML = $(this).text();
});
$record.children('eventId').each(function(i) {
tdElem = document.createElement('td');
trElem.appendChild(tdElem);
tdElem.innerHTML = $(this).text();
});
$record.children('assAlrm').each(function(i) {
tdElem = document.createElement('td');
trElem.appendChild(tdElem);
tdElem.innerHTML = $(this).text();
});
$record.children('username').each(function(i) {
tdElem = document.createElement('td');
trElem.appendChild(tdElem);
tdElem.innerHTML = $(this).text();
});
$record.children('desc').each(function(i) {
tdElem = document.createElement('td');
trElem.appendChild(tdElem);
var cellText = $(this).text();
$('bullet', $(this)).each(function(i){
tempText = $(this).text();
cellText = cellText.replace($(this).text(),"<br>•"+tempText);
});
tdElem.innerHTML = cellText;
});
eventsBody.appendChild(docFragment);
});
}
if(newTable) {
eventsBody.appendChild(docFragment);
$('#EventsTable').styleTable({header:false, title:false});
} else {}
trElem = null;
delete trElem;
tdElem = null;
delete tdElem;
numNewRows = null;
delete numNewRows;
numRows = null;
delete numRows;
newTable = null;
delete newTable;
cellText = null;
delete cellText;
$eventsRoot = null;
delete $eventsRoot;
$eventsXml = null;
delete $eventsXml;
eventsBody = null;
delete eventsBody;
$record = null;
delete $record;
cellText = null;
delete cellText;
}
});
$xml = null;
delete $xml;
$root = null;
delete $root;
$numDays = null;
delete $numDays;
$dayMenuTable = null;
delete $dayMenuTable;
$dayMenuBody = null;
delete $dayMenuBody;
$newDayRow = null;
delete $newDayRow;
$date_xml = null;
delete $date_xml;
$index_xml = null;
delete $index_xml;
$page_xml = null;
delete $page_xml;
$records_xml = null;
delete records_xml;
date_arr = null;
delete date_arr;
index_arr = null;
delete index_arr;
page_arr = null;
delete page_arr;
records_arr = null;
delete records_arr;
dayParam = null;
delete dayParam;
topPageNum = null;
delete topPageNum;
i = null;
delete i;
$pageMenuTable = null;
delete $pageMenuTable;
$pageMenuBody = null;
delete pageMenuBody;
$newPageRow = null;
delete newPageRow;
$totalPages = null;
delete $totalPages;
$pageInc = null;
delete $pageInc;
$totalInc = null;
delete $totalInc;
$currentPage = null;
delete $currentPage;
$currentInc = null;
delete $currentInc;
$prevPage = null;
delete $prevPage;
j = null;
delete j;
$pageNum = null;
delete $pageNum;
$cell = null;
delete $cell;
$nextPage = null;
delete $nextPage;
$startRecord = null;
delete $startRecord;
$endRecord = null;
delete $endRecord;
}
function cleanup() {
delete updateTopObj;
delete day;
delete page;
}
</script>
<title>Events</title>
</head>
<body onUnload="cleanup();">
<div class="whiteSubmenu"><table id="DayMenuTable" border="0"><tbody></tbody></table> </div>
<div class="tableSpacer"></div>
<div class="whiteSubmenu"><table id="PageMenuTable" border="0"><tbody></tbody></table> </div>
<div id="RecordsMenuTable" border="0"></div>
<hr>
<div id="dayTitle" style="color:#191970;font-size:12pt"></div>
<table id="EventsTable" title="" class="mainView table-autosort">
<thead>
<tr>
<th class="table-autosort table-sortable:default" style="cursor:pointer">Timestamp</th>
<th class="table-autosort table-sortable:default" style="cursor:pointer">Type</th>
<th class="table-sortable:default" style="cursor:pointer">Source</th>
<th class="table-sortable:default" style="cursor:pointer">ID</th>
<th class="table-sortable:default" style="cursor:pointer">Associated Alarm</th>
<th class="table-sortable:default" style="cursor:pointer">Username</th>
<th>Description</th>
</tr>
</thead>
<tbody id="EventsBody">
</tbody>
</table>
</body>
</html>
|
|
|
|
|
Hi,
How to do ffmpeg upload for video file.Thanks in advance
|
|
|
|
|
FFMPEG Tutorial[^] A good place to start.
AFAIK FFMpeg isn't a file uploader, its a video file converter.
|
|
|
|
|
Hi all,
I want to upload large video file using php in less time .it takes too much time upload video file.is there any solution to upload larger file.Thanks In Advance.
modified on Wednesday, October 7, 2009 5:53 AM
|
|
|
|
|
Try sending files to server using FTP.
It is faster than the HTTP transfer
|
|
|
|
|
Hi,
Thanks for ur reply.Give me code if you have it.Thanks in advance
|
|
|
|
|
|
Hi All,
sorry if I have posted it in wrong forum.
I need your guide for the signature pad implementation.
I have to implement a Topaz signature pad in my web application. My doubts & questions are :
1. Where to start ? I have check the site and developers guide. But it don't provide me the proper info.
2. I think we have to save the capture signature in image/xml . But how to capture it ?
Any help would be appreciated.
Regards
|
|
|
|
|
That's Aragon wrote: I have to implement a Topaz signature pad in my web application. My doubts & questions are :
1. Where to start ? I have check the site and developers guide. But it don't provide me the proper info.
I just looked at this site and it offers plenty of software, controls, samples, SDKs etc. What else do you expect to get?
|
|
|
|
|
It's been a nightmare for me. What Aragon fails to realize is that the site, while offering lots of SDKs, etc., pretty much all of them are for Windows Apps. I've had nothing but a nightmare trying to implement it with my web app.
|
|
|
|
|
One more thing. I've managed to get it working, but it's pretty much stripped down to nothing, straight HTML / JavaScript, like something out of 1996. If you are running into issues, shoot me a reply and hopefully I can help out.
|
|
|
|
|
I have just started developing an application with topaz and would like to know what solution you came up with for asp.net web applications. You stated you were using javascript.
|
|
|
|
|
Item1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
I need to validate the checkbox given above... My requirement is only one check box is checked at a time on button submit... If more than one check box is checked i want to show the alert message. i want to validate the checkbox using jquery....
Oopppzz!!!!!!!
|
|
|
|
|
|
onclick, deselect the rest?
javascript:void(document.getElementById('CheckBox1').selected = 'false');
javascript:void(document.getElementById('CheckBox2').selected = 'false');
...
javascript:selectTheClickedBox
Or something along those lines?
Its better to use Radio Buttons though, as this is what they were designed for
-= Reelix =-
|
|
|
|
|
Hello Friends! This is not a development question but I just wanted to know your expert opinion whether this can be viable/interesting site or not. I had this idea for a while to create a website where people can enter a location entry into a map with a disease that they have seen. It is particularly useful for swine flu, where we can find out number of victims, may be the origin, the direction it is spreading geographically and many others. Of course, keeping the privacy of the patient, can this be an interesting site or useful site for general public? Do you think any person will create an entry for others?
|
|
|
|
|
This is probably a lounge post, but....
I don't see where you will get your data from. A small minority of people will ever post their disease there and for flus, how do you know someone had swine flu, just because they say so ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Data is crowd sourced! In this kind of websites, we can just make sure that we plead the crowd (by putting a line of text) that it has to be valid and believe them if they ever put it.
But if they ever put it, this can be a valuable information that can help others. Right?
|
|
|
|
|
I would never trust data that people had entered at random, with no incentive as being accurate, or as representative of the real spread of people who had the disease. You will not get a statistically valid number of people entering data.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
You are right, the data may not be trustworthy. But so is wikipedia, tripadvisor or any other crowd-sourcing websites, right? Even their website disclaimer warns about it. But the data is still useful for many.
modified on Tuesday, October 6, 2009 7:24 PM
|
|
|
|
|
Collecting data like wikipedia, which is a collection of facts, is something that is self correcting. Someone else sees something is wrong, and fixes it. Collecting statistics does not work that way.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I agree. That is the reason I am debating whether to do it or not.
|
|
|
|
|
I'd go with 'no'. I don't see how it would be useful, I am afraid.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
People who need to know this already have access to this sort of information, based on reliable sources from doctors, hospitals and so on. There are also some sites which make this sort of information available to the general public, e.g. Health Map.[^]
A site that was updated by any member of the public as and when they feel like it would not be that reliable. When you looked at the number of cases of a disease in a particular area it would only tell you how many people have posted an entry in that area, not how many cases there actually were. For example, areas in which people have a lower level of income tend to have relatively limited access to computers and the internet, and consequently your site would likely under-represent the incidence of disease in poorer areas.
Also, self-diagnosis is unreliable and so you would have no idea what proportion of the entries posted on your site were accurate or even genuine. If these people have been diagnosed by a doctor then this information will already have been recorded elsewhere by someone who knows what they are doing.
|
|
|
|
|
hello there -
I would like to make the button text or the button background flashing. anyone to help me with some advice for that?
thanks in advance, Laziale
|
|
|
|