|
maze3 wrote: I give someone 1 hour to do a 10 minute task, they will take 1 hour.
If you're lucky.
More likely, they'll spend that hour procrastinating, thinking "I've got plenty of time", and then ask for an extension on the deadline.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Essentially went to the moon with slide rules. Astronauts carried a 6" aluminum Pickett. Man hasn't been back since the appearance of the PC. Now we just float about in LEO.
|
|
|
|
|
Randor wrote: but I somehow feel that something is wrong with the way we write software today. Programmers have gotten lazy. Once upon a time efficiency and accuracy were more important than time-to-market. The proliferation of programming tools and frameworks are to make the programmer's life easier and faster, but the developer is actually the least important stakeholder: making an application behave easily, predictably, accurately and efficiently for the END USER should be the primary goal!
|
|
|
|
|
Another trend I have noticed when comparing new versus established languages is the complaint that the established language 'is boring'.
|
|
|
|
|
For those interested in the history of Apollo and programming, look into the work of Margaret Hamilton who received the Presidential Medal of Freedom for her work for NASA and for the US military (SAGE early warning system). I trail blazing women for sure.
Kevin
|
|
|
|
|
Randor wrote: The hardware has become so much better... but I somehow feel that something is wrong with the way we write software today. No. It's still the same old game.
I still have my first computer with whopping 4k memory, a 256 byte ROM and a small risky CPU. You would not believe what we got running on this limited hardware. But that comes at a price. You must cut all corners that you can. Forget everything you ever heard about clean, maintainable code.
GOTOs (or branching instructions) are now your best friend. Avoid subroutines with their overhead for passing parameters, saving registers and returning results. Write highly specialized spaghetti code instead. It's, by today's standards, unmaintainable. Only the limited scope of your code makes this a reasonable idea. And it will be compact, even performant. Once you got it working.
Unfortunately there is no compromise. Make it compact and then it will not be very maintainable or the other way around. Memory vs. performance is a similar tradeoff, but here you have more room for compromises.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Randor wrote: They were working with the 16 bit Apollo Guidance Computer[^] with no floating point instructions and that was all they needed to get to the moon.
Of course. Contrary to some beliefs, the moon isn't floating, so why would you need floating point. Besides pure integer has no roundoff error.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Throwback Thursday: Hey mister, got the time? | Computerworld reminded me vividly of when I first faced this issue, when it truly mattered, because I needed to resolve conflicting data base updates that were recorded on two machines that ran in different time zones. Fast forward a decade, and I faced another version of the problem, when the time was recorded when DST was in effect, and reported when it was not, and vice versa. Worse yet was when someone started on a course at 2:15 AM CDT, and finished at 1:45 AM CST. How long did he work on it?
Soon afterwards, I converted every time stamp in the data base table to UTC, retaining the original local times for auditing, and changed the reports to use the UTC time stamps. Since then, I have always recorded UTC times in data base records.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
UTC - There can be only one!
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
Forogar wrote: UTC - There can be only one!
Indeed; moreover, it's unambiguous.
Forogar wrote: I would love to change the world, but they won’t give me the source code.
So would I. Even if you got it, it's written in the undocumented assembler for an undocumented hyper-hyperthreaded processor that's also undocumented, and it's devoid of comments. Oh, yea, it's also massively multithreaded.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
Quote: it's written in the undocumented assembler The way it works, you would think it was written in VB6!
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
David A. Gray wrote: Forogar wrote: I would love to change the world, but they won’t give me the source code.
So would I. Even if you got it, it's written in the undocumented assembler for an undocumented hyper-hyperthreaded processor that's also undocumented, and it's devoid of comments. Oh, yea, it's also massively multithreaded.
Ahem: Off to Be the Wizard by Scott Meyer[^]
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|
|
That book looks interesting, and hinges on a concept that has been the subject of several of my thought experiments.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
Now, add this to the mix.
http: [^]
I shudder to think of the havoc this will play with critical systems throughout the sunshine state. Hopefully, if they do pass it, they will wait at least a year to implement. (will we need a new rule for dst (or in this case non-dst) adjusted display? (state != 'FL')
"Go forth into the source" - Neal Morse
|
|
|
|
|
I think he's been trying to make that happen for about as long as he's been in Congress. IMO, it needs to go the other way, and Daylight Saving Time needs to join the ranks of extinct species, along with the dodo bird. From my perspective, the only thing that Daylight Saving Time does is add unnecessary complexity to time keeping.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
I think we should eliminate time zones altogether, and just go by UTC.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
What is Internet Time?[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
UTC - There can be only one!
I agree, people would quickly get used to whatever time they do things wherever they are.
An 8 O'clock Breakfast in New York would be at 13:00 (We should also switch to universal 24=hour clocks) and so on - but people would get used to it very quickly and wonder why the old, stupid, system ever existed.
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
That would be OK with me. Certain groups, e. g., airline pilots and air traffic controllers, already do so, for all practical purposes, as does the US military.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
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
|
|
|
|