Mike Askew 131 Veteran Poster Featured Poster

It is worth noting if you are not running a multi-threaded application the load bar will not update normally as the form will 'freeze' until the whole thread has run, ie. bar will jump from 0% to 100%.

Mike Askew 131 Veteran Poster Featured Poster

Solution:

            XDocument XmlDoc = XDocument.Parse(DS.GetXml());

            // Create a writer for writing the transformed file.
            XmlWriter writer = XmlWriter.Create(@"C:\Users\maskew\Desktop\XmlMapping.xml");

            // Create and load the transform with script execution enabled.
            XslCompiledTransform XSLTTransformer = new XslCompiledTransform();
            XsltSettings settings = new XsltSettings();
            settings.EnableScript = true;
            XSLTTransformer.Load(@"C:\Users\maskew\Desktop\XSLTMapping.xsl", settings, null);

            // Execute the transformation.
            XSLTTransformer.Transform(XmlDoc.CreateReader(), writer);
Mike Askew 131 Veteran Poster Featured Poster

Could you try, a 'contains' condition?

This will allow you to match specific strings within the node.

Not sure how your implementing the condition so cant suggest code until I know that. But contains should do the job :)

Mike Askew 131 Veteran Poster Featured Poster

Hehe im not exactly sure what mine is buT her furr is Stupidly fluffy :)

Mike Askew 131 Veteran Poster Featured Poster

Haha Rev, my cat isnt bad for that to be honest, just leaving fluff everywhere.

Mike Askew 131 Veteran Poster Featured Poster

Ah thats fine then was just double checking, it would still show up when disabled so dont worry about it.

Mike Askew 131 Veteran Poster Featured Poster

I am currently running a live 'in-memory' XSLT transformation using the following code

XmlDocument XmlDoc = new XmlDocument();
            XmlDoc.LoadXml(DS.GetXml());

            XslCompiledTransform XsltTranformation = new XslCompiledTransform();
            XsltTranformation.Load(@"C:\Users\maskew\Desktop\XSLTMapping.xsl");

            Stream XmlStream = new MemoryStream();
            XmlDoc.Save(XmlStream); //Stream is still blank after this line
            XmlReader XmlRdr = XmlReader.Create(XmlStream);

            MemoryStream stm = new MemoryStream();
            XsltTranformation.Transform(XmlRdr, null, stm);
            stm.Position = 1;

            StreamReader sr = new StreamReader(stm);
            string Output = sr.ReadToEnd();
            Output = Output.Substring(2);
            XmlDoc.LoadXml(Output);

            XmlWriter XmlWrtr = XmlWriter.Create(@"C:\Users\maskew\Desktop\XmlMapping.xml");
            XmlDoc.WriteTo(XmlWrtr);
            XmlWrtr.Flush();
            XmlWrtr.Close();

However, when I move the file from XmlDocument to MemoryStream in line 8 the stream contains nothing when checked and thus stopping the whole program from running.

Does anyone have any idea why this would be occuring?

Mike Askew 131 Veteran Poster Featured Poster

Haha, girlfriends seem to leave you, my cat hasn't yet :)

Mike Askew 131 Veteran Poster Featured Poster

Are you using WinForms or does the timer need to be instantiated programatically?

Mike Askew 131 Veteran Poster Featured Poster

I think it would be interesting to see what appeals to most across this forum in terms of desktop wallpapers :)

My current: As im a rediculous cat lover.

wallpaper-323276

Mike Askew 131 Veteran Poster Featured Poster

It is worth reading the "Read before posting" post next time Q8iEnG.

B – Please Uninstall or Disable any P2P (peer-to-peer) programs on the infected computer before posting in this forum. Rather than write a long piece on the dangers of P2P, I’m just going to say this:
P2P software circumvents common-sense security measures and opens a user’s computer to a world of hurt.
Our regular volunteers' time is valuable and most are not willing to waste it on a machine that is almost certain to be reinfected in short order.
So, please remove or disable all P2P software for the duration of the cleaning process. Failure to do so may result in your thread being ignored.

and when we look through your logs..

"{1D153C11-407C-4823-B602-8C1EACFA2F3A}" = protocol=6 | dir=in | app=c:\program files (x86)\utorrent\utorrent.exe |
"{37F69D7D-74C5-46E5-8A50-8558958E15B2}" = protocol=17 | dir=in | app=c:\program files (x86)\utorrent\utorrent.exe |

That is also most likely the origination of your problem right there :)

Mike Askew 131 Veteran Poster Featured Poster
Mike Askew 131 Veteran Poster Featured Poster

Its a new account, I presume his main one is banned.

Mike Askew 131 Veteran Poster Featured Poster

Ah good to hear, mark the thread as solved if no further help is required :)

Mike Askew 131 Veteran Poster Featured Poster

Trying to decide if the typos are purposely there AD!

Wish granted - You try to swim all your medals on to show off and drown.

I wish that teleportation accurate to 1 metre existed, would save me a two hour commute!

Mike Askew 131 Veteran Poster Featured Poster

No worries :)

Mike Askew 131 Veteran Poster Featured Poster

That's also fine, mine was written the way it is as you said the HREF was dynamic and so mine covered all bases.

Don't for get to mark the thread as solved if your issue is fixed.

Mike Askew 131 Veteran Poster Featured Poster

Unfortunately I am little help on the Java aspect, I will point you to these sites though:
- http://www.roseindia.net/xml/dom/CreatXMLFile.shtml
- http://t.genedavis.com/library/xml/java_dom_xml_creation.jsp

They should help with the XML generation part. I can be of more help when you get round to the XSLT :)

Mike Askew 131 Veteran Poster Featured Poster

@Abby2012 please make a new thread instead of hi-jacking this dead one and someone will help.

Mike Askew 131 Veteran Poster Featured Poster

That should do it for you. The output filename is passed in the method call, the folder paths can be changed using the variables.

        static private void ExtractJPEGNames(string OutputFileName) // eg. "PicIDs.txt"
        {
            string sourcePath = @"E:\Source\";
            string targetPath = @"E:\Destination\";
            StreamWriter StrmWtr = new StreamWriter(targetPath + OutputFileName);

            string[] tempArray = Directory.GetFiles(sourcePath);
            List<string> filesInFolder = new List<string>();
            foreach (string fileName in tempArray)
            {
                string tempID = fileName.Substring(fileName.LastIndexOf('\\') + 1, 3);

                if (!filesInFolder.Contains(tempID))
                    filesInFolder.Add(tempID);
            }

            foreach (string fileID in filesInFolder)
            {
                StrmWtr.WriteLine(fileID);
            }

            StrmWtr.Flush();
            StrmWtr.Close();
        }
Mike Askew 131 Veteran Poster Featured Poster

Any specific output file name?

Mike Askew 131 Veteran Poster Featured Poster

Have You followed all the steps in my posted links?

Mike Askew 131 Veteran Poster Featured Poster

I would say no.

Mike Askew 131 Veteran Poster Featured Poster

Thats makes no sense to me :D

Never again will the key be found

Mike Askew 131 Veteran Poster Featured Poster

Sounds like the notorious redirect virus.

See Here

edit: And Here

Mike Askew 131 Veteran Poster Featured Poster

Found it.

Was caused when quoting, had 4+ spaces between the auto inserted '>' and the actual text.

Mike Askew 131 Veteran Poster Featured Poster

That was so painstaking to read with the formatting.

The answers could also be found yourself by using google.

------------

What kind of component in an XML file is written like this:

<?xml version="1.0"?>

Select one:
a. an empty element
b. none of the other cases - this is illegal XML
c. an attribute
d. a processing instruction
e. none of the other cases, but this is legal XML

Your answer: D.
Answer: Incorrect, E.

The XML declaration is commonly mistaken for a processing instruction as it looks like one, however it is not.

------------

This is XML.

<?xml version="1.0"?>
<block>
    <order strength="firm">
        <item>widget-LH-metric</item>
        <number>25</number> 
    </order>
    <order strength="firm">
        <item>tap</item>
        <number></number>
    </order>
</block>

Name the root element: Block
What is the name of the attribute: Strength
What is the name of the empty element: Number

Answers: Correct.

------------

3.This is an XML document. Choose all of the statements that are true:

 <?xml version="1.0"?>
 <block>
     blah<blip>
     <fred>blah</blip>
     <fred>
 </BLOCK>
 <fred></fred>

Select one or more:
a. syntactically correct XML but not well-formed
b. not syntactically correct
c. this is legal well-formed XML

Your Answer: B.
Answer: Correct.

------------

A DTD :
Select one or more:
a. is written in a language defined in a seperate specification from XML outside the XML syntax
b. is itself a well-formed XML …

Mike Askew 131 Veteran Poster Featured Poster

More out of interest really.

How does the reply box work out whether or not your incorrectly formatting a code post and what are the most common errors people encounter?

As I've written a rediculously long reply to something and it's being flagged as incorrectly code formed yet I see no errors in my structure of the code when being written into the forum.

Ie. All code is indented so that it shows as code, and the quoting used is also fine.

Mike Askew 131 Veteran Poster Featured Poster

You would have to use the data returned from the database while writing with the XML writer.

What exactly is the database returning to you? It will allow us to give a better explanation of how to implement this.

Ie. Is it massive amounts of data or small individual pieces?

Mike Askew 131 Veteran Poster Featured Poster

But I lost the key that's yours

Mike Askew 131 Veteran Poster Featured Poster
href=".*"

Will match

href="/ccm/do/docket?county=65&amp;data=eedd78d10fd9da341e05b25b48b62013"

Very useful regex builder

Mike Askew 131 Veteran Poster Featured Poster

Been a long time since I touched VB.Net,

A quick google showed the following as a way to do it, however I have not confirmed this myself.

TabPage.Controls.Find("ControlName", true)

Where the true options also searches child controls.

Mike Askew 131 Veteran Poster Featured Poster

I would personally interpret

with accuracy of 0.001

As the numbers outputted should be to three decimal places. Thats how I've seen it written many times in the past in terms of college work etc.

My point about the not below 0.001 was simply a correction to your code as it wasnt functioning how you wrote it to do so.

Mike Askew 131 Veteran Poster Featured Poster

1 - Is there any way to post directly to a person like sending mail to a person so that that person will get notification about that post?

You can send private messages to individuals, using the Private Messages link in purple bar at top, which they will receive notifications about as long as the same setting, mentioned in #3 response, is turned on.

2 - If i'm updating in a particular thread, will it notify the originator of the thread/post/... or he/she needs to open that particular thread/post to check any upadates??

All participants in a thread will receive a notification about a thread being responded to if they have "recieve mail from DaniWeb" checked in their account settings. Else they will not be notified.

3 - If i'm voting UP/DOWN some thread/post, will the originator of thread/post will get notification about this?

Not that im aware of, I dont get them thats for sure.

4 - Is there any option to add some geek to my friend list so that i can post to him/her directly at any time without searching his/her name?

Think the answer there is no.

Mike Askew 131 Veteran Poster Featured Poster

Following on from what Rev. Jim said, HomeAndLearn is a great site for learning the basics of VB.Net and also includes database connections.

Mike Askew 131 Veteran Poster Featured Poster

Well at present it gives an accuracy of 0.00601406511287088 so that still needs limiting to the three decimal places the task specifies.

You also have an issue with the finishing of the loop. When you set ready to true, you are on the number -0.0162081571093513 which is then displayed as the final number instead of 0.00601406511287088 (should be 0.006) therefore you need to store the prior number also when checking so you can go back to it, alternatively check the sum of total + the next number is not less than 0.001 before actually carrying out the sum.

Mike Askew 131 Veteran Poster Featured Poster
In reply to #1

Do you mean to do 1 + 0.5 - 0.33 + 0.25?

or

1 + (half of total) - (third of total) + (quarter of total)?

It isnt very clear to me.

In reply to #2 [Majestics beat me to it while writing :(]

If we look at the structure of what your doing it is double = integer / integer

So the maths is done on integers and not doubles, therefore you casting the integers to doubles allows the correct result.

An alternative solution is double A = 1.0/2.0; this uses double = double / double so no cast is required.

Mike Askew 131 Veteran Poster Featured Poster

From what I understood:

  • Text file storing first 3 digits of VideoID
  • Read from text file
  • Match first three digits to VideoID's of files
  • If match then copy to output directory

Where did I go wrong?

Mike Askew 131 Veteran Poster Featured Poster

As a devoted XML/XSL developer I thought I would pay homage to the java.util.EmptyStackException, which in english terms means that you’re performing a transform with a stylesheet that’s not valid XML or otherwise building some DOM model with invalid XML…

[Quoted from here]

In terms of how the templates work, they simply match any node with the same name as what the template is specified to match, and it will match all occurances of that node.

It doesnt matter what order they are in within the stylesheet as it will try to match all templates against each node until one, if any, is found.

Mike Askew 131 Veteran Poster Featured Poster

Sounds quite like a homework assignment to me.

For others reading: It is also linked to this thread: http://www.daniweb.com/software-development/csharp/threads/430061/chow-to-codefor-accessing-same-file-names.-if-there-are-2-folders-and-th

What have you done so far yourself?

Mike Askew 131 Veteran Poster Featured Poster

I would suggest providing a copy of the code with this in.

What your currently doing is correct, and so therefore the surrounding code my shed some light on things.

Mike Askew 131 Veteran Poster Featured Poster

I would personally think that the end of the number wouldnt be assumed as a space.

Perhaps you could store the value of

<xsl:value-of select='translate(translate(format-number(ns:FormatNoDollar4(ns:ReturnTotalUndesignated()),"0.00"),"-","(")," ",")")'/>

into a local variable instead and then use a concatenation of the variable and ")" to put the final bracket on?

Its a bit messy but:

    <table-cell>

      <block text-align='far'>
        <xsl:variable name ='tempConcat'>(250.00</xsl:variable>
        <xsl:variable name='tempParanthesis'>)</xsl:variable>

        <xsl:value-of select ='concat($tempConcat, $tempParanthesis)' />

      </block>

    </table-cell>

Used a second variable to store the closing parenthesis as it causes havok within the stylesheet and it also didnt like the HTML code for it. Obviously replace my temporary (250.00 (as provided in your example) with the code that generates it :)

Mike Askew 131 Veteran Poster Featured Poster

Ok let me know how it goes :)

Thank you, have a nice one also!

Mike Askew 131 Veteran Poster Featured Poster

Ok so, if the packagedElement does NOT match a base_part from what I can see we just ignore it?

Or does that also get copied?

The input XML provided also throws up at least two undeclared namespace errors, on xmi and uml, can you provide those declarations, else XSLT will not run on it.

Mike Askew 131 Veteran Poster Featured Poster

The provided XSLT actually runs cleanly for me in VS2010 XSLT debugging.

However, you are using XSLT like it is a programatical language which it is not, I used to make this mistake also. Below I have provided a remake of it which removes the programatical style, as there was no need for the for-each.

XSLT
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output indent ="yes" method="xml"/>
  <xsl:strip-space elements ="*"/>

  <xsl:template match="FieldMatcherResult">
    <xsl:element name ="result">
      <xsl:apply-templates />
    </xsl:element>
  </xsl:template>

  <xsl:template match="FieldPair">
        <FieldMatcherResult>
          <xsl:copy-of select="." />
        </FieldMatcherResult>
  </xsl:template>

</xsl:stylesheet>
INPUT
<match>
  <FieldMatcherResult>
    <FieldPair>
      <Context>A</Context>
      <Field1>A1</Field1>
      <Field2>A2</Field2>
    </FieldPair>
    <FieldPair>
      <Context>B</Context>
      <Field1>B1</Field1>
      <Field2>B2</Field2>
    </FieldPair>
  </FieldMatcherResult>
</match>
OUTPUT
<?xml version="1.0" encoding="utf-8"?>
<result>
  <FieldMatcherResult>
    <FieldPair>
      <Context>A</Context>
      <Field1>A1</Field1>
      <Field2>A2</Field2>
    </FieldPair>
  </FieldMatcherResult>
  <FieldMatcherResult>
    <FieldPair>
      <Context>B</Context>
      <Field1>B1</Field1>
      <Field2>B2</Field2>
    </FieldPair>
  </FieldMatcherResult>
</result>

If the error still occurs I think it will be something else in the Java code and not the actual XSLT.

Hope that helps.

Mike Askew 131 Veteran Poster Featured Poster

Can you provide a sample output?

With one node matching and one without, so I can see what needs doing exactly. Just needs clarifying in my head :)

Mike Askew 131 Veteran Poster Featured Poster

Hehe its always the simple things eh! Know more about me with delegates anyway!

Your welcome, but I wasnt here much, I go for lunch and its solved on my return :D

Mike Askew 131 Veteran Poster Featured Poster

someone even contacted my ymail account and told me that he/she got my mail id from daniweb

Thats a risk you take when publicly displaying your email address on the internet.

Unintended individuals may use it instead for other reasons.

Mike Askew 131 Veteran Poster Featured Poster

Edit: missed the above post when writing this.

Right so now we get into where my knowledge is hazy, delegates :)

My first step would be to use Console.WriteLine() on nearly every line of your threaded code, because this will allow us to see how far it runs before it hangs. Like the "Hello World" in your example code.

Just write say a description of what line is doing into command prompt and see where it gets stuck :)?

Mike Askew 131 Veteran Poster Featured Poster

Well firstly we need to know how you'd store the gathered information. As this is required for the display results options and resulting calculations to be completed.

So decide upon that firstly :)