|
Hello!
I got a page where a user can view meeting attendance / per year
The user can select to view multiple years at the time, etc 2006,2007
The problem is that the calculation for total attendance % is wrong if any of the meetings has 0 attendance on the meeting.
heres the code that displays the information.
dim lastmonth, currentmonth, samemonth, ackumulated_sum_dict, att_percent, tempPercent, ackumulated_mem_dict, tempMems
currentmonth = ""
lastmonth = "test"
samemonth = false
for each mon in monthArray
currentmonth = mon
if(currentmonth = lastmonth) then
samemonth = true
else
samemonth = false
end if
%>
<%=meetingsArray.Item(mon)%> <%
dim meetArray, meet_date, meet_id
for each yearItem in yearArray
meetArray = getMeetRS(samemonth, yearItem, mon, instID)
if not ubound(meetArray) < 1 then
meet_date = meetArray(0,0)
meet_id = meetArray(1,0)
%>
<%=meet_date%> <%
attendees = getAttendeesAtMeeting( meet_id , instId)
tempMems = ackumulated_mem_dict.Item(yearItem)
ackumulated_mem_dict.Item(yearItem) = tempMems + attendees
Response.Write attendees
%>
<%
memInInst = getNumOfMembers(instId,meet_date)
Response.Write memInInst
%>
<%
att_percent = (attendees / memInInst) * 100
tempPercent = ackumulated_sum_dict(yearItem)
tempPercent = tempPercent + att_percent
ackumulated_sum_dict.Item(yearItem)=tempPercent
%>
<%= round(att_percent,2)%> <%
else
%>
<%
end if
next
%>
<%
lastmonth = currentmonth
next
%>
Totalt <%
for each yearItem in yearArray
%>
<%=ackumulated_mem_dict(yearItem)%> <%=round(ackumulated_sum_dict(yearItem)/ (ubound(monthArray)+1),2) %>
<%
next
%>
<%
anyone got any ideas how to fix the calculations on this ?
thx!
|
|
|
|
|
Wrong in what way? What result do you get, and what did you expect?
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
The problem is here
<%=round(ackumulated_sum_dict(yearItem)/ (ubound(monthArray)+1),2) %>what it does is for example :
100 / 15
where 15 is the total meetings and 100 is the total attendings
even if any of th meetings has 0 attendings it takes that meeting into the calculation .. i dont want that to happen.
|
|
|
|
|
Hi All
I need to know how i can to have the all id controls (HTML Controls) in the Page by using javascript
how can help me
thanks for any body help me
Thaer
|
|
|
|
|
The following code will produce an array (ids) containing the IDs for every control on the page that has an id:
function m(a, f)
{
var ret = [];
for (var i=0; i<a.length; ++i)
{
var val = f(a[i]);
if ( val != null )
ret.push(val);
}
return ret;
}
var els = document.getElementsByTagName("*");
var ids = m(els, function(el) { return el.id?el.id:null; });
every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- C hris L osinger, Online Poker Players?
|
|
|
|
|
Thanks Mr Shog9
but idon't konw the variabel el what it is doing
pleas give the work for it
thanks mr
Thaer
Thaer
|
|
|
|
|
same code, commented:
function m(a, f)
{
var ret = [];
for (var i=0; i<a.length; ++i)
{
var val = f(a[i]);
if ( val != null )
ret.push(val);
}
return ret;
}
var els = document.getElementsByTagName("*");
var ids = m(els, function(el)
{
return el.id?el.id:null;
});
every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- C hris L osinger, Online Poker Players?
|
|
|
|
|
iam very thnks mr Shog9
but your code is note work as my need
the code
var els = document.getElementsByTagName("*");
is return the object
i do the follwing
alert(els)// the retuern of this alert is object
and then replace it with
alert(els.id)//this convert return undefind value what is the problem with this
and then
when calling the function m(a,f)
id do this code
function m(a, f)
{
var ret = [];
alert(a.length)//its return the wrong number of element in my page
for (var i=0; i<a.length; ++i)
="" {
="" var="" val="f(a[i]);
" alert(a[i])="" this="" alert="" return="" undefind="" what="" is="" nr="" shong
="" if="" (="" !="null" )
="" ret.push(val);
="" }
="" ret;
}
and="" the="" code=""
var="" ids="m(els," function(el)=""
="" {=""
alert(el);="" itis=""
="" id="" it="" exists,="" otherwise="" null="" to="" exclude="" element.
="" el.id?el.id:null;
="" });
mr="" shon="" pls="" you="" have="" any="" as="" sampel="" and="" can="" give="" me=""
pls="" send=""
thnks="" your="" hellp=""
<div="" class="ForumSig">Thaer
|
|
|
|
|
Thaer Hamael wrote: i do the follwing
alert(els)// the retuern of this alert is object
and then replace it with
alert(els.id)//this convert return undefind value what is the problem with this
els is an array of elements. Some - but not all - of those elements have id attributes. The array itself is not an element, nor does it have an id attribute.
Thaer Hamael wrote: alert(a.length)//its return the wrong number of element in my page
That's a bold assertion. Do you have an example that demonstrates this? If so, you should send it on to the company responsible for the browser you're testing in, as you've likely found a bug with their implementation of getElementsByTagName() .
Thaer Hamael wrote: alert(a[i])//this alert return undefind
Again, do you have a concrete example of this?
Thaer Hamael wrote: Mr Shon pls if you have any code as sampel and if you can give me it
I did. I've posted it twice now. If it doesn't work for you, then you need to come up with a reason why.
every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- C hris L osinger, Online Poker Players?
|
|
|
|
|
Hi,
I'm using AJAX.
I have a textbox and a button inside an updatepanel.
I have textboxtext changed event for the textbox and a click event for the button.
When I input a text inside the textbox without removing the cursor inside it
then click the button, and perform debug, only the textchange event gets executed,
while it doesn't execute code inside click event.
Please help. I can't simply force call click event inside textchange event of my textbox.
Thank you.
Gerri
|
|
|
|
|
CandyMe wrote: I'm using AJAX.
You're using ASP.NET AJAX - so you might get better answers by posting in the ASP.NET forum (no guarantees though...)
CandyMe wrote: I have a textbox and a button inside an updatepanel.
The focus change (and thus, the textchange event) happens before the click, so that's what you'll get first. You might want to re-think your strategy a bit - why would you need a text change event when there's a perfectly good button to let you know when the user's done?
every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- C hris L osinger, Online Poker Players?
|
|
|
|
|
It's because I have a customvalidation. I would like to prompt the user of invalid input without having to click the button yet. I have other controls in the form as well.
Thank you.
Gerri
|
|
|
|
|
I have Password and Re-type Password fields.
If the user inputs a password that is less than 6 characters, the user is prompted with a RegExValidator "Minimum of 6 characters."
And if the user inputs a password in Re-Type password that DOESN'T MATCH WITH INVALID PASSWORD, the user is prompted with a CompareValidator "Passwords don't match."
Can I disable the "Passwords don't match" comparevalidator and only prompt it if the user has already ENTERED A VALID PASSWORD in Password field?
Thank you.
-- modified at 9:45 Thursday 25th October, 2007
Gerri
|
|
|
|
|
I'm not sure what is wrong with your current setup. If the user inputs different values in the 2 password input boxes, surely it is correct to notify them that the passwords don't match? This logic still applies if the user enters an invalid password in the first box and a valid password in the second box. The passwords don't match, so it is OK to flag this up.
Paul Marfleet
|
|
|
|
|
|
Hi .,
I have webservices method which takes parameter byte[]
this byte[] parameter is compressed Dataset at client-side ,
Now I am Decompressing this at the server side .
All this Compressing and decompressing is done to shrink the size of
dataset , but now the Server pop's the error memory consumption excedded.
Now, do I have any other way to compress Dataset and sent over Webservices?
I did googled this problem but was enable to sort out the problem.
Thanks
Navneet.H
Develop2Program & Program2Develop
|
|
|
|
|
Navneet Hegde wrote: do I have any other way to compress Dataset
Other than what? You haven't even said what method it is that you have tried.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Hi .,
Yea,
--The client sends the request as --
<br />
<br />
byte[] Dataset2Byte;<br />
Dataset2Byte = CompressDataSet(DSet);<br />
MyService Service = new MyService.Service<br />
Service.UpdateTableData(Dataset2Byte ,tablename)<br />
<br />
public byte[] CompressDataSet(DataSet ds)<br />
{<br />
try<br />
{<br />
BinaryFormatter bnformat = new BinaryFormatter();<br />
using (MemoryStream memstream = new MemoryStream())<br />
{<br />
bnformat.Serialize(memstream, ds);<br />
byte[] bs = memstream.GetBuffer();<br />
<br />
MemoryStream output = new MemoryStream();<br />
GZipStream ZipIt = new GZipStream(output, CompressionMode.Compress, true);<br />
<br />
ZipIt.Write(bs, 0, bs.Length);<br />
ZipIt.Close();<br />
<br />
return output.ToArray();<br />
}<br />
}<br />
catch (ApplicationException ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
return null;<br />
}<br />
<br />
}
--- This is at server side webservice -----
<br />
public bool UpdateTableData(byte[] byteSet, string TableName)<br />
{<br />
}<br />
<br />
private DataSet Decompress(byte[] ds)<br />
{<br />
try<br />
{<br />
MemoryStream input = new MemoryStream();<br />
input.Write(ds, 0, ds.Length);<br />
input.Position = 0;<br />
<br />
GZipStream Unzipit = new GZipStream(input, 0, true);<br />
MemoryStream output = new MemoryStream();<br />
<br />
byte[] bf = new Byte[4096]; { }<br />
int read = 1;<br />
read = Unzipit.Read(bf, 0, bf.Length);<br />
while (read > 0)<br />
{<br />
output.Write(bf, 0, read);<br />
read = Unzipit.Read(bf, 0, bf.Length);<br />
}<br />
Unzipit.Close();<br />
byte[] result = output.ToArray();<br />
<br />
BinaryFormatter bnformat = new BinaryFormatter();<br />
using (MemoryStream mStream = new MemoryStream(result))<br />
{<br />
return (DataSet)bnformat.Deserialize(mStream);<br />
}<br />
<br />
}<br />
catch (Exception ex)<br />
{<br />
throw ex;<br />
}<br />
}
This throws the Error : memory consumption excedded
and on server Application Event Log you read recycled mmemory consumption exceeded 60% (267MB of RAM)
Now if I write this byteset to File it is of size 6MB.
Respect
Navneet.H
Develop2Program & Program2Develop
|
|
|
|
|
Navneet Hegde wrote: byte[] bs = memstream.GetBuffer();
The GetBuffer method gives you the underlying array that the MemoryStream is using, including unused space. Use the ToArray method to create an array that only contains the used data.
Navneet Hegde wrote: MemoryStream input = new MemoryStream();
input.Write(ds, 0, ds.Length);
input.Position = 0;
Just do:
MemoryStream input = new MemoryStream(ds);
Navneet Hegde wrote: GZipStream Unzipit = new GZipStream(input, 0, true);
Have you verified that CompressionMode.Decompress actually has the value 0?
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Hi Guffa.,
The problem for uploading huge dataset is solved for now atleast , I mean for the max dataset table having records 160000 having columns 70.
What I tried is
1) Dataset.RemotingFormat = SerializationFormat.Binary;
2) I used deflateAlgorithm instead of Gzip
Thanks
Navneet.H
Develop2Program & Program2Develop
|
|
|
|
|
in my css file i have specified the style elements for select as :
SELECT
{
font-family: Arial, Helvetica, sans-serif;
color: #000000;
height:100%;
width: 100%;
background-color: #ffffff;
font-size: 12px;
}
but in my web page i want that height should not be set so that i can use the size attribute of select tag. I also cannot change the css either.How can i ovverride it.
thanks in advance
|
|
|
|
|
You can specify a new height in your HTML code:
<br />
<select style="height:auto;" .....<br />
Wout Louwers
|
|
|
|
|
thanks buddy for ur help......it's working fine.....
|
|
|
|
|
I have just started working with Ajax.its very intersting,but i dont have much information about Ajax can any one have good and easy study material if you can send me at abhi.chouksey@gmail.com i am thank full to them
abhishek
-- modified at 1:45 Wednesday 24th October, 2007
|
|
|
|
|
A good book to buy is called AJAX in Action, from Manning, I believe.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it )
|
|
|
|