Skip to main content

New answers tagged

0 votes

Remove HTML block in Python

from bs4 import BeautifulSoup HTML = '''<html> <head> ... </head> <body> <div> ... </div> </...
Benjamin Loison's user avatar
2 votes

How can I take an integer string modulo 4 without overflowing u128?

Per J_H's answer, you can do this just by taking the last two digits mod 4. For any decimal number [A...B]CD: mod([A...B]CD, 4) = mod(100[A...B]+CD, 4) = mod(0+CD, 4) = mod(CD, 4) Thus, you can ...
Anerdw's user avatar
  • 3,279
0 votes

Handle multiple ORC OBR repetitions on OML_O33 message as OML_O33_ORDER instances

One solution might be to set the parser in the so-called "non-greedy" mode: https://hapifhir.github.io/hapi-hl7v2/base/apidocs/ca/uhn/hl7v2/parser/ParserConfiguration.html#setNonGreedyMode-...
colouredmirrorball's user avatar
2 votes

How can I take an integer string modulo 4 without overflowing u128?

@phuclv observes that to get the remainder when dividing by 4 you just need to take the remainder of the last 2 digits. It works regardless of the size, no need to parse the number at all. In fact ...
J_H's user avatar
  • 21.6k
2 votes

How to check if a date is after today java

tl;dr Use java.time, never legacy Date/Calendar. LocalDate // Represent a date-only value (year-month-day). .parse( "2016/04/26".replace( "/" , &...
Basil Bourque's user avatar
0 votes

How to exclude a tag from an html file with xidel?

user37421's answer helped me understand how to exclude certain tags. Here is a summary of my findings: $ echo '<ab>12<cd>9876</cd>34</ab>' | xidel -e '/' 12987634 $ echo '<...
Signor Pizza's user avatar
0 votes

Excel VBA - parse JSON string and set cell values based on key:values

This code can process the sample data Sub processjson() inpstring = Range("H1") i = 1 colcount = 1 rowcnt = 1 Do While InStr(i, inpstring, ":") <> 0 If colcount = 5 Then ...
Black cat's user avatar
  • 7,671
Best practices
1 vote
0 replies
0 views

Optimization of an OSM-file parser

Why do you ignore the existing XML parsers and implement your own? For processing large XML files you can use streaming XML parsers like SAX or StAX.
Robert's user avatar
  • 43.6k
Best practices
0 votes
0 replies
0 views

Optimization of an OSM-file parser

Did you notice that this question is an "open-ended" question? That means that the question limitations are more relaxed. So considering that this is an open-ended question, do you still ...
Abra's user avatar
  • 21k
Best practices
0 votes
0 replies
0 views

Optimization of an OSM-file parser

First off: Why do you "need to" write an OSM parser? There are plenty out there. Aside from that, this question is probably off-topic for Stack Overflow: You either, if you have a specific ...
RoToRa's user avatar
  • 38.6k
Best practices
5 votes
0 replies
0 views

Optimization of an OSM-file parser

One homemade and the other using java own XML-parser. Unfortunately the former is invalid. You can't parse XML line-wise
g00se's user avatar
  • 4,254
Advice
0 votes
0 replies
0 views

How do I fix the string limit of my code?

brand will never be equal to 0
jackal's user avatar
  • 29.2k
0 votes

Why can't a compiler have a "shift/shift" conflict?

In LR(0) parsers we use Pushdown automaton and to drive the decision as to whether shift or reduce we create a characteristic automaton which will be non-deterministic from the viable or admissible ...
Asadbek Sindarov's user avatar
Advice
1 vote
0 replies
0 views

How do I fix the string limit of my code?

You didn't add URL so we can't test it. Maybe page gives only 501 strings (maybe it uses JavaScript to load more data but requests, BeautifulSoup can't run Javascript - and it may need to use Selenium ...
furas's user avatar
  • 149k
Advice
0 votes
0 replies
0 views

How do I fix the string limit of my code?

by the way: input() doesn't need print() brand = input("brand: ") limit = int(input("limit: "))
furas's user avatar
  • 149k
2 votes

Parsing /proc/meminfo using read() in C gives incorrect RAM values

There are enough comments concerning your approach and architecture. Therefore this answer just pinpoints the actual error. Condensed to the relevant structure, your program looks like this: int main(...
the busybee's user avatar
  • 13.4k
Advice
1 vote
0 replies
0 views

How do I fix the string limit of my code?

What is len(hidden_inputs)? It seems like the most obvious cause is there's only 501 inputs to read.
Carcigenicate's user avatar
2 votes

Parsing /proc/meminfo using read() in C gives incorrect RAM values

Here's code from my personal library. It might give you some ideas for your implementation. One special feature is the switch that reacts to the length of the keywords. This optimization is intended ...
Wiimm's user avatar
  • 3,839
2 votes
Accepted

xml2lua gives me multiple root nodes

Before reusing handle.root, you have to claim that the old node tree will not be used: handler.root = nil The code can be as follows: local function count_root_nodes() local parser = xml2lua....
Stas Simonov's user avatar
  • 1,142

Top 50 recent answers are included