Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About aalbetski

  • Rank

Profile Information

  • Location
    New England
  1. I need to create an HttpWebResponse usin multipart/form-data. This is what I have so far: StringBuilder sb = new StringBuilder(); sb.Append("--xyz\r\n"); sb.Append("Content-Disposition: form-data; name=\"PayloadType\"\r\n\r\nX12_270_004010X092A1\r\n"); sb.Append("--xyz\r\n"); sb.Append("Content-Disposition: form-data; name=\"ProcessingMode\"\r\n\r\nRealTime\r\n"); sb.Append("--xyz--"); byte[] Postdata = System.Text.Encoding.Default.GetBytes(sb.ToString()); Response.AddHeader("Content-Type", "multipart/form-data; boundary=xyz"); Response.AddHeader("Content-Length", Postdata.Length.ToString()); Response.AddHeader("Content-Encoding", "multipart/form-data"); Response.OutputStream.Write(Postdata, 0, Postdata.Length); Response.End();It just doesn't seem to work. Is the output stream supposed to be part of the header? When I call this from a client, all parts of the response are output to the page. I'm new to multipart and would appreciate any insights
  2. using SQL Server, you can query multiple databases provided that they are all on the same SQL Server. If multiple SQL servers are involved, you'd need to set them up as linked and then should be able to do the samei.e. select top 1 accountid from database1.dbo.table1unionselect top 1 accountid from database2.dbo.table1
  3. The actual issue here is not table building, but how to determine when to break an iteration at the point where a new row is to be created, or a br or hr or p tag. So breaking this down to its smallest piece, lets output each image node value and then next one then the tag. You'll see that we simply check the position of the node in the iteration and determine if is evenly divided by two, If yes, we output it, if not we output it PLUS something else, in this case a br <xsl:template match="/"> <xsl:for-each select="//image"> <xsl:choose> <xsl:when test="position() mod 2 = 1"> <xsl:value-of select="."/> </xsl:when> <xsl:otherwise> <xsl:value-of select="."/><br/> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template> Tables have special needs (we can't output a tr without closing it properly). So we use the knowledge that what we really want is a way to know when we have to break, in this case it's the fact that the position in the iteration is evenly divided by two (or 3 or whatever you want your column count to be).The fact that we are iterating on the images nodes is irrelevant, we could also say for i = 1 to 6 if it were permitted.So building on the above, we take that knowledge and pass the position to a named template to build the row. <xsl:template match="/"> <table border="1"> <xsl:for-each select="//image"> <xsl:if test="position() mod 2 = 1"> <xsl:call-template name="BuildRow"> <xsl:with-param name="position" select="position()"/> </xsl:call-template> </xsl:if> </xsl:for-each> </table> </xsl:template> <xsl:template name="BuildRow"> <xsl:param name="position" /> <tr> <td><xsl:value-of select="//image[$position]"/></td> <td><xsl:value-of select="//image[$position + 1]"/></td> </tr> </xsl:template> Hope this helps some
  4. aalbetski

    Button Response

    This may get you going. Its a complete aspx page (no code behind) just for this example. You cast the sender as the object you expect and then query its ID. This may open up all kinds of ideas to you <%@ page language="C#" %><script runat="server"> protected void Page_Load(object sender, EventArgs e) { } protected void button_Click(object sender, EventArgs e) { string sButtonId = ((System.Web.UI.WebControls.Button) sender).ID; switch (sButtonId) { case "button1": text1.Text = "button1 was pressed"; break; case "button2": text1.Text = "button2 was pressed"; break; } }</script><html><body><form id="Form1" method="post" runat="server"> <asp:button runat="server" Text="button1" id="button1" OnClick="button_Click" /> <asp:button runat="server" Text="button2" id="button2" OnClick="button_Click"/> <asp:TextBox runat="server" ID="text1" /></form></body></html>
  5. I don't know mySQL syntax, but the function in SQL Server would be this. It sets a bit (SQL Server does not have a Boolean type) to 0 (fasle) or 1 (true) if the name exists and returns the bit. I'm sure that you will have no problem modifying for mySQL create function UserExist(@uname varchar(45))returns bitbegin declare @return bit set @return = 0 --assume false if exists(SELECT username FROM users WHERE username = @uname) begin set @return = 1 end return @returnend
  6. Again, recursion can be usedTry this (Note that the CharToPad is a space, but can be anything you put in there. I used <pre> tags because they maintain whitespace in a browser where I test. <xsl:template match="/"> <pre> <xsl:call-template name="PadRight"> <xsl:with-param name="TextToPad">This Must be length of 50</xsl:with-param> <xsl:with-param name="Length">50</xsl:with-param> <xsl:with-param name="CharToPad"><xsl:text> </xsl:text></xsl:with-param> </xsl:call-template> </pre> </xsl:template> <xsl:template name="PadRight"> <xsl:param name="TextToPad" /> <xsl:param name="Length" /> <xsl:param name="CharToPad"/> <xsl:choose> <xsl:when test="string-length($TextToPad) >= $Length"> <xsl:value-of select="$TextToPad" /> </xsl:when> <xsl:otherwise> <xsl:call-template name="PadRight"> <xsl:with-param name="TextToPad" select="concat($TextToPad,$CharToPad)"/> <xsl:with-param name="Length" select="$Length" /> <xsl:with-param name="CharToPad" select="$CharToPad" /> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template>
  7. Good luck with your XSLT programming journey!This will get you going to find what your'e looking for, It says, look at all the tradeIdentifer nodes and then find the one that has a child node called systemDomainName with a value of 'TID', When found, return the tradeId node value. <xsl:value-of select="//tradeIdentifier[systemDomainName = 'TID']/tradeId"/>
  8. I disagree. With a little imagination and work, you can do what you want. The data is in the XML, therefore we can get it out. I modified your XSLT just enough to total one column. You can do the rest. <!-- riga totali --><xsl:variable name="total_inizio_min" select="sum(//entry[@cat='dovute']/@ini_h) * 60 + sum(//entry[@cat='dovute']/@ini_m)" /><xsl:variable name="total_fine_min" select="sum(//entry[@cat='dovute']/@fine_h) * 60 + sum(//entry[@cat='dovute']/@fine_m)"/><xsl:variable name="total_durata_minuti" select="$total_fine_min - $total_inizio_min"/><xsl:variable name="total_durata_ore" select="format-number($total_durata_minuti div 60,'##.000')"/><tr><td align="center" bgcolor="#FFFFFF"></td><td align="center" bgcolor="#FFFFFF"><img src="cogs.gif" border="0" height="26" width="32"></img></td><td align="center" bgcolor="#EEEEFF"><font size="2"><tt>T O T A L E (in ore)</tt></font></td><td align="center" bgcolor="#BB9966"><font size="2"><tt><xsl:value-of select="$total_durata_ore" /></tt></font></td>
  9. This may work for you, It does not require an intermediate step. It automatically determines the largest number of any one item and builds a corresponding table. It does rely on the MSXML node-set function and it is hard coded for three genres. These could be revised and streamlined if needed, but maybe this can get you started. Sample XML <table> <genre>C</genre> <genre>B</genre> <genre>A</genre> <genre>A</genre> <genre>A</genre> <genre>B</genre> <genre>C</genre> <genre>A</genre> <genre>B</genre> <genre>B</genre> <genre>B</genre> <genre>B</genre> </table> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0"> <xsl:output method="html" /> <xsl:template match="/"> <xsl:variable name="GenreCount"> <top> <count> <xsl:value-of select="count(//genre[text()='A'])" /> </count> <count> <xsl:value-of select="count(//genre[text()='B'])" /> </count> <count> <xsl:value-of select="count(//genre[text()='C'])" /> </count> </top> </xsl:variable> <xsl:variable name="IndexCount"> <xsl:for-each select="msxsl:node-set($GenreCount)//count"> <xsl:sort select="text()" order="descending"/> <xsl:if test="position()=1"> <xsl:value-of select="text()"/> </xsl:if> </xsl:for-each>. </xsl:variable> <table border="1"> <xsl:call-template name="DoRow"> <xsl:with-param name="IndexCount" select="$IndexCount"/> </xsl:call-template> </table> </xsl:template> <xsl:template name="DoRow"> <xsl:param name="IndexCount"/> <xsl:param name="index" select="1"/> <tr> <td><xsl:value-of select="//genre[text()='A'][$index]/text()"/></td> <td><xsl:value-of select="//genre[text()='B'][$index]/text()"/></td> <td><xsl:value-of select="//genre[text()='C'][$index]/text()"/></td> </tr> <xsl:if test="$index < $IndexCount" > <xsl:call-template name="DoRow"> <xsl:with-param name="IndexCount" select="$IndexCount"/> <xsl:with-param name="index" select="$index + 1"/> </xsl:call-template> </xsl:if> </xsl:template> produces:A B C A B C A B - A B - - B - - B -(- added as placeholder, will not appear in output)
  10. There is a way with XSLT 1.0. By using recursion and string functions you can accomplish this. Note, my example uses CDATA to allow for the ampersand in the XML data <xml id="xmlSource"> <top> <text><![CDATA[This&IsMy&Text]]></text> </top> </xml> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0"> <xsl:output method="text" /> <xsl:template match="/"> <xsl:apply-templates select="//text"/> </xsl:template> <xsl:template match="text"> <xsl:call-template name="Replace"> <xsl:with-param name="value" select="text()"/> </xsl:call-template> </xsl:template> <xsl:template name="Replace"> <xsl:param name="value" /> <xsl:variable name="StartString" select="substring-before($value,'&')" /> <xsl:variable name="EndString" select="substring-after($value,'&')" /> <xsl:variable name="NewString"> <xsl:value-of select="concat($StartString,'\T\',$EndString)"/> </xsl:variable> <xsl:choose> <xsl:when test="contains($NewString,'&')"> <xsl:call-template name="Replace"> <xsl:with-param name="value" select="$NewString" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$NewString"/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> returnsThis\T\IsMy\T\Text
  11. The grouping technique will not work with this problem. The key will index the entire tree so it will eliminates items that you would to appear in your second root grouping, try this instead (again, I am only giving you the framework to get the data you want, its up to you to fill in the blanks) <xsl:for-each select="//root"> <xsl:for-each select="persons/person"> <xsl:if test="not(following-sibling::*/name = name)"> <xsl:value-of select="name"/> </xsl:if> </xsl:for-each> </xsl:for-each>
  12. I'm not really sure I understand your desired output. If you are trying to print a list without duplicates, the Muenchian method works fine here. (Google Muenchian for an explanation of how it works or search this forum, its been answered before)If I've misunderstood your problem, please enlighten me by showing what your desired output should look like, the following will produce this: AntBobMark <xml id="xslStyle"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0"> <xsl:key name="PName" match="person" use="name"/> <xsl:output method="html" /> <xsl:template match="/"> <xsl:for-each select="//person[count(. | key('PName',name)[1]) = 1]"> <xsl:sort select="name" order="ascending" /> <xsl:value-of select="name"/> </xsl:for-each> </xsl:template> </xsl:stylesheet> </xml>
  13. found at: http://forums.techguy.org/web-design-devel...lines-wrap.html<style>pre{white-space: -moz-pre-wrap; /* Mozilla, supported since 1999 */white-space: -pre-wrap; /* Opera 4 - 6 */white-space: -o-pre-wrap; /* Opera 7 */white-space: pre-wrap; /* CSS3 - Text module (Candidate Recommendation) http://www.w3.org/TR/css3-text/#white-space */word-wrap: break-word; /* IE 5.5+ */}</style>
  14. aalbetski


    IE has the ability to create a TextRange object and copy and paste using the clipboard. Don't know about the other browsers. You can also set the contentEditable property to true and it does all the work <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html> <body> <div contentEditable="true"> Select a word and drag it around </div> </body></html>
  • Create New...