|
Anyone have any favorite hex editors? I want to take a look at some game data files as a little challenge for myself and want to know if anyone has a hex editor they really love. Windows freeware, preferably
|
# ¿ Feb 2, 2012 08:57 |
|
|
# ¿ May 4, 2024 04:32 |
|
pr0k posted:I'm trying to learn XSL in a hurry and not in a good way. The issue here is that the XSLT processor has no way of distinguishing the two templates matching createdate. Both your createdate templates have the exact same priority when choosing which template to apply - see this StackOverflow question. This goes into far more detail than you probably need, but the takeaway point is this (my emphasis): W3C posted:It is an error if this leaves more than one matching template rule. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matching template rules that are left, the one that occurs last in the stylesheet. I assume this is why both variables end up with the value from the time template. You could fix this by changing the priority of the two templates by adding a mode to the template and the apply-template: XML code:
|
# ¿ Jun 27, 2014 10:33 |
|
pr0k posted:Aha, thank you! I saw the 'mode' suggestion somewhere, probably on SO, but I didn't grok it. Nothing too stupid about processing XML with a tool designed to process XML I can think of a few places at work where we use XSLT to turn XML to CSV and/or JSON (not that I'd recommend creating JSON this way). I guess it depends on how complicated the rest of the output needs to be. If you need to e.g. aggregate data then it may be easier to do it in Perl. If you're got the XSLT mostly written and working and you're happy with it then you might as well keep it. If you're much more comfortable in Perl (and if other people in your organisation are proficient too) then you could definitely use Perl. Just make sure you use a proper XML library for parsing the documents instead of writing a bunch of regexes! Personally, I'd be slightly more inclined to use another language rather than running an XSL transform for writing to a flat file. If the output was XML, I'd almost certainly do XSLT.
|
# ¿ Jun 28, 2014 03:42 |
|
it is posted:I'm looking in a very badly-made HTML page for an element. The element has two descendants (not necessarily children): one is a div with the text, say, 'SpongeBob' and another is a div with the text, say, 'SquarePants.' What's the proper XPath for "a tr that has a descendant with this text and another descendant with that text?" Thanks! I work with lovely document structures on a daily basis. //tr[.//div[text() = 'Spongebob'] and .//div[text() = 'Squarepants']] might work for you, given an HTML structure like: HTML code:
//tr matches any and all <tr> elements in the document - you might want or need to change this to be more selective. .//div matches all descendent divs of the current node (and .//* matches all descendent elements of any kind of the current node).
|
# ¿ Jun 12, 2015 01:17 |
|
Slanderer posted:We're using SVN here (and I'm running TortoiseSVN on my machine), and I'm trying to figure out how to do something extremely stupid. There's an XML file I need to occasionally commit changes to, except I cannot commit any changes to a specific line in the file (the line identifies the hardware debugger I'm using, which is different than what the rest of the team uses). There is no nice solution to it, since the file is parsed by an embedded development IDE has no concept of local settings. I'm wondering if there is a way to prevent myself from committing changes this single line in the XML file. Would I have to do some nonsense with hook scripts that run before and after a commit that change the line in the file back to the default value and then back to my setting again? You could look into using TortoiseSVN's restore after commit feature. When you need to commit a change to this file, right click on it in the TortoiseSVN commit window and hit 'restore after commit' (you might need to dig in some submenu to find this option). Then open up the file and find and revert that particular line - you can do this when viewing the file diff in WinMerge or Beyond Compare or TortoiseDiff or whatever. Then commit as normal. TortoiseSVN will commit the file without your hardware debugger line, and will also restore that line on your machine so you can keep working without faffing around to change it back. But yeah, a commit hook might well be more ergonomic and less irritating. It comes down to 'can I be bothered writing a script to make my life occasionally a bit easier?' The TortoiseSVN docs mention that TortoiseMerge can choose which changes to include, but I've never used this. I'd use restore after commit a lot more at work if our deployment process wasn't so... nonexistent.
|
# ¿ Mar 12, 2016 05:22 |
|
JawnV6 posted:Gosh, I wonder if it was carefully constructed after considering the targeted recursive backtracking implementations instead of magically falling out of the sky. It's pretty easy to accidentally stumble upon a regex that runs into catastrophic backtracking land without realising. At work we had an email validation regex that went exponential on long invalid input, that I only found accidentally when I ran a unit test that took 15 minutes to succeed
|
# ¿ Sep 30, 2016 12:31 |
|
Man, I knew what the response would be like when I used the trigger phrase "email validation regex". To address the issue, (1) I know it's a bad idea, (2) it would be institutionally impossible to change, (3) I don't really give enough of a gently caress about this horror because it really is a drop in an ocean of bad code, bad practice, and bad process. JawnV6 posted:Boy my face sure is red! If I ever come across a situation where I'm forced to run a user-provided regex or attempt to validate an email with a regex I'd have to think long and hard. Unless, by some weird coincidence, those are both terrible ideas to implement regardless of underlying regex implementation. Wholeheartedly agreed, but my point is that unknowingly stumbling into a regex that exhibits catastrophic backtracking isn't that hard, particularly since no one actually understands how their particular regex engine works (or indeed how any regex engine at all works).
|
# ¿ Oct 2, 2016 02:18 |
|
There's nothing wrong with an EAV (entity-attribute-value - your option 1) schema, and they're not terribly inefficient if indexed properly. It might be a bit tricky to actually query, depending on your ORM or whatever. Some people consider EAV tables to be a code smell or even an outright antipattern, usually because people often go overboard and jam all their data into EAVs (at which point you've just designed a lovely key-value store). I'm not familiar with Postgres' hstore or json features, but I'd definitely look into those. It's probably overkill to involve a separate nosql data store.
|
# ¿ Oct 16, 2016 00:38 |
|
piratepilates posted:tinkerpop, Gremlin I'm trying to imagine having a serious conversation about adopting graph databases at work and having to use these words in a group of adults
|
# ¿ Feb 3, 2017 20:46 |
|
piratepilates posted:You think just the names are bad? Take a look through the tinkerpop documentation first. Christ, you're not kidding.
|
# ¿ Feb 3, 2017 22:38 |
|
Maybe EditorConfig would be needs-suiting? I'm going to give it a shot with VS since VS2017 comes with out of the box support. Your big-name IDEs should have plug-ins or similar.
|
# ¿ Mar 8, 2017 05:50 |
|
Triglav posted:So I have two arrays, one with things I'm interested in (needles) and another taken from a constantly changing API (haystack). The contents and length of the haystack are constantly changing. Turn haystack into a hashmap for quick lookups. code:
Other questions to ponder:
|
# ¿ May 14, 2017 06:32 |
|
If the haystack can change while you're iterating over it, then I don't think the original code would work too well either. At what point can the haystack change? Are you dealing with multiple threads?
|
# ¿ May 14, 2017 06:41 |
|
Is it easy to identify when the haystack changes? Do you typically run your lookup on the same haystack data a few times before it changes? If so, you could eat the cost of building a hashmap for the haystack once and use it until the haystack changes, then rinse and repeat.
|
# ¿ May 15, 2017 01:36 |
|
Jabor posted:It might be time for an avatar change, I think. Perhaps something with George Zipf would be appropriate, given the context. But your current av is just so perfect!
|
# ¿ May 30, 2017 21:20 |
|
Rolfus posted:So. I'm a stupid newbie who wants to learn how to make a simple html app that plays a video and presents some buttons. I hope this is the thread for it. If it's simple enough, one of those Google docs forms that I've seen floating around would do.
|
# ¿ Jun 12, 2017 20:30 |
|
Could you generate a client in $(language of choice)? You could then write integration tests in a real language, rather than scripting a GUI client.
|
# ¿ Sep 1, 2017 06:39 |
|
Gul Banana posted:i think the missing piece here is that javascript is single threaded. nothing else *can* run until your script is finished, so nothing can hit those websocket’s callbacks until they have been set For now (if some mad men have their way). IMO, Javascript's single-threaded event loop is one of its best features.
|
# ¿ Oct 19, 2017 00:43 |
|
If you're dead set on finding a spec, the event loop is defined (in a browser context, at least) in the HTML 5 spec. ES6 defines the behavior of "jobs", which you can think of as being equivalent to tasks in the event loop (they're actually browser microtasks, although the difference between these and tasks is a bit irrelevant if you're learning about the event loop). There's some very good info here, and you can go digging into the specs if you really want.
|
# ¿ Oct 19, 2017 12:16 |
|
huhu posted:I'm looking to round out my general understanding of programming languages and have been working almost entirely with Python, JavaScript, and C++ (via the Arduino). What language would be most beneficial with the least amount of properties in common with Python and JavaScript and to a lesser degree C++? Haskell. Erlang. Forth. Smalltalk. J/K/APL. Prolog. Agda/Idris/Coq. Ocaml/F#. Java/C#. Lisp. Cobol. R. SQL.
|
# ¿ Oct 28, 2017 11:19 |
|
Fire Storm posted:The Perl thread is locked for archiving so I'm asking in here instead. It's late, the first Google result for "perl xpath" returned a module that started talking about 'scalar contexts' and I decided that I didn't want to learn Perl, I had Python installed, and Python is a very batteries-included language. So! Python code:
It uses the ElementTree module (specifically, its XPath support) to find and pull data out from the <JOB> elements, and the csv module to write the CSV file. Since it parses the XML file into a bunch of objects, you may find that it takes a long time and a lot of memory to run on your 13mb XML file. If it outright dies due to OOM, we'll have to take another look at it.
|
# ¿ Nov 15, 2017 11:54 |
|
Fire Storm posted:...but I think the weird formatting of the XML file is causing some issue. The script works perfectly fine for normal fields, such as JOBNAME and PARENT_TABLE, but the fields I need, PROGDESP and PROGNAME, have a different formatting than the rest of the job. It sounds like when you say 'formatting', you're actually referring to the XML structure - the layout and nesting of elements and attributes. Formatting is more about where you put newlines, how you indent lines, etc. The formatting of an XML document is mostly1 independent of its structure, and you can reformat an XML document to make it more human-readable without changing the structure (and therefore the meaning of the document). Luckily2, your XML file is syntactically valid, so you can pull whatever data you need out of it using common, well-known libraries in basically every language. Let's tidy up your example file by formatting it and removing uninteresting elements and attributes. This allows us to clearly see the 'shape' of the XML, and incidentally figure out why your Perl script wasn't working. XML code:
In your Perl script: Perl code:
This sort of 'traverse the XML tree willy-nilly' is so common that a bunch of XML nerds got together and created an extremely cool and good (not to mention pretty intuitive) DSL for querying XML documents - XPath! If you've ever written a file path before, you're halfway to reading and writing XPaths. In that Python script, I used XPath a couple of times:
If you expect to do a lot more work with XML, I recommend you do a bit of reading on XML itself, then learn XPath. Choose a language and learn about its XML libraries. I use .NET's XmlDocument class a lot, which is rock solid. If you stick with Python, you'll want to look at picking up a better library. ElementTree's XPath support is utterly miserable. 1 Barring some edge cases with whitespace between elements that aren't a problem for you, and that I'm not really confident about identifying. 2 In theory, everyone creates XML by using libraries that guarantee a well-formed document. In practice, a non-zero number of people create malformed 'XML' by manually writing invalid garbage to a file and calling it XML.
|
# ¿ Nov 15, 2017 12:55 |
|
Thermopyle posted:I've been thinking about improving software quality and came across QuickCheck, aka, property-based testing. It seems like a neat idea. Hypothesis is a python (and java?) implementation. I've never had a chance to use property-based myself, but fellow forums user MononcQc has a neat blog post on it, and is writing a book on the subject (in Erlang, but a lot of the theory should apply to other languages).
|
# ¿ Jan 4, 2018 20:26 |
|
The convention seems to be to return 202 with a Location for the actual resource. You can return 303 from the 'queue job' endpoint once your job has finished and the resource is available.
|
# ¿ Jan 23, 2018 20:44 |
|
TooMuchAbstraction posted:Remember, there's absolutely nothing wrong with a library that contains a single file that has a single 10-line function. Counterpoint: npm
|
# ¿ Apr 14, 2018 04:20 |
|
SurgicalOntologist posted:Any ideas on how to parse it? "Dear $vendor, your "xml" isn't. Please provide me with a version that can be understood by an actual XML parser"
|
# ¿ May 7, 2018 08:15 |
|
lifg posted:And what is the best and is it IBM Informix? Microsoft® SQL Server™ 2017
|
# ¿ Jul 10, 2018 20:45 |
|
Star War Sex Parrot posted:Just pick a random one from here IMO. Looks like a perfect opportunity to create a "real or not" game a la this.
|
# ¿ Jul 12, 2018 01:22 |
|
"READ UNCOMMITTED is cruise control for cool!" - our CTO.
|
# ¿ Jul 12, 2018 21:37 |
|
Magnetic North posted:This is sort of silly to ask, but I'm genuinely curious about what the general consensus thinks about this after a discussion today at work. Is Hungarian notation in C#/VIsual Studio worth doing? All the devs hate it and the bosses demand it. Like sUsername and dPrice and xXmlInput? Totally loving useless, and deeply offensive to all with a modicum of taste
|
# ¿ Aug 31, 2018 01:33 |
|
PierreTheMime posted:I still have to deal with SOAP occasionally and configuring WSDLs is a good reminder why most places don’t use it now. My God, imagine having data that you can validate against a schema! The horror!
|
# ¿ Nov 9, 2018 01:23 |
|
VS Code Live Share can do real time, read only collaborative editing. Do you need formatting, or is plain text ok?
|
# ¿ Nov 23, 2018 06:47 |
|
petit choux posted:Gimmick, heh. You have to be a gimmick poster to be so combatative and easily offended on such short notice and such little provocation. Are you even aware that you're posting in the Something Awful forums? Gently caress off. You will not be an issue going forward. lmao
|
# ¿ Nov 24, 2018 12:34 |
|
I'm starting to get the feeling that REST is like monads, but even fewer people actually understand what Fielding was getting at.
|
# ¿ Jan 10, 2019 09:55 |
|
Lordshmee posted:I am. As this page plainly states, that’s totally a thing that can happen: https://www.rabbitmq.com/confirms.html. Based on what Jabor said above, it feels like this is basically screaming into the void and hoping someone hears. Sure, it’ll usually be ok, but if I want to do order processing where money is involved that just isn’t good enough. I've worked in order processing where money is involved and I can assure you that this isn't true.
|
# ¿ Mar 19, 2019 09:10 |
|
Also, your ORM or whatever sucks.
|
# ¿ Mar 24, 2019 20:36 |
|
Plorkyeran posted:If you really want to confuse the gently caress out of everyone you can use filter-branch to reformat every commit, then merge the result into the original branch. That way you can view every commit as either the reformatted or original version, and no force pushes required. Oooh, do this
|
# ¿ Jun 5, 2019 05:55 |
|
My recommendation would be to find the person who created that XML, and beat them senseless with the nearest fire extinguisher. Have you tried registering the ShortDateFormat namespace in an XPathContext, a la this?
|
# ¿ Aug 8, 2019 02:18 |
|
monads are just the starting point on a long and nuanced journey though functional programming's 500,000 unique and subtly different mathematical objects. strap in.
|
# ¿ Dec 25, 2019 01:15 |
|
|
# ¿ May 4, 2024 04:32 |
|
Protocol7 posted:
code:
|
# ¿ May 5, 2020 00:48 |