|
You are wise to be worried about memory issues. It is stuff that are stored for long periods of time in memory that consume resources on the server.
Let's do some calculations on how much memory this will use.
Say that the array structure will contain 9 references that are each 16 bytes. Then add the text data, let's say 30 characters times 9. That adds up to 414 bytes.
This should be multiplied with the number of session objects held in memory. If the session timeout is 20 minutes (standard setting), the number of session objects is at least the number of visitors you have during a 20 minute period. If you have say 100 session objects, the extra memory load will be 41400 bytes.
Not really much data, but you should be careful never the less. If the number of users or the data size for each users increases, the memory load can grow quite a lot. Also, the server will be more sensetive to DoS attacks, as each request to the server can create a new session object, using up some memory every time.
---
b { font-weight: normal; }
|
|
|
|
|
Why are you wanting to do this anyways?
|
|
|
|
|
Dear group,
I am using the IHTMLCurrentStyle class (Visual C++) from the IE's API to get the colour of elements on webpages. I am using the method: HRESULT IHTMLCurrentStyle::get_color(VARIANT *p);
It works perfectly fine. As you might know i would need to do hexadecimal to RGB conversion. but the problem is that people sometimes encode colour as names instead of hexadecimal representation (red instead of #ff0000).
This makes life harder for me because i will need to convert colours from actual names to hexadecimal representations then to RGB format
Does anyone know any method which directly extracts colours in RGB formats ? or at least have any idea on how to perform this efficiently ?
Any ideas are welcomed
llp00na
|
|
|
|
|
Do the names match up with names in the Color class ? Or are you not using ASP.NET ? In that case, a Dictionary of names to colors might be needed.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am not using ASP.NET,
Do you guys know how to convert from hex format to RGB format??? normal cases such as #ffffff would be easy, but some designer use formats like #fff !!!
any algorithms to sort out this problem ?
cheers
llp00na
|
|
|
|
|
llp00na wrote:
I am not using ASP.NET,
Wow - then you're in hell....
llp00na wrote:
Do you guys know how to convert from hex format to RGB format??? normal cases such as #ffffff would be easy, but some designer use formats like #fff !!!
#fff == #000fff.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
#fff == #000fff
That is not correct.
The code #fff represents the same color as #ffffff.
Each digit in a three digit color code is a value for each of the red, green and blue components. Each four bit value (0-f) is multiplied by the hexadecimal number 11 to create an eight bit (00-ff) value.
In the code #abc, a is the red component, b is the green component and c is the blue component.
a times 11 is aa, b times 11 is bb, c times 11 is cc, so the full 24 bit color code represented by #abc is #aabbcc.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote:
The code #fff represents the same color as #ffffff.
Really ? That is ridiculous.
Guffa wrote:
Each digit in a three digit color code is a value for each of the red, green and blue components.
Yeah, I know that.
Guffa wrote:
Each four bit value (0-f) is multiplied by the hexadecimal number 11 to create an eight bit (00-ff) value.
OK - that's the most counter intuitive thing I've ever heard.
Guffa wrote:
In the code #abc, a is the red component, b is the green component and c is the blue component.
Yeah, I know. But a Windows bitmap is BGR. I know all this.
Guffa wrote:
a times 11 is aa, b times 11 is bb, c times 11 is cc, so the full 24 bit color code represented by #abc is #aabbcc.
Well, I apologise, I had no idea that this sort of crap was going on. That is without a doubt, the dumbest thing ever. I assumed that #fff would be a shorthand, not some magically multiplied value for the subset of RGB triples where each value is a fact of 11.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
Really ? That is ridiculous.
Really? Why do you think that?
Christian Graus wrote:
Yeah, I know that.
Why did you write that #fff was the same as #000fff then? That would make one of the digits in the tree digit code being the lower four bits of the green component, and the other two digits being the blue component. That would really be ridiculous.
Christian Graus wrote:
OK - that's the most counter intuitive thing I've ever heard.
Ok, if you created a three digit color code, how would you distribute the values across the color space?
Christian Graus wrote:
Yeah, I know. But a Windows bitmap is BGR. I know all this.
What does a windows bitmap have anything at all to do with this?
Christian Graus wrote:
Well, I apologise, I had no idea that this sort of crap was going on. That is without a doubt, the dumbest thing ever. I assumed that #fff would be a shorthand, not some magically multiplied value for the subset of RGB triples where each value is a fact of 11.
It is a shorthand. If you take some time to think about it, it's not as magical at all. It's very simple. In fact, the three digit color codes is much simpler to understand than the six digit color codes. I have yet to meet someone that understands the six digit color code that couldn't grasp the three digit color code. Given that they even try, of course.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote:
Why do you think that?
Because it's not remotely logical and intuitive.
Guffa wrote:
Why did you write that #fff was the same as #000fff then?
Because I assumed that the value was just being passed as it stands. That would be logical. 5 is the same a 005 is the same as 000005.
Guffa wrote:
Ok, if you created a three digit color code, how would you distribute the values across the color space?
If I was able to specify the three bytes of a colour and I did it in hex, I'd assume that FFF equalled FFF. I would not assume that extra values would fly out of the air.
Guffa wrote:
What does a windows bitmap have anything at all to do with this?
Just that you're lecturing me about how colours are specified in windows, and the odds are small that you know more about it than me overall, even though it seems that you're right in this case ( at least I assume you are ), and the way you specify colours in HTML is completely at odds with what seems logical to anyone who writes code, or reads numbers in general.
Guffa wrote:
It is a shorthand. If you take some time to think about it, it's not as magical at all. It's very simple.
It may well be simple, and obvious to those who understand it. However, it is not *intuitive*.
Guffa wrote:
In fact, the three digit color codes is much simpler to understand than the six digit color codes.
ROTFL - how ? It's equally simple, assuming that you want to use only colours that factor to 11, and you understand how they work.
Guffa wrote:
I have yet to meet someone that understands the six digit color code that couldn't grasp the three digit color code. Given that they even try, of course.
You are being obtuse. Obviously, I immediately grasped what you were saying about how they work. I have also apologised for giving wrong advice, on the basis that I assumed that colour codes would work the same as every number system in the known world, and certainly any number system used in code.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
Because it's not remotely logical and intuitive.
Perhaps, but it's not less logical and intuitive than the six digit color code.
Christian Graus wrote:
Because I assumed that the value was just being passed as it stands. That would be logical. 5 is the same a 005 is the same as 000005.
That would be true if the color code would be a single value, but it is a composite of three separate values.
Christian Graus wrote:
Just that you're lecturing me about how colours are specified in windows, and the odds are small that you know more about it than me overall, even though it seems that you're right in this case ( at least I assume you are ), and the way you specify colours in HTML is completely at odds with what seems logical to anyone who writes code, or reads numbers in general.
If you got the impression that I was lecturing you, I apologise. The information was presented in general for anyone that is reading the message board. How the colors are specified in html and css does not really have much to do with how the colors are specified in windows.
If you want a more logical way do define a color, there is: #fff or #ffffff can also be written as: rgb(255,255,255).
Christian Graus wrote:
It's equally simple, assuming that you want to use only colours that factor to 11, and you understand how they work.
No, the three digit code is simpler. You don't really have to understand how hexadecimal numbers work to use it. To use the six digit code, you have to understand how a two digit hexadecimal number translates into a value.
---
b { font-weight: normal; }
|
|
|
|
|
You should also point out that the three digit version (ie, #fff) is only useful if the digits are the same. You cannot specify #f36523 in three digit notation which makes it a very small convenience mostly.
And Christian is correct in assuming that 0xfff = 0x000fff as it does mathematically speaking. The short usage in web colors is a very weird way to use three hex digits.
And yes you do sound as if you are lecturing him.
$0.02
|
|
|
|
|
fakefur wrote:
You should also point out that the three digit version (ie, #fff) is only useful if the digits are the same. You cannot specify #f36523 in three digit notation which makes it a very small convenience mostly.
The 4096 colors that you can specify with the three digit code is sufficient for most cases. The colors #f36523 and #e62 is not possible to distinguish unless you display them right next to each other, and even then you will hardly see the difference. I seldom use colors outside what can be specified with the three digit code. So, in real life the convenience is not that small.
fakefur wrote:
And Christian is correct in assuming that 0xfff = 0x000fff as it does mathematically speaking. The short usage in web colors is a very weird way to use three hex digits.
Again, that would be true if the color code would be a single value. Any mathematical rule only applies in the environment where it is defined. Although the hexadecimal value ead is the same as 000ead, the word "head" is not the same as the word "h000ead".
fakefur wrote:
And yes you do sound as if you are lecturing him.
Yes, maybe it does, and maybe I am. I corrected him as he was offering guidance in a field where he obviously did not have the sufficient knowledge. His answer to this is that the way things work is ridiculous. Maybe he needs a lecture...
---
b { font-weight: normal; }
|
|
|
|
|
I'm looking for an automated way of creating web directories on a per-user basis in IIS 6.0. I know Apache can do it, for instance:
http://www.example.com/~jdoe/
would load the public_html directory of jdoe. This is described more in the Apache Documentation[^].
Is there any way that IIS emulates this behavior?
Thanks,
Adam
-- Adam
"If you can't beat your computer in chess, try kickboxing"
|
|
|
|
|
I'm building a page that displays a potentially very large table. It consists of 'nodes' that can be expanded and collapsed (a tree structure). I'm using an Http request that fetches the appropriate Xml and slots it into the correct position into the Xml Dom on the client. And then I have to render the page again using XSL to display the new structure. There could be up to 5000 lines or more in some cases and re-rendering this every time will be too big a load on the client's CPU. So I’ve written some code that only transforms the fragment of xml that I returned and now I want to slot it into the correct place in the table. I'm having trouble with this though, because it does not seem to recognize the 'processor.output' as Html (or an Html node when I try to do this using the Html Dom). There must be a way of doing this and I think it’s just a matter of syntax. Any suggestions would be greatly appreciated.
A snippet of the code:
<br />
function TransformFragment(node)<br />
{<br />
var objNodeDOM = new ActiveXObject("MSXML2.DomDocument");<br />
objNodeDOM.async = false;<br />
var fragment = "<Fragment> </Fragment>";<br />
objNodeDOM.loadXML(fragment);<br />
<br />
objNodeDOM.firstChild.appendChild(node);<br />
<br />
var xsl = new ActiveXObject("MSXML2.FreeThreadedDomDocument");<br />
xsl.async = false;<br />
xsl.load("StructureFragment.xslt");<br />
<br />
var template = new ActiveXObject("MSXML2.XSLTemplate")<br />
template.stylesheet = xsl<br />
processor = template.createProcessor()<br />
<br />
processor.input = objNodeDOM<br />
processor.transform()<br />
<br />
var objHtmlDOM = new ActiveXObject("MSXML2.DomDocument");<br />
objHtmlDOM.load(processor.output);<br />
<br />
var id = node.getAttribute("ID");<br />
var oTr = document.getElementById(id);<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
}
|
|
|
|
|
Hi all,
In the header i want to display the system date.
What i want now is, i want the date to be displayed in german language.This should be done in javascript.
How can i do this.
can anyone help me in this regard....
Thanks in advance...
|
|
|
|
|
You can check out the toLocaleString method of the Date object.
Otherwise you have to use the methods of the Date object to get the portions of the date and assemble the format by hand.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
In my Web application, I use Word 2003 automation to convert .doc files to .html files.
The problem is, this conversion only runs once. It appears to run correctly: Word starts, converts and closes. The second time it runs, an error occurs (0x800a1066), and the WINWORD.EXE process does not quit. Actually, each failed conversion starts a new WINWORD.EXE process. Only a reboot can clean up this mess, just killing the processes is not enough.
I tried changing the visibility to true, then to false, to no effect. I tried providing the calls with explicit parameters (in stead of 'missing'), that also did not work. I also tried explicitly releasing the COM objects (as suggested in a Microsoft KB article), but you can guess what happened..
When I copy the exact piece of code to a stand-alone console application (that quits when it's done), then start this application in a separate process from my web application, all runs well!! I would never see this as a permanent solution, though, the automation should just work from the web application.
Maybe someone has an idea?
Here's the code:
<br />
private static void save_word_as_html(string word_file, string html_file)<br />
{<br />
object objMissing = System.Reflection.Missing.Value;<br />
object FileOpen = (object)word_file;<br />
object FileSave = (object)html_file;<br />
object objSaveFormat = (object)WdSaveFormat.wdFormatFilteredHTML;<br />
object objOpenFormat = (object)WdOpenFormat.wdOpenFormatAuto;<br />
object objNoSave = (object)WdSaveOptions.wdDoNotSaveChanges;<br />
object objTrue = (object)true;<br />
object objFalse = (object)false;<br />
<br />
Exception retEx = null;<br />
<br />
Word.Application wordApp = null;<br />
_Document doc = null;<br />
<br />
if (m_app == null)<br />
m_app = new Word.ApplicationClass();<br />
wordApp = m_app;<br />
<br />
Word.Documents docs = wordApp.Documents;<br />
<br />
try <br />
{<br />
wordApp.DisplayAlerts = WdAlertLevel.wdAlertsNone;<br />
wordApp.Visible = false;<br />
<br />
doc = wordApp.Documents.Open(ref FileOpen,ref objFalse,ref<br />
objTrue,ref objFalse,ref objMissing,ref objMissing,ref objFalse,ref<br />
objMissing,ref objMissing,ref objOpenFormat,ref objMissing,ref objFalse,ref <br />
objFalse,ref objMissing,ref objTrue,ref objMissing); <br />
<br />
doc.SaveAs(ref FileSave, ref objSaveFormat,ref objFalse,ref<br />
objMissing,ref objFalse,ref objMissing,ref objFalse,ref objMissing,ref<br />
objMissing,ref objMissing,ref objMissing,ref objMissing,ref objMissing,ref<br />
objMissing, ref objMissing, ref objMissing);<br />
<br />
} <br />
catch (Exception E) <br />
{<br />
retEx = E;<br />
}<br />
<br />
try <br />
{<br />
doc.Close(ref objNoSave,ref objMissing,ref objMissing);<br />
NAR(doc);<br />
docs.Close(ref objNoSave,ref objMissing,ref objMissing);<br />
NAR(docs);<br />
wordApp.Quit(ref objNoSave,ref objMissing,ref objMissing);<br />
NAR(wordApp);<br />
} <br />
catch (Exception) {}<br />
<br />
GC.Collect();<br />
GC.WaitForPendingFinalizers();<br />
<br />
if (retEx != null)<br />
throw retEx;<br />
}<br />
<br />
private static void NAR(object o)<br />
{<br />
try<br />
{<br />
System.Runtime.InteropServices.Marshal.ReleaseComObject(o);<br />
}<br />
catch {}<br />
finally<br />
{<br />
o = null;<br />
}<br />
}<br />
|
|
|
|
|
I want to display the web page in a IE browser control.
How to resize the web page with the control?
Thanks!
|
|
|
|
|
can somebody tell me what is wrong with this javascript i am new to using javascript
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="esignature" method="post" runat="server">
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="91" background="images/design_elements/back.jpg" ID="Table1">
<tr>
<td nowrap width="295" height="91" valign="top">
<OBJECT id="Shockwaveflash1" codeBase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" height="91" width="295" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<PARAM NAME="_cx" VALUE="7805">
<PARAM NAME="_cy" VALUE="2408">
<PARAM NAME="FlashVars" VALUE="">
<PARAM NAME="Movie" VALUE="221inside.swf">
<PARAM NAME="Src" VALUE="221inside.swf">
<PARAM NAME="WMode" VALUE="Window">
<PARAM NAME="Play" VALUE="-1">
<PARAM NAME="Loop" VALUE="-1">
<PARAM NAME="Quality" VALUE="High">
<PARAM NAME="SAlign" VALUE="">
<PARAM NAME="Menu" VALUE="-1">
<PARAM NAME="Base" VALUE="">
<PARAM NAME="AllowScriptAccess" VALUE="always">
<PARAM NAME="Scale" VALUE="ShowAll">
<PARAM NAME="DeviceFont" VALUE="0">
<PARAM NAME="EmbedMovie" VALUE="0">
<PARAM NAME="BGColor" VALUE="FFFFFF">
<PARAM NAME="SWRemote" VALUE="">
<PARAM NAME="MovieData" VALUE="">
<PARAM NAME="SeamlessTabbing" VALUE="1">
<embed src="221inside.swf" quality="high" bgcolor="#FFFFFF" WIDTH="295" HEIGHT="91" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</embed>
</OBJECT>
</td>
<td nowrap background="images/design_elements/topr.gif" width="100%" height="91" valign="top">
<img src="images/MNEClaimsmain.gif" align="right" width="300" height="91"></td>
</tr>
</table>
</div>
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" width="100%" ID="Table2">
<tr>
<td width="100%" height="30" bgcolor="#666666">
<font size="2" color="#ffffff"> Logged In: <%=session("company_name")+ " " + "|" + " " + session("name") + " " + "-" + " " + session("Area")%></font></td>
<% if (session("company_name") = "Mayflower National Life Ins") or (session("Area") = "Management Area") Or (session("Area") = "Administrator Area") Or (session("Area") = "Mayflower National User Area") then%>
<td width="100%" height="30" bgcolor="#666666"><A href="defaultadmin.asp"><font color="#ffffff" size="2">Home</font> </A></td>
<%End If%>
<td width="100%" height="30" bgcolor="#666666"><A href="logout.asp"><font color="#ffffff" size="2">LogOut</font></A> </td>
</tr>
</table>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<input type="submit" name="esignature" size="10" value="E-Signature" onclick='signature()' ID="esignature">
<br>
<INPUT id="prt" style="Z-INDEX: 102; LEFT: 179px; POSITION: absolute; TOP: 475px" value="test1.asp" type="hidden" name="sig">
<br>
<br>
<INPUT id="sig" style="Z-INDEX: 101; LEFT: 179px; POSITION: absolute; TOP: 523px" value="test2.asp" type="hidden" name="prt">
<br>
<input type="submit" name="print" size="10" value="Print" onclick='printpdf()' ID="Submit1">
</form>
<script language="jscript">
function printpdf()
{
//**********************************************************************
//here is my problem "document.esignature.prt" is says not an object
// can somebody tell me how i need to do this
//**********************************************************************
var link=document.esignature.prt;
Window.location=link;
return;
}
function signature()
{
//debugger
alert(document.esignature.sig.value);
//var link = document.esignature.sig.value;
//window.length=link;
return;
}
</script>
</body>
</HTML>
thanks
chad
|
|
|
|
|
You have the form and the button named the same thing, try naming the submit button to something like sigSubmit
|
|
|
|
|
ok changed it to submitsig and it still does not work anyother ideas
chad
|
|
|
|
|
You have one field with the id "prt" and the name "sig", and one field with the id "sig" and the name "prt". I think that the reason for the element not being recognised is that they collide in some way.
---
b { font-weight: normal; }
|
|
|
|
|
ok thanks that was my problem did not even see it
i have one more question
how to i make javascript goto another page
i tryed
window.location="webpage.aspx";
but this does not work what do i need to do to make this work
chad
|
|
|
|
|
Please use periods to end your sentences.
Try again. That is exactly how you do it.
---
b { font-weight: normal; }
|
|
|
|
|