HN user

nprescott

329 karma

nprescott.com

email: hackernews@nprescott.com

Posts6
Comments71
View on HN

This reminded me of a prior discussion[0] on bulk data generation in SQLite with Rust (vs Python vs PyPy) which previously led me to trying out two different techniques using just SQLite[1]. The approach here is so similar I tried my prior solution on the slowest VPS I have access to (1 vCPU core 2.4GHz, 512Mi, $2.50/month from vultr):

    sqlite> create table users (id blob primary key not null, created_at text not null, username text not null);
    sqlite> create unique index idx_users_on_id on users(id);
    sqlite> pragma journal_mode=wal;
    sqlite> .load '/tmp/uuid.c.so'
    sqlite> .timer on
    sqlite> insert into users(id, created_at, username)
            select uuid(), strftime('%Y-%m-%dT%H:%M:%fZ'), 'hello'
            from generate_series limit 100000;
    Run Time: real 1.159 user 0.572631 sys 0.442133
where the UUID extension comes from the SQLite authors[2] and generate_series is compiled into the SQLite CLI. It is possible further pragma-tweaking might eke out further performance but I feel like this representative of the no-optimization scenario I typically find myself in.

In the interest of finding where the bulk of the time is spent and on a hunch I tried swapping the UUID for plain auto-incrementing primary keys as well:

    sqlite> insert into users(created_at, username) select strftime('%Y-%m-%dT%H:%M:%fZ'), 'hello' from generate_series limit 100000;
    Run Time: real 0.142 user 0.068090 sys 0.025507
Clearly UUIDs are not free!

[0] https://news.ycombinator.com/item?id=27872575

[1] https://idle.nprescott.com/2021/bulk-data-generation-in-sqli...

[2] https://sqlite.org/src/file/ext/misc/uuid.c

PEP-508[0] explains the grammar for "extras":

Optional components of a distribution may be specified using the extras field:

  identifier_end = letterOrDigit | (('-' | '_' | '.' )* letterOrDigit)
  identifier    = letterOrDigit identifier_end*
  name          = identifier
  extras_list   = identifier (wsp* ',' wsp* identifier)*
  extras        = '[' wsp* extras_list? wsp* ']'
as well as explaining their behavior, albeit briefly:

Extras union in the dependencies they define with the dependencies of the distribution they are attached to.

The resolution on . is explained by the pip documentation[1]:

pip looks for packages in a number of places: on PyPI (if not disabled via --no-index), in the local filesystem, and in any additional repositories specified via --find-links or --index-url. There is no ordering in the locations that are searched. Rather they are all checked, and the “best” match for the requirements (in terms of version number - see PEP 440 for details) is selected.

[0] https://peps.python.org/pep-0508/#grammar

[1] https://pip.pypa.io/en/stable/cli/pip_install/#finding-packa...

ZFS has been on my list of things I should learn "some day" for a long time. I installed Fedora a while ago and ended up opted into Btrfs without really trying. I have been pleasantly surprised with it and have used it on 2 low-impact servers and 3 personal computers for about a year.

I don't tend to do anything very interesting to tax the filesystem so it is most important that things just work day to day and the less maintenance the better. I found a few use cases[0] for the copy-on-write abilities of Btrfs (built into systemd-nspawn) after switching but even that was a case where something I was previously doing was made instantly faster rather than working out a btrfs incantation.

I've recently been trying out a nifty backup tool[1] to try out a snapshot feature locally. This one did require two btrfs specific commands to restore a backup (`btrfs {send,receive}`). Once again though, this was an additional feature I decided to try out and not really required for my day to day. For me personally Btrfs has been easy to adopt because of how low-friction it has been to add and learn incrementally.

I've still not learned ZFS.

[0] https://idle.nprescott.com/2022/systemd-nspawn-and-btrfs.htm...

[1] https://digint.ch/btrbk/

As a specific example I routinely ran into forms that rendered like this (hidden scrollbars in three different browsers concealing content, though Safari rendered _just_ enough text that it might indicate there was more to see): https://nprescott.com/public/no-scroll-bars.png

In this specific case it is probably obvious enough that hey maybe I need to try scrolling randomly to find "baccalaureate" but the particular form that drove me to capture the above was littered with similar cases where it wasn't at all obvious. More than anything though the invisible scrollbars just meant I had to second guess every single form I ever submitted.

I have tried with both python 2.7.18 and python 3.8.6 using Emacs 27.1 and the excerpt works without issue for me; I have no configuration (emacs -Q) beyond pointing org to my virtual environment and allowing python evaluation in org-babel:

  (org-babel-do-load-languages 'org-babel-load-languages '((python . t)))
  (setq org-babel-python-command "~/mpl-venv/bin/python")
Are you perhaps on an outdated version of Emacs?

There have been a few different fixes around the "last line" return value over the years[0][1] but I can't really remember something like your example not working for me personally.

[0] https://lists.gnu.org/archive/html/emacs-orgmode/2017-11/msg...

[1] https://orgmode.org/list/87pnfdo88v.fsf@gmail.com/t/#u

The chromium bug ticketing system is all but unreadable to me. The OP ticket itself is closed and links to another instead, is there recent movement of note?

I know igalia[0] was working on this but I haven't been following the bug trackers directly. Their site and news section gives a better sense of the progress and includes small demonstrations with many of their updates.

0: https://mathml.igalia.com/

Text-Only Websites 6 years ago

I wrote up a few of my own thoughts[0] on moving away from writing markdown to writing HTML directly. At this point I have a small bit of code to wrap things into an <article> tag include a <header>, <footer> with links to a home page and include some boilerplate like <meta> tags. I don't think I've sacrificed anything in terms of best practices and actually gained a few things in writing more semantic HTML which I think aid in assistive technologies[1]. I actually hope people will "view page source" on my pages anymore -- a big part of getting to where I am has been testing against alternative browsers like eww and w3m.

[0] https://idle.nprescott.com/2020/why-bother-with-markdown.htm...

[1] https://sourcehut.org/blog/2020-05-27-accessibility-through-...

Text-Only Websites 6 years ago

The old mobile interface is entirely text, it removes the thumbnails present in the i. subdomain (also available with a trailing /.compact) -- the fact that there are so many different interfaces is a little baffling to me, but the text-only version is the only one I can stand to read: https://www.reddit.com/r/apljk/.mobile

I've been teaching myself J and dabbled in a few other APL-family languages before that (Klong and Dyalog's APL mostly). I don't have any specific goal in mind and have been doing it for fun more than anything -- I recently tried writing a minimal ray tracer[0] for example.

I've been surprised at how much I liked writing it. J can be derided for being a "puzzle language"[1], which isn't entirely unfair, but I've found the paradigm of array programming carries over into more widely used languages and libraries ("Iverson ghost"[2]).

I wouldn't bother learning to put it on a resume, I would try it out for fun.

[0] https://idle.nprescott.com/2020/ray-tracing-in-j.html

[1] https://prog21.dadgum.com/219.html

[2] https://analyzethedatanotthedrivel.org/2018/03/31/numpy-anot...

This is a good one. I've used this in the past in order to get onto IPv6-only networks as well. In my case I don't have IPv6 enabled on my home internet (thanks Verizon!) and I had a tiny virtual machine with Vultr, which at their lowest price point aren't offering IPv4 address space any more. Using a jump through another machine with both 4 and 6 address space saved me from having to cough up more money solely for a IPv4 address.

I've helped out with a few chapters! I'm actually very excited about it due to the relative scarcity of physical copies of the book.

While it isn't too active, the most recent activity was in the last week or so, I think all that remains are some figures and tables for a couple chapters, the index and proof-reading[0]. It's very nearly there due to a lot of work on Josef's part.

[0] https://github.com/Josefg/Scientific_FORTH/wiki

With the veritable flurry of state machine posts today[0,1] I thought I'd (re)submit[2] one of my favorite posts on finite state machines in Forth.

The specific example is of number input routine allows signed decimal numbers without power-of-10 exponents (fixed-point, in FORTRAN parlance) and comes from the author's book Scientific Forth, where a fuller example is used ... to determine whether a piece of text is a proper identifier (that is, the name of a variable, subroutine or function) according to the rules of FORTRAN.

I originally heard of Scientific Forth from Programming in the Twenty First Century where it made a list of "Five Memorable Books about Programming"[3] with the following description:

Dr. Noble demonstrates how he uses Forth for hardcore matrix work and, when he realizes that RPN notation isn't ideal in all circumstances, develops a translator from infix expressions to Forth.

[0] https://news.ycombinator.com/item?id=22746708

[1] https://news.ycombinator.com/item?id=22748785

[2]: previously 3, 6 and 8 years ago, never any comments: https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...

[3] https://prog21.dadgum.com/19.html

Not long ago there was a post about using English language instead of the J symbology[0] but the end result isn't meaningfully easier to understand because of all the prerequisite knowledge of how evaluation works etc., once you've worked that out most of the "line noise" has already sunk in. I think that's a big sticking point against creating a second "inflatable" notation - though there is always Nial[1]

Not entirely an answer to your question, but J provides introspection/help in a pretty direct way via two distinct means, the first is ;: ("words") which will show you the parse of a J phrase (here, a pretty direct translation of the algorithm in the article):

    ;:'+/s>(s,#v)$/:\:,/v&%"0 (0.5+i.s)'
    ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬──┬──┬─┬─┬─┬─┬─┬─┬─┬─┬───┬─┬──┬─┬─┐
    │+│/│s│>│(│s│,│#│v│)│$│/:│\:│,│/│v│&│%│"│0│(│0.5│+│i.│s│)│
    └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴──┴──┴─┴─┴─┴─┴─┴─┴─┴─┴───┴─┴──┴─┴─┘
Which shows the tokens of the phrase, which can be helpful if you are unsure of where a symbol or diacritic is being used. Inside the J IDE you can get context sensitive help by pressing Ctrl-F1 on a symbol, if you were interested in /: for example, you are directly linked here[2].

I am unaware of a similar tool in K, which should not be taken to mean it doesn't or can't exist. One of the reasons I'm interested in J has been the tooling and documentation available.

[0] https://wjmn.github.io/posts/j-can-look-like-apl/

[1] https://tangentstorm.github.io/nial/intro.ndf.html

[2] https://code.jsoftware.com/wiki/Vocabulary/slashco

Always a pleasant surprise to find niche or mundane uses of array languages. I really appreciate the explication because it made it possible for me to follow along in J - there's vanishingly little material to patiently explain bits like the "grade-up grade-down to return rank" that permeates so much APL-style code.

I'm similarly pleased to have found a correspondence from K's ' (also present in Klong) to J, where it ends up being "0 in this instance.

    r=. v&%"0 (0.5+i. s)
    +/s>($r)$/:\:,/r

If you are looking for a full course this one isn't bad: Embedded Systems Shape the World[0] it does hew pretty close to platform specifics (Windows/Keil/TI Launchpad) which can be good for specifics and not good for holistic understanding.

I have had a lot of fun following Ben Eater's[1] projects, which aren't always embedded-specific (sometimes they're TTL, sometimes Arduino) but are excellent for understanding concepts deeply.

I tend to learn best with a specific project that can grow or morph as my interest or experience dictates. You might find something to build with an Arduino, using the toolchain/IDE/libraries, get it working and then start stripping out libraries for your own implementations, or getting a toolchain of your own to cross-compile and flash.

[0] http://www.edx.org/course/embedded-systems-shape-the-world-m...

[1] https://eater.net/

A People’s History of Computing in the United States - Joy Lisi Rankin

Joy Rankin draws on detailed records to explore how users exchanged messages, programmed music and poems, fostered communities, and developed computer games like The Oregon Trail. These unsung pioneers helped shape our digital world, just as much as the inventors, garage hobbyists, and eccentric billionaires of Palo Alto.

Fuzzy Logic 6 years ago

Just earlier today I was reading through a lab available as part of the J programming language distribution covering fuzzy logic.

I'm sure I've read the Wikipedia page for fuzzy logic but the lab really helped to drive home some of the concepts. Additionally, it was a very cool application for J, which is often derided as being a strictly numerical tool. The lab describes itself as:

... how to create a linguistic inference system using fuzzy sets. Such systems of linguistic variables are referred to as fuzzy logic systems.

First we describe the concept of membership with nonfuzzy and fuzzy sets. Then we tackle fuzzy membership for scalar and array fuzzy sets, and later inference with array sets.

It really is better to work through the lab within the J system[0], but for those without it is browse-able in plain text online[1]

[0]: Help -> Studio -> Labs -> General Interest / Fuzzy Logic

[1] https://github.com/jsoftware/labs_labs/blob/master/general/f...

I read the Klong book [0] and for me it "clicked" in a way that J/K never had. The author did a really nice job paring down the language and cleaning up some of the ambiguities in a way that made it approachable. Also, after reading it I've found APL and J more approachable, which is encouraging.

If you'll forgive the style, I took a swing at implementing k-means clustering in Klong a few months ago [1]. While I did find a few slow-downs with a modestly sized data set (Fisher's iris data), I think Klong is built on a Forth-like VM using the core of a scheme implementation (all of which the author wrote!). It wasn't slow enough to really bother me, as I was more interested in learning about array languages and algorithms.

I'm a fan of Klong -- it's just fun.

[0] http://www.t3x.org/klong/book.html

[1] https://idle.nprescott.com/2019/k-means-clustering-in-klong....

As far as I know, this is a peculiarity of APL resulting from Iverson's stance on the language as a "tool for thought"[0]. The best explanation I've heard is that "binary" is most apt to number systems (or matrices!) - but a "verb" in APL is not binary, it is dyadic. The language of verbs and nouns is a similar reflection of the ideas that APL is primarily a _language_ (like English, more so than Fortran) to express mathematics succinctly (with a minimum of ambiguity or syntax).

This is (to me) even more apparent in his next language, J; where he sought to "correct" deficiencies in APL and further expanded the "language" to include things like "gerunds"[1] more explicitly, which are nominally (as defined in an English dictionary):

a noun formed from a verb, denoting an action or state

Which may be summarized somewhat unsatisfactorily as: "Because Ken said so".

[0] https://www.jsoftware.com/papers/tot.htm

[1] https://code.jsoftware.com/wiki/Vocabulary/GerundsAndAtomicR...

While I haven't used DSLabs, I did suffer a similar bit of indecision recently trying to decide between Alloy[0] and TLA+[1]. In the end I don't think there is a correct answer, and there are probably more similarities than differences between any two specification languages. In my case I read both Software Abstractions and Specifying Systems (part 1 at least). Each took about a week; which is probably less time than I spent trying to decide between them.

I happen to agree with the argument made by proponents of both TLA+ and Alloy that model checking and specification is better accomplished when detached from an implementation language, but I think you would benefit most from simply starting with one of them (DSLabs or TLA+) and decide later if you'd like to learn the other.

[0] http://alloytools.org/

[1] https://lamport.azurewebsites.net/tla/tla.html

I was similarly stumped, specifically regarding discrete mathematics not too long ago. I was interested in reading Lamport's Specifying Systems[0] but felt I lacked some requisite background knowledge[1]. I ended up picking up Stavely's Programming and Mathematical Thinking[2] which I enjoyed.

While I would recommend either as a primer into discrete math - do you have a specific subset that you're interested in? That might make suggestions more pertinent to your interests.

[0] https://lamport.azurewebsites.net/tla/book.html

[1]: I think, in retrospect, that Specifying Systems actually stands on its own pretty well and doesn't require supplementary material when paired with the video course.

[2]: It is subtitled "A Gentle Introduction to Discrete Math Featuring Python" and it is _very_ gentle, but I'm also glad to have read it, it did wonders for giving me a kind of reference into math terms from programming (which I already knew).

Depending on how involved the language you are interpreting is, you might get by having only read chapter 6 of The AWK Programming Language[0] (linked in the article), which covers "Little Languages", including what it terms an assembler and interpreter.

If you are interested in more depth, either Crafting Interpreters[1] (mentioned in the article) or Writing an Interpreter in Go[2] looks promising. I've read more of Crafting Interpreters and really enjoy it, though it isn't yet finished. One of the aspects I really enjoy is that the language is implemented and re-implemented in different languages to gradually introduce lower level concepts.

Finally, this one may be a little more "out there" than what you are looking for, but if you are interested in designing a language more than the plumbing of an interpreter Beautiful Racket[3] is really good.

caveat: not an expert

[0] https://ia802309.us.archive.org/25/items/pdfy-MgN0H1joIoDVoI...

[1] http://www.craftinginterpreters.com/

[2] https://interpreterbook.com/

[3] https://beautifulracket.com/

Really interesting much more consumable than most census data infographics I've seen. Can you speak to what some of the "private sources" of data are?

On a more technical note, I can't get any reports to render in Firefox 56 (working fine in Chrome). Also, it seems Angular is running in development mode on the live site?