Hacker Newsnew | past | comments | ask | show | jobs | submit | fooofw's commentslogin

I believe this might be slightly imprecise also.

The traceback is actually shown based on the last-thrown exception (that thrown from the finally in this example), but includes the previous "chained exceptions" and prints them first. From CPython docs [1]:

> When raising a new exception while another exception is already being handled, the new exception’s __context__ attribute is automatically set to the handled exception. An exception may be handled when an except or finally clause, or a with statement, is used. [...] The default traceback display code shows these chained exceptions in addition to the traceback for the exception itself. [...] In either case, the exception itself is always shown after any chained exceptions so that the final line of the traceback always shows the last exception that was raised.

So, in practice, you will see both tracebacks. However, if you, say, just catch the exception with a generic "except Exception" or whatever and log it without "__context__", you will miss the firstly thrown exception.

[1]: https://docs.python.org/3.14/library/exceptions.html#excepti...


Thanks for pointing that out. I was thinking about the traceback message and hadn't thought about __context__ or __traceback__.


My version of Firefox (146.0 on Debian) has exactly this. If I select a sentence and right-click, I get the menu item "Translate selection to <LANGUAGE>". In the resulting box, I can change the language pair - but the defaults that I have seen were also reasonable.

https://support.mozilla.org/en-US/kb/website-translation has the text: "A new Translate selection feature has been added starting in Firefox version 128, that enables you to highlight and translate selected text."

Edit: Sorry, I misread the comment to say that there was no such menu item. Edited to reflect this.


The tokenization can represent uncommon words with multiple tokens. Inputting your example on https://platform.openai.com/tokenizer (GPT-4o) gives me (tokens separated by "|"):

    lower|case|un|se|parated|name


It's kind of fun to compare this formulation with the seemingly contradictory official arXiv argument for submitting the TeX source [1]:

> 1. TeX has many advantages that make it ideal as a format for the archives: It is plain text, it is compact, it is freely available for all platforms, it produces extremely high-quality output, and it retains contextual information.

> 2. It is thus more likely to be a good source from which to generate newer formats, e.g., HTML, MathML, various ePub formats, etc. [...]

Not that I disagree with the effort and it surely is a unique challenge to, at scale, convert the Turing complete macro language TeX to something other than PDF. And, at the same time, the task would be monumentally more difficult if only the generated PDFs were available. So both are right at the same time.

[1] https://info.arxiv.org/help/faq/whytex.html#contextual


Working with both at the same time makes their strengths and pitfalls shine. It's like that dual-boot computer where you're constantly in the wrong OS.

HTML has better separation of concerns than latex. Latex does typesetting a lot better than html. HTML layout can differ wildly in the same document. Latex documents are easier to layout in the first place.

...etc...


That would (mostly if not always) work in the sense of reproducing the layout of the pages, but would defeat the purpose of preserving the semantic information present in the TeX file (what is a heading, a reference and to what, a specific math environment, etc.) which is AFAIK already mostly dropped on conversion to PDF by the latex compiler.


Couldn't you write a TeX renderer that emitted HTML (or RST, or Markdown, or whatever) with SVG for the equations?


I think this project is based on LaTeXML (https://math.nist.gov/~BMiller/LaTeXML/) which is exactly that (except for the SVG part)


Why have you failed though? Is the point to try to deceive people to think that XKCD actually published something else? Why not modify the xkcd one without hinding the fact that you modified it?


that fact you think it looks so good that it deceives is a point for ai.

the point is to make a quality meme fast. the guy he replied to appreciated it.

any fan of xkcd knows the original.


What defines private sites, I wonder – beyond "such as local IP addresses like 192.168.0.1, single-label hostnames, and shortlinks like intranet/"?


Non-unique hostnames, which are RFC 1918 space, single-label hostnames, and addresses assigned to mDNS (.local).


Single label hostnames had an issue where it’s hard to type them into a browser.

How to fix this?


Usually, completing the domain name by adding the final period will do the job. Instead of entering myprinter into the address bar, try myprinter. so your DNS server doesn't try to resolve myprinter, myprinter.domain, myprinter.domain.tld, and whatever other search domains have been configured. A real, fully-qualified domain ends in a period, though most tools will happily let you avoid that final period.

Alternatively, .local domains will work for mDNS-capable devices (and non-mDNS-capable devices if you like to risk things breaking randomly), and the .internal TLD has been reserved so .internal domains should also work for local addresses.


Add a /, e.g. `shortname/`


This made me think of Microsoft's MarkItDown tool/library [1] which seems to have quite the overlap in supported file formats [2,3] and conversion options [4]. I couldn't find any reference to the library on the website, so it may be useful to know about.

[1] https://github.com/microsoft/markitdown

[2] https://tomd.io/#supported-extensions

[3] https://github.com/microsoft/markitdown/tree/main/packages/m...

[4] https://github.com/microsoft/markitdown/blob/8a9d8f15936b206...


Then you've just traded that for lock-in to Cursor, no?


pdfjam [1] uses a LaTeX package under the hood, is included with the TeX Live distribution and acts as a wrapper for a LaTeX package. With this, I believe your example would be:

    pdfjam PDF_A.pdf '2-3' PDF_B.pdf '7-23' --outfile joined.pdf
I'll admit that I had to look it up but that only took about 3 minutes (it's an example in the readme).

[1] https://github.com/pdfjam/pdfjam


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: