Ivan Sagalaev
softwaremaniacs.org · Personal blog · on HN since 2008
Ivan Sagalaev, a developer and author of highlight.js, writes about Python, JavaScript, and Rust.
What HN saysHN links it mainly for highlight.js, which commenters praise for automatic syntax highlighting, plus his posts on ordered Python dicts and Rust ownership.
38HN people shared it
18linked it in comments
25stories submitted
1.0Kstory points
3 months agolast shared
2008people per year2026
Most-shared posts
- 1En8 people · first shared 2008
- 2Python dicts are now ordered3 people · 740 points · first shared 2020 · 436 comments on HN
- 3Why Rust's ownership/borrowing is hard3 people · 122 points · first shared 2016 · 64 comments on HN
- 4Showdown - javascript markdown2 people · 47 points · first shared 2011 · 7 comments on HN
- 5IJSON - a new SAX-like JSON parser for Python2 people · 2 points · first shared 2010 · discussion on HN
- 6Test2 people · first shared 2012
- 7Dicts ordered2 people · first shared 2022
- 8Completely unfair comparison of JavaScript syntax highlighters1 people · 48 points · first shared 2011 · 5 comments on HN
- 9The C++ Lands [png]1 people · 12 points · first shared 2016 · 2 comments on HN
- 10Scaling Django for a Russian search engine1 people · 11 points · first shared 2008 · 2 comments on HN
- 11Django as a micro-framework1 people · 11 points · first shared 2012 · discussion on HN
- 12Misconception about OSS Support1 people · 4 points · first shared 2019 · discussion on HN
- 13Google profile OpenID breakage1 people · 4 points · first shared 2011 · discussion on HN
- 14Rainbow.js — a new kid on the highlighters' block1 people · 4 points · first shared 2012 · discussion on HN
- 15When to use decorators in Python1 people · 3 points · first shared 2012 · discussion on HN
What HN people wrote when they linked it
hpaavola · 2013-07-31
For automatic syntax highlighting http://softwaremaniacs.org/soft/highlight/en/ is excellent.
carbocation · 2012-06-02
Impressive that it doesn't just take the best guess; it also informs you of its alternative hypotheses:
http://i.imgur.com/wITwa.png
Update:
Reading your blog post, I see that this is a wrapper around highlight.js, which is doing the language-guessing (including the second-best guess): http://softwaremaniacs.org/wiki/doku.php/highlight.js:api
dchest · 2010-04-23
Also worth checking out: highlight.js http://softwaremaniacs.org/soft/highlight/en/ (doesn't use jQuery and is modular).
simonw · 2022-08-21
I used to have the exact same problem with Python, until Python 3.7 made maintaining sort order a feature of the language: https://softwaremaniacs.org/blog/2020/02/05/dicts-ordered/
mehrdadn · 2018-12-23
Thanks, yeah, I was very careful to avoid claiming they're mutually exclusive. However, although I stopped trying to learn Rust back in 2016, unless it's changed its fundamentals radically (which I understand it hasn't), I'm not sure if it's really a counterexample here for expressiveness. Can you use different allocators for different vectors in the same function in Rust? Can you have custom move semantics for objects that might know about pointers to them? And does the compiler no longer complain about code that really should work just fine? [1] I understand the answers to most if not all such questions is still "no", at which point I stop believing it really has the same flexibility as C++ or the same ease of writing as Python, but would be happy to hear if things have changed.
[1] http://softwaremaniacs.org/blog/2016/02/12/ownership-borrowing-hard/en…
lallysingh · 2013-03-28
If you're going to put up source (or in this case, XML), may I suggest two things?
(1) Please indent.
(2) Consider syntax highlighting. http://softwaremaniacs.org/soft/highlight/en/ will do it for you.
lukeholder · 2012-07-31
Others people might find useful:
http://craig.is/making/rainbows (1.4kb)
http://softwaremaniacs.org/soft/highlight/en/
I prefer
http://pygments.appspot.com
obtu · 2012-07-12
highlight.js [1] does this, though by running highlighters rather than using some learning-based mechanism. It feels wasteful to run this on display rather than storage, though. SourceClassifier [2] also works, though with less languages. And here's [3] an implementation made with Bayes and Go.
[1] http://softwaremaniacs.org/soft/highlight/en/ http://softwaremaniacs.org/media/soft/highlight/test.html
[2] http://blog.chrislowis.co.uk/2009/01/04/identify-programming-languages…
[3] https://github.com/octplane/go-code-classifier
nithinbekal · 2012-06-02
The app depends on highlight.js which currently supports a limited set of languages, and unfortunately, Brainfuck isn't one of them.
http://softwaremaniacs.org/media/soft/highlight/test.html
I wonder what would happen to the accuracy of highlight.js highlightAuto method if more languages were to be supported. Highlight.js recognizes languages based on how many language constructs it can recognize. More languages = more overlap in language constructs, and therefore more likelihood of wrong matches.
jakubw · 2012-05-13
Some syntax highlighters, such as highlight.js [0], can do language detection and it works reasonably well with short snippets too.
[0] http://softwaremaniacs.org/soft/highlight/en/
isagalaev · 2012-03-27
piranha · 2012-03-26
So... why should I use this instead of http://softwaremaniacs.org/soft/highlight/en/ ?
podperson · 2012-01-04
This doesn't seem like a huge advance from showdown's demo page.
http://softwaremaniacs.org/playground/showdown-highlight/
bravura · 2011-05-26
In case you are interested in fast, streaming parsing of JSON, check out the yajl library (http://softwaremaniacs.org/blog/2010/09/18/ijson/en/)
In Python, I use the ijson bindings for yajl (http://softwaremaniacs.org/blog/2010/09/18/ijson/en/).
Here is a blog post demonstrating ijson: http://thechangelog.com/post/1169335384/ijson-parse-streams-of-json-in…
nirmal · 2009-02-01
It would be useful for Snipt to automatically detect the language being used. You could maybe do detection in a way similar to highlight.js http://softwaremaniacs.org/soft/highlight/en/
I could imagine quickly pasting in a code, the detector running and modifying the dropdown box accordingly. If it's correct I click "Snip It", if it's not then I adjust and then click "Snip It".
ii · 2008-11-11
MySQL master/slave replication is implemented:
http://softwaremaniacs.org/soft/mysql_replicated/en/
I'm not sure whether authors are here or not.
quelltext · 2024-10-03
This implementation was used from 3.6, right?
It's interesting that the idea mail mentions that nothing changes about the implementation (including order) but the memory layout. Which would imply insertion order was already preserved in older versions (not the case IIRC) or the idea underwent a few more changes that did in fact impact order.
EDIT: I couldn't quite find an answer but https://softwaremaniacs.org/blog/2020/02/05/dicts-ordered/ mentions the behavior happens since then because the implementation only tracks indices in the hash table itself and relies on maintaining entries separately in a second array that gets expanded in insertion order.
This would also seem straightforward but it raises a few questions such as how deletion is implemented (efficiently).
EDIT2: Okay, the talk (https://youtu.be/p33CVV29OG8) mentions they just leave holes until the next resize (at around 42:00).
Raymond also mentions there that his original idea didn't preserve ordering but happened due to an additional compacting optimization? Should probably watch the whole thing some time to get the history. Sounds like a fun talk.