Better HN
topnewbestaskshowjobs
Log inSign up

zeroimpl

621 karma · joined Jan 11, 2018 (8y ago) · 450 submissions

Submissions

comment 6y ago · link · parent

In general if you query a table twice, the query planner will visit that table twice. So DISTINCT ON is almost always more efficient.

The main exception I’ve seen is when using it in a view, if you try to filter the results of the view, it usually can’t optimize a DISTINCT ON, but sometimes can for GROUP BY (though that might have improved on newer versions)

comment 6y ago · link · parent

I’ve created a custom aggregate in Postgres that lets you essentially get the same result as what MySQL does:

    select a, last(b), last(c) from table group by a
As it’s name implies, returns the last value that the aggregate encountered for the group. You can add an “order by” within the parenthesis to make it deterministic.

comment 6y ago · link · parent

It can represent less than 0.1% of all 64-bit ints. That doesn’t seem like most to me.

comment 6y ago · link · parent

Sounds interesting, but the website has very little details on it so I can't really evaluate how well it would work for me.

comment 6y ago · link · parent

The PHP documentation refers to them as "associative arrays", which is technically correct, but I agree I'm not sure how they could have conflated these concepts so badly.

comment 6y ago · link · parent

Would you expect it to do that if somebody wrote the following?

    $id = 12835151;
    $arr[$id] = Get_thing_with_id( $id );

comment 6y ago · link · parent

An oracle that doesn't always tell the truth? That seems like an odd thing for an algorithm to have to deal with.

comment 6y ago · link · parent

To me it also seems like it should be:

    (elem (elem input "countries") 0)

comment 6y ago · link · parent

Yeah, it seems the metaphor is about incorrectly performing a depth-first-search, when breadth-first-search is the right algorithm in general to find the optimal solution.

comment 6y ago · link · parent

As a user, if I have a key and an encrypted file, aside from actually decrypting the file, all I care about is ensuring that the software can confirm that the encrypted file was encrypted using the same key. Why should this be complicated?

comment 7y ago · link · parent

Indeed. Yet this port city with almost no land ruled over quite a significant empire for about 1000 years. I think it’s had a good run.

comment 7y ago · link · parent

Validation better be done by the parser. Otherwise, subtle differences between the validator and the parser can lead to security flaws. Your solution is to make sure you use a good parser.

comment 7y ago · link · parent

You'll need a data structure to store the results to return to the caller. This data structure by definition cannot be the call stack. So using a call stack is technically redundant.

comment 7y ago · link · parent

Likely due to using the older version of bash preinstalled on Mac. Installing a new one and it should be virtually identical.

comment 7y ago · link · parent

The new "Content Caching" option in System Preferences is news to me. Probably a good feature if you have multiple identical iOS devices. I wonder how much sharing there is between different models, or even iPhone vs iPad.

comment 7y ago · link · parent

If WebAssembly is running in the browser, it’s not calling into C/C++ modules. If WebAssembly isn’t running in the browser, it doesn’t need to be sandboxed. Thus I don’t think we need to be concerned over WASI sand boxing in the same way as applets.

comment 7y ago · link · parent

Something like this would do the same, if somebody implemented a tool called jsed:

    jsed '
        Object.fromEntries( 
            $("Directory").map( 
                x => [ 
                    x.name + " has children", 
                    x.children && x.children.length != 0
                ]
            )
        )'  
Interestingly enough there is already a tool called jsed which seems to kind of do this... https://www.npmjs.com/package/jsed

Edit: Note the jQuery part of it is for advanced cases like searching for specific nodes in the tree, then navigating back up to the parent. Basically the cases like "<Work>[-1][children]" from the jtc guide, I would write as: '$("Work").parent().find("children")'

comment 7y ago · link · parent

Yeah I was surprised recently to find out that the whole thing is basically maintained by one person. Since it's an essential tool for me, I contributed a few minor improvements for some usability things that were irritating me. Thanks George!

comment 7y ago · link · parent

I’d really like a CLI tool which solves this problem using a syntax I already know. I struggle with jq because I use it quite infrequently.

IMO the ideal solution is something using pure JavaScript syntax, possibly with a library resembling jQuery for tree traversal.

comment 7y ago · link · parent

In particular, it sounds like the same or similar bug also existed in the bootrom. So Apple patched iBoot but can't patch the bootrom.

comment 7y ago · link · parent

I suppose you'd rather they'd have named the headers "Session-Id" and "Set-Session-Id"?

comment 7y ago · link · parent

I'm not a fan of how they hacked the scrollbar though

comment 7y ago · link · parent

I’ve generally found that a context switch from one programming task to another can be pretty easy (even if totally unrelated), but switching to something non-programming related is often much more painful.

comment 7y ago · link · parent

Ah so Strict is super strict, whereas Lax is still stricter than the current default.

Lax seems like it should have been named something else, like Partial or Moderate.

comment 7y ago · link · parent

Why is the default lax instead of strict?

comment 7y ago · link · parent

Seems like if you tried to use transactions, you'd have the same problem?

comment 7y ago · link · parent

> It will also be interesting to see what happens when JITted extension languages like this start to meet in the middle with postgres' own nascent JITted query plan support as it grows...

Does Postgres actively measure the performance of stored procedures and use that for future cost estimates? I thought most of these timing stats are off by default.

comment 7y ago · link · parent

I think this article unnecessarily conflates the pre-rendering techniques used for JS-heavy websites with what I would call a static website build/compile process.

Using wget to compile your website is a clever idea. But it won't work if your website uses JS to generate links, so I wouldn't call it pre-rendering (since there better not be any post-rendering)

comment 7y ago · link · parent

If you are using a web framework designed for dynamic processing - think something like Java servlets/JSP, or in the authors case Go - it's often non-trivial to find/implement a render_to_page function, let alone enumerate all possible pages.

comment 7y ago · link · parent

I just want mainstream/built-in JSON parsers to be able to ignore comments and trailing commas. What ever happened to lax parsing?
1
1112131415