• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

test please delete

Collapse
This is a sticky topic.
X
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Did some shopping. On the way back, the pips went on Radio 4, and I looked out at the darkness and thought "Surely it isn't nine already?" But no, it was only eight, and already the tail-end of twilight

    Comment


      Ah, so it wasn't working because I'd made a cretinous mistake. Yes, that would explain it

      On the bright side, while digging through documentation that was not, in fact, related to the source of the problem, but seemed like it might be at the time, I discovered a technique to considerably improve the code for the sake of about two minutes of effort. Overall, I'm going to chalk it up as a win

      Comment


        In the dim & now very distant past, when I worked shifts in 3M, one could tell that the nights were drawing in & autumn was advancing when it was dark outside for the 8 p.m. tea break.

        Yet another empty factory now.

        Comment


          Originally posted by NickFitz View Post
          Ah, so it wasn't working because I'd made a cretinous mistake. Yes, that would explain it

          On the bright side, while digging through documentation that was not, in fact, related to the source of the problem, but seemed like it might be at the time, I discovered a technique to considerably improve the code for the sake of about two minutes of effort. Overall, I'm going to chalk it up as a win
          I got my brackets wrong today. Or more that I didn't have brackets where I should have. Took me a while to spot though.

          Comment


            Originally posted by mudskipper View Post
            I got my brackets wrong today. Or more that I didn't have brackets where I should have. Took me a while to spot though.
            Syntax was:

            z = x == null ? 0 : x
            + y == null ? 0 : y;

            Which looked logical without brackets but when x and y both had values, z = y. Presumably because x + y == null was false. I don't think BODMAS covered syntax like this.

            Comment


              Originally posted by mudskipper View Post
              I got my brackets wrong today. Or more that I didn't have brackets where I should have. Took me a while to spot though.
              I was parsing a streaming XML file, using lxml in Python. The problem, of which I was well aware, was that a certain element contained, as a child, another element of the same name. The idea is that, once an element has been parsed, one grabs what data one needs from it, then deletes it so as to avoid consuming too much memory - these files can easily be 50MB as raw text, so would consume loads of memory as an object tree.

              I was using delegates from the top-level event handler to deal with the different elements I was acting on. I'd carefully written my code to identify when the element we've just finished parsing is the inner element with the same name, as obviously we don't want to delete things then. My code was correctly identifying that, but when the outer element was completely parsed, my XPath expressions were returning nothing for various things

              I spent quite a bit of time going through the docs for the XPath implementation, ensuring I was handling namespaces correctly, and so forth.

              In the end, it turned out that the higher-level code which sets up and invokes the delegate functions had a line in it that deleted the element, after calling the delegate, that was left over from when I was getting the bare bones of this stuff working at about 4 this morning, which I'd completely forgotten about

              Once I took that out, it all worked exactly as intended. Still, I'd learned a way to precompile the XPath matchers along the way which has drastically improved performance so, as my mother likes to say, it must have happened for a reason

              I am now in a position to inform you that England's highways have 3,424 Variable Message Signs, and an impressive 11,199 Matrix Signs

              Comment


                Originally posted by mudskipper View Post
                Syntax was:

                z = x == null ? 0 : x
                + y == null ? 0 : y;

                Which looked logical without brackets but when x and y both had values, z = y. Presumably because x + y == null was false. I don't think BODMAS covered syntax like this.
                Tricky beggars, those ternary operators. They catch me out every now and again

                Comment


                  Morning all

                  Comment


                    Morning
                    "Ask not what you can do for your country. Ask what's for lunch." - Orson Welles

                    Norrahe's blog

                    Comment


                      Join IPSE

                      Comment

                      Working...
                      X