[basex-talk] sum() is returning inaccurate sums
Hi all, I'm building a budgeting system for home use, using XSLTForms and -- ready for it? -- BaseX! sum() has been behaving weird. I'm adding USD, which means only 2 decimals of precision. But depending on the combination of elements I add, I'll get a long double that's inaccurate. Sometimes it returns what I expect, sometimes it doesn't, but either case is repeatable. Take these 3 receipts: 1 -- 2020-06-08 Frigid North Jay Debit shop-general 6.50 0.00 6.50 Start Capacitor (for old rockwell saw/jointer motor) 6.50 1 6.50 shop-general 2 -- 2020-06-09 Home Depot Tudor Jay Cash jay-misc 9.87 0 9.87 Stainless Protractor 9.87 1 9.87 jay-misc 3 -- 2018-09-16 Title Wave Midtown Franny Debit books 20.85 20.85 Music of the Spheres books 6.95 1 6.95 Magic Mirror of M. C. Escher 8.95 1 8.95 books Daumier 120 Great Lithographs 4.95 1 4.95 books When I sum the elements: sum 1 & 2 = 16.367 sum 1 & 3 = 27.35 sum 2 & 3 = 30.72 What makes certain combinations return such crazy numbers? I did find one other thread in the mailing list about this, it got an answer but didn't really explain much. I have a schema for prices in the XForm, should I be loading that somehow? The only workaround I have now is like, "let $grosses:= for $gross in $receipts//gross return xs:decimal($gross)" but I'm hoping there's a more straightforward way. Not sure if this is implementation specific or if it's not defined or what. If I should ask elsewhere, please let me know :-) Be well, Jay
[basex-talk] Serializing with xml-stylesheet prolog
Hi, Been a while since I've posted. Been a while since I programmed! I need to run a client-side stylesheet (XSLTForms, I tried it server side, didn't work), but getting my assembled XHTML document to output with has been hard. After searching https://docs.basex.org/wiki/Serialization, http://www.w3.org/TR/xslt-xquery-serialization-31/#serparams-in-xdm-instance, searching this list, lots of googling with prolog/declaration/other words, I came up empty. So I tried other things. But those other things worked poorly, and when things did come out in the right order, with the right namespaces etc, the single page app that worked as a standalone document, doesn't work. If I copy and paste raw output from basex that my browser receives, put it in a new file in the same directory, and open that in my browser it works fine. So there's gotta be some issue with my workaround. So I'm hoping you can tell me what I've missed in my searches, so that I don't need a workaround :-) I haven't built anything in a few years, but I've been subscribed to this list for many many years and you're all such a patient, wonderful lot. Thank you all so much. Be well, Jay Straw
[basex-talk] Performance: associating one with many, or many with one?
Hi List! I'm building an application in base-x that's sort of like a local music wiki: bands, members, venues, promoters, and albums and songs are some of what I'm representing in XML. And what I'm wondering is that, in a situation where there's one of something (a musician), and a bunch of something else they're associated with (song writting or performance credits), which node should get the reference? The numerous node gets the reference back to the one: [ etc ] Or the one refers to the many: Example 1, I could use something like: track[@written-by="Joe Schmoe"] Example 2: person[@name="Joe Schmoe"]/songs-written/song My other thought was putting the references in both, but I'll have to do this with many types of objects I'm representing and I don't want things to get out of control (then again, if I go to export an or and I'm using the second method, I'll have to do a join) I have a feeling in a large set, the second way wins out. Even where I live, with only around 750,000 people in our entire state (Alaska), we have easily 100 - 200 acts, including bands, solo performers, traditional acts, etc, with thousands of individuals that compose them. But I want bands that are extinct, bands that are on hiatus, etc, and I hope my software is useful to others in larger cities as well. So, maybe a pointless question because my db will be so tiny compared to some folks who post on here, but just curious :-) Also, if this problem has a name I can research myself, that'd be great! Be well, Jay Straw
[basex-talk] Compiling w/ HTTP
Hi all, I've just compiled from git the basex, basex-api, and basex-example repos, using maven. When I try to start, in basex-api, etc/basexhttp, I get: Exception in thread main java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Handler Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.Handler at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main class: org.basex.BaseXHTTP. Program will exit. Which to me suggests I'm missing Jetty stuff, however I'm unsure why that wasn't brought to my attention during the compile? I'm all kinds of confused. Thanks for any help, Jay ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
[basex-talk] Hi all, and URL Rewriting/Request handling question
Hi all, I've been developing in eXist since 2008, and I'm now trying out your BaseX. I'm impressed so far, but how can I perform URL rewriting? I've tried using Jetty's Rewrite Handler via the example code at http://wiki.eclipse.org/Jetty/Feature/Rewrite_Handler but then the server fails to start, it simply dumps with: $ sh bin/basexhttp org.eclipse.jetty.rewrite.handler.RewriteHandler So I figure I need to compile it in (I grabbed from github and built with maven, but didn't know how to build the http server and downloaded the 5meg zip). Not sure how to do that. I'm not a Java guy at the moment, so any pointers would be very helpful. Thanks everybody! Jay ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk