tgreer 189 Made Her Cry Team Colleague

You want to design an application that mimics a human user, fills out an online form, and processes the resultant HTML? Why? That's a bit of a challenge, and not how most eCommerce applications work. Even the sites like PriceGrabber require that their vendors export their pricing data to them or provide it via Web Services.

If you really want to pursue this idea, you might start by doing a web search on "screen scraper".

tgreer 189 Made Her Cry Team Colleague

I see, you wish to call a Web Service in your windows application written in C#. What is the web service? Give us the WSDL.

tgreer 189 Made Her Cry Team Colleague

A Windows application using C# is not the same as an ASP.NET Web Service. I'd start by making sure I had the right development environment and understood the basic structure of a web service.

tgreer 189 Made Her Cry Team Colleague

I'd use a SQL query. I'd also only use code tags when posting code, and I'd use question marks when asking questions.

tgreer 189 Made Her Cry Team Colleague

Amazon publishes an API. For that example, I'd use the Amazon API in my project.

"Getting information from a web site" is much too general of a question. Web sites are built to be accessed by human users, in most cases, not applications.

There are exceptions, such as RSS feeds and Web Services.

tgreer 189 Made Her Cry Team Colleague

What IDE are you using? If you're using Visual Studio, or one of the Visual Studio Express Web Developer editions, you publish the web service application to a Web Server just as you do a normal ASP.NET web application. Use the "Copy Web Site" wizard from the Website menu.

If you're not using a version of VS, then you need to provide details of your environment.

On a personal note, it's ok if your English isn't "perfect", but please make an effort to use proper pronunciation and to avoid abbreviations.

tgreer 189 Made Her Cry Team Colleague

Use a SQL stored procedure for the data integrity part of your task. Use an OUT parameter to indicate a successful write, or duplicate. Base your program logic on the OUT parameter.

tgreer 189 Made Her Cry Team Colleague

Your question doesn't make sense in the context of a coding question. What, exactly, do you mean by "bottom of the button"? Do you wish to start the timer in response to the "click" event of a particular button? Are you asking a question about the GUI layout of your application?

tgreer 189 Made Her Cry Team Colleague

I don't quite "get" that line either, taken out of context. But I can tell you that everything in C# is an object, it's the most fundamental "type". This is roughly equivalent to the "variant" type in other languages. "Boxing" is similar to casting. Specifically, though, it is a way of treating value types as generic objects. A value type would be, for example, an integer. There are special cases where you might desire to have a value treated as an object, in my experience this has come up a time or two when doing COM Interop in C#.

So I think what's being said is "Delphi Variant types are roughly equivalent to Objects in C#".

tgreer 189 Made Her Cry Team Colleague

I am reading raw html via a stream and need to look for the tags such as, img, object, and applet to check they have any alt attributes. I am using regular expressions.

i was using this regular expression to find images :
"<img.*src\\s*=\\s*(?:\"(?<1>[^\"]*)\"|(?<1\\S+))" but it doesnt work

I understand. Regular Expressions are tough and I always resort to trial and error, and use http://www.regular-expressions.info as a good learning resource. RegEx, however, may not be the best approach in this case. RegEx is used to find and even alter strings. I don't think RegEx will solve the problem of finding tags that are missing attributes.

I would use basic string functions for this, searching for my target tag and then searching for the alt attribute within the tag.

tgreer 189 Made Her Cry Team Colleague

Please don't make your questions such a puzzle. You mention Regular Expressions in the subject, and "parsing HTML" in the post. You need to "get" certain tags. You need help. There is no question per se in your post. Instead of giving us clues pointing vaguely toward a possible question, why not just ask a clear, specific question?

How, exactly, are you "parsing" the HTML? Are you reading the raw HTML via a Stream? Using an HTML DOM object? What does RegEx have to do with this?

tgreer 189 Made Her Cry Team Colleague

Let us know. Remember to mark the thread solved if this answered your question.

tgreer 189 Made Her Cry Team Colleague

I haven't downloaded the attached project. Many users who might have time to answer a question on a forum may not have the time to download someone's project, open it, and attempt to decipher all of their source code.

Asking good questions is in art, I know. If you can't ask a clear question you can't expect a clear answer. I'm a C# coder and have been a print driver, RIP and embedded print engine developer for many years. I can likely help you, but I'm still not sure what you want.

You state you need to print controls as well as graphics. I don't know what that means. Please rephrase your question.

tgreer 189 Made Her Cry Team Colleague

Do your Insert Query, the do a SELECT @@IDENTITY Query immediately afterward. It's best to do both in a stored procedure with the Identity as an OUT parameter.

Try this link: http://www.netomatix.com/adonetauto.aspx

tgreer 189 Made Her Cry Team Colleague

Your question simply isn't specific enough. What are you printing? How? From what application? Visual Studio, I assume. Are you wanting, essentially, a screen shot of your IDE? Or are you coding a print function into your application?

If you don't get an answer to your question, it's best to assume the problem is with the question, rather than assuming a lack of knowledge on the part of the entire community.

tgreer 189 Made Her Cry Team Colleague

Visual Studio.NET for ASP.NET Web Service development auto-generates the WSDL. Can you be more specific?

tgreer 189 Made Her Cry Team Colleague

Pumping Gas: the laws vary state to state. Where I live, there are no full service stations at all.

Back on topic, one thing that irritates me about Daniweb that I haven't seen mentioned already, is that user options from time to time are removed.

Also, the impossible to navigate upside-down and backwards reverse-navigation blog comment sequence.

jbennet commented: why the neg rep. It wasnt offtopic. majestic braught up the whole topic of repping power in #60 -6
tgreer 189 Made Her Cry Team Colleague

I guess you are her friend then. Probably a good thing or otherwise you might get killed ;)

Yeah, yeah, she's every geek-boy's wet dream and hordes of daniweb fanboys are no doubt already launching DOS attacks against my ISP - but I happen to know she can't even pump her own gas.

tgreer 189 Made Her Cry Team Colleague

Dani - that's what pisses me off about Daniweb. Herself, herself. How dare someone be so successful by being so wrong about so many things? How can you successfully argue with anyone who can make you forget everything you were about to say just by smiling at you?

Plus she cheats at bowling.

tgreer 189 Made Her Cry Team Colleague

Don't listen to tgreer. He doesn't post here anymore, anyway.

tgreer 189 Made Her Cry Team Colleague

Namespaces were messing me up. The techniques above work just fine. In order to split the file into several groups, I ended up using this:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:variable name="nodes-to-group" select="ceiling(count(Students/student) div 2)" />

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
  <xsl:for-each-group select="Students/student" group-by="ceiling(position() div $nodes-to-group)">
    <xsl:result-document href="{TEMPFOLDER}{format-number(position(),'000000000')}.xml">
      <Students>
        <xsl:apply-templates select=".|following::student[position() &lt; $nodes-to-group]"/>
      </Students>
    </xsl:result-document>
  </xsl:for-each-group>
</xsl:template>

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>

Use any hard-coded value or calculation to determine group size in the nodes-to-group variable.

tgreer 189 Made Her Cry Team Colleague

Yes, I changed my example. I'm not really dealing with Students and student, but the structure is the same: root node, second-level node with attributes and child nodes. I will thrash around a bit more and let you know. Thanks again for taking a look.

tgreer 189 Made Her Cry Team Colleague

I'm only getting the text nodes, not the element nodes or attributes, and I'm getting the entire file not just the first few students.

tgreer 189 Made Her Cry Team Colleague

Altova.

It's a bit more complex. I need to do a deep copy of a second-level node, but it's the only second level node. Something like this:

<?xml version="1.0" encoding="utf-8"?>
<Students xmlns="myNameSpace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<student>
  <firstname>Thomas</firstname>
  <lastname>Greer</lastname>
</student>
..
..
</Students>

The <student> node is what I want to copy, all attributes, child nodes, and attributes of child nodes. I need to copy a range of them. The "student" node contains child-nodes, and those nodes may have their own children, and so on. Essentially, I'm dividing the XML file into smaller chunks based on the total number student nodes.

I will test your other examples. Thanks.

tgreer 189 Made Her Cry Team Colleague

No, this still copies everything... perhaps my processor doesn't support position().

tgreer 189 Made Her Cry Team Colleague

Hello, this is not a Web Development question, but this is the only XML forum on Daniweb. I need to copy a specific number of nodes in an XSLT transform. For example, I need to copy the first 5 <student> nodes, with all child nodes and attribute nodes, even though the original XML file may contain 100 student nodes. Thanks in advance.

A more general question would be how to copy a specific range of nodes based on their position/index within the original XML file. For example, copy student nodes 50 through 88.

tgreer 189 Made Her Cry Team Colleague

A very clear explanation, Dani. Thank you.

tgreer 189 Made Her Cry Team Colleague

No, you're standing on flawed reasoning. Feedback is not a scientific poll.

Wait a minute, back up the bus. No one claimed that feedback was a scientific poll. I'm saying, the only feedback you have is feedback given. That's all. If you are using feedback to make decisions about the site, scientific or not, then those are your parameters.

You can make no assumptions whatsoever about feedback not given. The vast majority of site users float in and out without perhaps ever noticing a certain aspect of the site. Dani assumes that since they didn't complain, they must be in favor. That's an unwarranted assumption and is not a sound basis for making decisions.

Feedback may not be either, but that's the system in place. So when 6 or so users complain about something, you can't balance that against the 97,000 who don't, assume that's 97,000 in FAVOR, and ignore the 6 who care enough to give feedback because they are the minority. Flawed reasoning.

You take those 6 votes, ask for more feedback, ("Is anyone in FAVOR of the way things are...?) and make a decision on that feedback. While not scientific, it's better than giving "opinions in my favor" to people who've expressed no opinion at all.

Dave Sinkula commented: Good points. +11
tgreer 189 Made Her Cry Team Colleague

Dani, your "no complaints" argument is your standard flawed reasoning. The only feedback that matters is the feedback you've been given. You can make no assumptions about this nebulous "non-feedback / non-complaint" crowd. Hey, George Bush hasn't complained anywhere about Daniweb - he must endorse it!

There is no downside to making these things optional. Those who don't complain and like all the defaults will leave things alone. Those who want to disable certain options, can. Where's the issue?

tgreer 189 Made Her Cry Team Colleague

...but now, by reading the latest feedback on the issue, you realize that the annoyance of the hover previews is unrelated to speed, and that the all-or-nothing option of disabling all client-side JavaScript does not address the issue. Also, removing control over an aspect of the site that was previously optional is in hindsight, perhaps, not wise. I respectfully request, as an interested reader/user of the site, that you make this optional again. It dramatically, negatively, affects the usability and enjoyment of the site.

tgreer 189 Made Her Cry Team Colleague

I don't post anymore... but I do occasionally browse. The floating popups are very annoying, like having tape stuck to your fingers. Please reinstate the option to disable popups.

tgreer 189 Made Her Cry Team Colleague

I'll not respond to any of the criticisms against me, since some of them are actually valid, some are not, and some have nothing to do with the issues, but rather with frivolous "personality" conflicts, which are completely irrelevant. I'll rely on discerning readers to separate the wheat from the chaff, full well realizing that the vast majority of members don't care about any of this anyway.

I'll respond just to TheNNS's question (even though it's written in the 3rd person) because no one else has any business speculating: I left the mod group because of philosophical and ethical issues concerning the use of IntelliTXT and the manner in which it was implemented, as well as the growing trend towards an illiterate, unprofessional membership and a "hands-off" policy regarding quality control (which would only be exacerbated by a gamerz forum - there, I'm on-topic).

Contrary to certain implications, Dani and I remain friends and recognize that this is a point of contention we'll likely continue to debate forever. She is intelligent enough to recognize sarcasm and hyperbole, mature enough to maintain friendships in spite of profound differences of opinions, and continues to trust my opinions on various issues, a trust I value deeply.

iamthwee commented: Yes, just keep the trolling to a minimum and stop begging the mods for infractions? -2
tgreer 189 Made Her Cry Team Colleague

WaltP - then do something about it. You're a moderator, issue me an infraction. I'd welcome any sign that this site hasn't spun out of control, even if the action is directed against me. Name names, take action, do something about the situation. The moderators should stop sitting on their hands.

joshSCH commented: I despise the negative aura you bring to these forums -2
christina>you commented: You love -rep don't you? -4
tgreer 189 Made Her Cry Team Colleague

Absolutely. I've been griping about the deterioration of the quality of Daniweb, so in the spirit of being part of the solution rather than part of the problem, I accept Josh's suggestion for supplying quality control to the forum. For starters, anyone who has posted more than two posts with multiple missing apostrophes should suspend posting directly and instead PM me first.

tgreer 189 Made Her Cry Team Colleague

Or should we ask your permission every time we would like to discuss something?

That is an excellent suggestion. I offer my services as a mentor to the young. Please PM me each time you have an impulse to post on this site and I'll provide coaching and remedial English. As a fee for this professional service, I request 2% of all positive rep points generated in the Geek's Lounge be credited to my account.

People have been attempting to intelligently reason out...

I'm afraid the burden of proof is on you for that one, as the evidence speaks otherwise.

tgreer 189 Made Her Cry Team Colleague

This thread is ridiculous and highlights so much of what is currently wrong with Daniweb. The administrator responded in post number 2, end of story. Barely readable posts written in mangled, unpunctuated pseudo-English arguing for the establishment of a gamer's forum provide their own best counterargument.

Now all we need is christina>you giving me inane negative reputation points and the thread will provide a complete demonstration of the current Daniweb culture.

Ancient Dragon commented: If you want negative rep, I'm glad to oblige -3
christina>you commented: Tisk, tisk. It's pretty pathetic when you drag me into every little post you make. Here's a suggestion: Stop bringing in your negative thoughts into Daniweb. -3
tgreer 189 Made Her Cry Team Colleague

http://www.thumbshots.com/ (or something similar). Just more IntelliTXT camoflauge. Once users are trained to hover over every link in order to get a "thumbshot", then IntelliTXT revenue should see a dramatic jump. Go ahead, tell me again how users "know the difference".

tgreer 189 Made Her Cry Team Colleague

A post just to show my new extremely apropros signature, and to provide c>you et al an opportunity to give me bad rep. How very off-topic of me.

~s.o.s~ commented: Nice signature. +20
Rashakil Fol commented: Thanks for the opportunity ;-) -1
christina>you commented: Thanks for the opportunity! :-D -3
arjunsasidharan commented: :D like your signature +3
tgreer 189 Made Her Cry Team Colleague

I use different colors to indicate different parts of text for comment below.

Use the "quote" bbcode, intended for just this purpose.

tgreer 189 Made Her Cry Team Colleague

Code segments aside, color should not be necessary for clarity or emphasis. A well-constructed and properly punctuated post doesn't need a crutch. If you find yourself needing to add orange 16pt. bold-italic formatting to your post so it will make sense, then you likely need to revise your post.

tgreer 189 Made Her Cry Team Colleague

Posting in the proper forum would go a long way towards getting an answer.

tgreer 189 Made Her Cry Team Colleague

The site does not use Java to round corners. In fact, I don't see the site using Java anywhere at all.

Dani - Nope, I quoted/replied to Josh, and then edited to straighten out jbennet. Kids these days, with their PDAs and infrared keyboards. <sigh> Does that keyboard not have an apostrophe?

tgreer 189 Made Her Cry Team Colleague

disable javascript, it will go faster

Bad advice.

Disabling JavaScript will break a lot of the site's features and usability. I suggested in another thread disabling a specific malfunctioning script to specific users suffering a specific problem. That script has since been fixed by Dani. That advice was never intended to mean you should completely disable all JavaScript (and then complain 'whoa, what's up with stuff not working?').

Also, Java is not JavaScript. If you're going to provide feedback on this issue, try to be accurate.

tgreer 189 Made Her Cry Team Colleague

To get a good reply, start with a good question. What steps have you already taken? Are you familiar with the PDF spec? Are you willing to use a 3rd party library? If so, COM or .NET? What's your budget?

tgreer 189 Made Her Cry Team Colleague

I solved this with a combination of two recursive templates and creative use of the "copy-of" function.

tgreer 189 Made Her Cry Team Colleague

Am I confusing everyone? Or do we not have any XML pros as members? Let me restate as simply but as completely as possible.

Given the following XML input file:

<?xml version="1.0"?>
<document>
<table>
<tbody>
  <tr>1</tr>
  <tr>2</tr>
  <tr>3</tr>
  <tr>4</tr>
  <tr>5</tr>
  <tr>6</tr>
  <tr>7</tr>
  <tr>8</tr>
  <tr>9</tr>
  <tr>10</tr>
  <tr>11</tr>
</tbody>
</table>
</document>

I want to produce the following result file:

<?xml version="1.0"?>
<document>
<table>
<tbody>
  <extra>
    <tr>1</tr>
    <tr>2</tr>
    <tr>3</tr>
  </extra>
  <extra>
    <tr>4</tr>
    <tr>5</tr>
    <tr>6</tr>
  </extra>
  <extra>
     <tr>7</tr>
    <tr>8</tr>
    <tr>9</tr>
  </extra>
  <extra>
    <tr>10</tr>
    <tr>11</tr>
  </extra>
</tbody>
</table>
</document>

So far I have the following XSLT. It's overly complex, it's meant to provide multiple points to insert the necessary logic. It produces:

<?xml version="1.0"?>
<document>
<table>
<tbody>
  <extra>
  <tr>1</tr>
  <tr>2</tr>
  <tr>3</tr>
  <tr>4</tr>
  <tr>5</tr>
  <tr>6</tr>
  <tr>7</tr>
  <tr>8</tr>
  <tr>9</tr>
  <tr>10</tr>
  <tr>11</tr>
  </extra>
</tbody>
</table>
</document>

XSLT Program:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
  <xsl:output method="xml" indent="yes" />

  <xsl:template match="node()|@*">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

 <xsl:template match="tbody">
    <xsl:copy>
      <xsl:apply-templates select="@*" />
     <!-- somehow I need to do this for every THREE "tr" elements -->
      <extra>
        <xsl:call-template name="trGroup" />
      </extra>
     <!--  -->
    </xsl:copy>
 </xsl:template>


<xsl:template name="trGroup">

    <xsl:copy>
      <xsl:apply-templates select="@*" />
      <xsl:apply-templates select="node()"/>
    </xsl:copy>

</xsl:template>


</xsl:stylesheet>
tgreer 189 Made Her Cry Team Colleague

Ok, figured out this much:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes" />
 
  <xsl:template match="node()|@*">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

 <xsl:template match="tr">
<extra>
    <xsl:copy>
      <xsl:apply-templates select="@*" />
      <xsl:apply-templates select="node()"/>
    </xsl:copy>
</extra>
 </xsl:template>

</xsl:stylesheet>

That's a huge step in the right direction, but of course it puts the "extra" tags around every "tr". I want to group every three "tr" elements. Anyone?

tgreer 189 Made Her Cry Team Colleague

If that's a bit too much to tackle, then an explanation of the basic technique to modify a single child element would at least get me started. If I had this for example:

<?xml version="1.0"?>
<sandwich>
  <bread type="rye" />
  <ingredient>Peanut Butter</ingredient>
  <ingredient>Jelly</ingredient>
</sandwich>

And I want to copy it, but wanted to transform the bread element to: <bread>Wheat</bread> , how would I do that?

tgreer 189 Made Her Cry Team Colleague

I'm struggling with XSLT. I need to copy an entire xml file to a new xml file. The input and output should be identical except for the addition of some extra tags around certain elements.

Consider the two versions:

<?xml version="1.0"?>
<document>
<header>
  <general>
    <version>1.14.2</version>
    <form>/XX/ATL_ZI_D007_PURCHASE</form>
    <language>EN</language>
    <device>PRINTER</device>
  </general>
  <archive mode="1" mode-modify-enabled="yes"/>
</header>
<data xml:space="preserve">
  <window name="MAIN_WINDOW" type="main" page="FIRST" page-id="001">
    <table name="DATA" pattern="0001">
    <thead/>
    <tbody>
      <tr ltype="TABLE_POS">
        <tc cell="1" />
      </tr>
    </tbody>
    </table>
  </window>
</data>
</document>
<?xml version="1.0"?>
<document>
<header>
  <general>
    <version>1.14.2</version>
    <form>/XX/ATL_ZI_D007_PURCHASE</form>
    <language>EN</language>
    <device>PRINTER</device>
  </general>
  <archive mode="1" mode-modify-enabled="yes"/>
</header>
<data xml:space="preserve">
  <window name="MAIN_WINDOW" type="main" page="FIRST" page-id="001">
    <table name="DATA" pattern="0001">
    <thead/>
    <tbody>
      <extra>
        <tr ltype="TABLE_POS">
          <tc cell="1" />
        </tr>
      </extra>
    </tbody>
    </table>
  </window>
</data>
</document>

Notice the "extra" tags around the "tr" element. Essentially I want to copy the file, but re-write the "tr" element by surrounding it with additional tags. That's the simplified version.

In actuality, imagine there are multiple "tr" elements, and I wanted the "extra" tags around every group of three:

<table name="DATA" pattern="0001">
    <thead/>
    <tbody>
      <extra>
        <tr ltype="TABLE_POS">
          <tc cell="1" />
        </tr>
        <tr ltype="TABLE_POS">
           <tc cell="1" />
         </tr>
         <tr ltype="TABLE_POS">
           <tc cell="1" />
         </tr>
       </extra>
      <extra>
         <tr ltype="TABLE_POS">
           <tc cell="1" />
         </tr>
         <tr ltype="TABLE_POS">
            <tc cell="1" />
          </tr>
          <tr ltype="TABLE_POS">
            <tc cell="1" />
          </tr>
        </extra>
       <extra>
         <tr ltype="TABLE_POS">
           <tc cell="1" />
         </tr>
         <tr ltype="TABLE_POS">
            <tc cell="1" />
          </tr>
          <tr ltype="TABLE_POS">
            <tc cell="1" />
          </tr>
        </extra>
     </tbody>
    </table>

I appreciate any assistance or references.

tgreer 189 Made Her Cry Team Colleague

The post you quoted was directed at joshSCH, not you. Sorry for the confusion. I'm an enigma, huh? I like that - I think I'll change my user title. My public "rants" are the tip of an enigmatic private iceberg. Swap posts #42 and #43 and it'll make more sense.