|
That means I just swap places with the kids and get out of bed at 6pm !
A Fine is a Tax for doing something wrong
A Tax is a Fine for doing something good.
|
|
|
|
|
|
I spent way too long yesterday discovering that XPath 1.0 does not support string comparisons for anything but equal as the args are automatically converted to number...not much use when you are trying to filter an xml document with a date attribute!...or any string which doesn't convert to number) The weird thing about this is that this was VB6 code I am migrating...meaning, it works fine with ancient XML libs, but not a modern framework. (currently targeting 4.0) Such is progress! I guess I'm used to going forward, not backward!
They may have fixed/added this in XPath 2.0 which I think is available under .NET 4.6.2 or something. I chose another method not involving XPath once I discovered why no results were being returned. It was the hours spent cursing and swearing, not understanding why something that looks like it should work doesn't. No error, just no results. It was easy to understand why once I knew that the rules had changed.
For clarity, I'm providing a sample xml doc and code:
The sample xml document was taken from MS sample code. I only added the publish_date attribute as this was akin to my actual usage.
<xml version='1.0'?>
<bookstore xmlns="urn:newbooks-schema">
<book genre="novel" style="hardcover" publish_date="1825-04-02">
<title>The Handmaid's Tale</title>
<author>
<first-name>Margaret</first-name>
<last-name>Atwood</last-name>
</author>
<price>19.95</price>
</book>
<book genre="novel" style="other" publish_date="1901-10-29">
<title>The Poisonwood Bible</title>
<author>
<first-name>Barbara</first-name>
<last-name>Kingsolver</last-name>
</author>
<price>11.99</price>
</book>
<book genre="novel" style="paperback" publish_date="1965-06-10">
<title>The Bean Trees</title>
<author>
<first-name>Barbara</first-name>
<last-name>Kingsolver</last-name>
</author>
<price>5.99</price>
</book>
</bookstore>
and now, the code:
Dim xmlDoc As New System.Xml.XmlDocument
Dim xmlNodes As System.Xml.XmlNodeList
Dim root As System.Xml.XmlNode
xmlDoc.Load("..\bookstore.xml")
Dim nsmgr As System.Xml.XmlNamespaceManager = New System.Xml.XmlNamespaceManager(xmlDoc.NameTable)
nsmgr.AddNamespace("bk", "urn:newbooks-schema")
root = xmlDoc.DocumentElement
'this returns 1 node/record
xmlNodes = root.SelectNodes("descendant::bk:book[@publish_date = '1901-10-29']", nsmgr)
Debug.Print(xmlNodes.Count)
'this returns 0 nodes/records
xmlNodes = root.SelectNodes("descendant::bk:book[@publish_date > '1901-01-01']", nsmgr)
Debug.Print(xmlNodes.Count)
"Go forth into the source" - Neal Morse
modified 12-Jul-18 13:48pm.
|
|
|
|
|
|
Richard Deeming wrote: You must be doing something wrong
Without a doubt...I'm taking a big risk here, exposing my ignorance!
I've edited the OP with a sample for clarity. I really didn't intend to use the forum for QA, but I think maybe I was a little vague on the exact problem. Thanks!
"Go forth into the source" - Neal Morse
|
|
|
|
|
OK, the "less than" and "greater than" operators don't work for strings, as per the specification:
When neither object to be compared is a node-set and the operator is <= , < , > = or > , then the objects are compared by converting both objects to numbers and comparing the numbers according to IEEE 754.
I'd be very surprised if that wasn't also the case with the old MSXML library. But then again, it was written by 90's Microsoft - they weren't the best at sticking to the specifications!
There's no obvious sign of Microsoft implementing XPath 2 or 3 in .NET; there's an open suggestion from 2013[^] which is "under consideration", with no sign of any action.
There's also an MSDN blog post from 2004[^] suggesting they would be working on XQuery instead. Again, no sign of any progress on that front.
It's also worth pointing out that you can't use the less than or greater than operators on strings in .NET code either. Instead, you have to use the CompareTo method.
You can get close by using LINQ to XML, but that obviously requires you to load the entire document into memory:
var doc = XDocument.Parse(@"<?xml version='1.0'?>
<bookstore xmlns=""urn:newbooks-schema"">
<book genre=""novel"" style=""hardcover"" publish_date=""1825-04-02"">
...
</bookstore>");
var nodes = doc.Descendants(doc.Root.Name.Namespace + "book")
.Where(el => ((string)el.Attribute("publish_date")).CompareTo("1901-10-29") >= 0);
var nodes = doc.Descendants(doc.Root.Name.Namespace + "book")
.Where(el => (DateTime)el.Attribute("publish_date") >= new DateTime(1901, 10, 29));
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Have you ever researched an effective way to copy data to the user's clipboard from your web app?
Well, it has always been a pain (old methods of using some Flash technique or whatever) or basically impossible.
I just stumbled upon this really cool thing which seems to be the new way to do it and I've tested in Chrome, FireFox and Edge and it works in all 3. W00t!
Here's the simple code I added:
$("#passwordText").select();
document.execCommand("copy");
Did you already know about this and not inform me!?!
I been looking for it for long time.
Here are more complete docs on it. Notice that those docs have been updated recently -- I think this recently (last 6 mos) became available. Only about 7 (or 20) years late.
Interact with the clipboard - Mozilla | MDN[^]
Now you can try C'YaPass and it will automatically copy your password to your clipboard so all you'll have to do is paste it at your target.
C'YaPass : Never type a password again[^]
1. Add your sitekey
2. draw your pattern
3. web app copies 64 character (SHA-256 hash) to your clipboard. Use it as your password.
All sitekeys are stored in your localstorage. You can delete and edit them.
It will remember password requirements (length, special chars, uppercase) for site (if you set them).
And now it copies the password to the clipboard for easy paste usage.
That is all.
|
|
|
|
|
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
on here played with the Outernet? I saw a demo some time back and am wondering if this might be worth my effort to set up.
rEGARDS,
Walt
Obligatoryt linkhttps://outernet.is/
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
I don't think this is the correct forum for this query. And I would recommend you to ask without the link, it might be considered spam.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Why would this be the wrong forum and why would you consider it to be spam to simply ask a question?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Read the description of the forum above. That kind of question is better placed on the lounge or in a forum of the programming language used to interact with it, and not in "the Weird an the Wonderful".
The spam can be considered because you are linking to a external paid product. You can ask exactly the same question without the link. If someone has played with it, (what you want to know), they will recongnise the name anyways, so no link needed. If someone didn't know it, the answwer is "no, I didn't play with it", no link needed anyways.
I know you didn't mind it as spam, that's exactly why I told you it as a friendly warning. Other people could have reported you without saying anything.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
modified 7-Oct-18 6:12am.
|
|
|
|
|
This is definitely weird, and maybe wonderful.
For years, we've been told that you can't run a character mode program in full screen mode on Windows Vista and later. In Windows 10 Professional, Build 1803, there exists at least one special case in which you can! I discovered this by accident a couple of days ago, and finally remembered to document it.
Though I cannot imagine, offhand, why you might want it, when you run a console mode program in the Visual C++ debugger (the Native code debugger, that is), select the window, e. g., to copy text into the Windows Clipboard, if you press F11, the window displays full screen in 43-line mode. Thankfully, and as expected, F11 is a toggle; pressing F11 again restores the window to its normal size.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
Hi,
David A. Gray wrote: For years, we've been told that you can't run a character mode program in full screen mode on Windows Vista and later.
It's true. Support for the real VGA-compatible text modes[^] was removed a long time ago.
Rich Turner just blogged about the evolution of the console[^] a few days ago. Looks like there will be more features coming. Interestingly... his blog says that the console is "The most frequently launched executable in all of Windows".
Best Wishes,
-David Delaune
|
|
|
|
|
Quote: Interestingly... his blog says that the console is "The most frequently launched executable in all of Windows". I find it somewhat disturbing that they would know that. I guess it could be gauged by monitoring the usage of beta testers.
|
|
|
|
|
I'm not sure what you are saying is true, but I have pictures to prove that I can display a full screen console on my Windows 10 Professional x64, Build 1803. Not only that, but I've further discovered that it works for any true command prompt window.
- The first three pictures show a Visual Studio debugger window, first in normal view, then maximized to full screen by pressing
F11 once, then restored to its normal size by pressing F11 again. - The next pictures show the same 32-bit character-mode program, compiled from ANSI C sources by the Visual Studio 2017 C/C++ compiler, launched from the File Explorer.
- The third set of pictures show the same program, preceded by a series of other programs (
ShowVer.exe and DumpBin.exe ) run in a new CMD.EXE instance.
Go figure. Meanwhile, I'd be interested in learning whether others can duplicate my observations. So far as I know, there is nothing special about my machine or my Windows installation.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
Hi,
Did you notice the scrollbar on the side of your console window? You are looking at a maximized, borderless "windowed" console at your current monitor resolution. Not a true 80×43 x 640×350 text mode.
This is very easy to understand. Let me show you.
Step 1.)
Press F11 and allow your console to go full screen.
Step 2.)
Press SHIFT + PRNTSCRN to take a screenshot
Step 3.)
Press WIN + R to open the Run Dialog and type 'mspaint'
Step 4.)
Press CTRL-V and paste the screenshot into MS Paint
Step 5.)
Use the MS Paint Menu and choose File->Properties
Notice that the image is exactly the same width as your current screen resolution. That's because your monitor resolution never changed. You are looking at a full screen window at your current monitor resolution.
I have not spent much time investigating all of the new ANSI/VT features[^]. But it looks like there has been a lot of enhancements to the console window.
Best Wishes,
-David Delaune
modified 3-Jul-18 22:34pm.
|
|
|
|
|
Yes, I discovered that scrollbar later yesterday evening, and today made a few other discoveries that go along with it.
- The new clipboard shortcuts (Ctrl-A, Ctrl-C, Ctrl-V) are fully functional.
- Alt-Enter elicits the same behavior as F11.
I suspect you surmise correctly that these improvements came along with the ANSI/VT features. In any case, they ware very welcome, since I spend lots of time working in command prompt windows, and I miss the full screens that we once had, back in the day.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
David A. Gray wrote: I suspect you surmise correctly that these improvements came along with the ANSI/VT features.
I have known about and used these new console features for many months. If you join the Windows Insider Program[^] you can also preview and give feedback on some of the newer features.
If you decide to join make sure that you choose an appropriate ring. The 'Fast Ring' can be very frustrating and might not be the best choice for an office development workstation due to frequent updates and instability.
Insider Preview Types[^]
Best Wishes,
-David Delaune
|
|
|
|
|
I just learned about them when I started this thread. How are you using them?
As for joining the insider program, I'll pass for now.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
Hi,
David A. Gray wrote: I just learned about them when I started this thread.
I mention VGA text mode emulation in a comment several months ago[^]. I've been on Insider builds for many years now on most of my Windows 10 devices.
David A. Gray wrote: How are you using them?
Like you I want my terminals to be full screen for that immersive experience. I am not using any of the new ANSI/VT features[^]. I've only done some simple experimentations with the WSL subsystem[^] terminal a few months back.
Best Wishes,
-David Delaune
|
|
|
|
|
Fair enough. What benefit do you derive from being on an insider track?
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
Well,
For any software engineer or windows-centric software company I would say that one benefit of being in the Insider Program[^] is getting exposed to features several months before they are available to the public. I also think it's important to test existing products on the insider builds to ensure that existing software isn't affected by breaking-changes.
Best Wishes,
-David Delaune
|
|
|
|
|
I agree, if you are actively developing software for paying customers.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
A search for actionable information about the distinction between const and static const led me to c - Are const Local Variables Implicitly static? - CS50 Stack Exchange. Finding the answer wanting, I changed the function that prompted me to raise the question in the first place. Examining the disassembly reminded me of a discovery that I made so long ago that I had forgotten the details that led me to almost always pair static and const when I define arrays of constants, such as lookup tables and the like. Details are in the 3rd answer shown in the Stack Overflow topic.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|