Spyke

Replies

Comment on

Cyclomatic caps: the limit is the lever, not the warning

Reply in thread

Humans are very good at pattern recognition. Cyclomatic complexity ignores that, so code that is easy for a human to read can get a bad score. E.g. handling Win API messages:

    switch (msg)
    {
        case WM_CREATE:     return OnCreate(hwnd, lParam);
        case WM_PAINT:      return OnPaint(hwnd);
        case WM_SIZE:       return OnSize(hwnd, wParam, lParam);
        case WM_COMMAND:    return OnCommand(hwnd, wParam, lParam);
        case WM_TIMER:      return OnTimer(hwnd, wParam);
        case WM_KEYDOWN:    return OnKeyDown(hwnd, wParam);
        case WM_CHAR:       return OnChar(hwnd, wParam);
        case WM_MOUSEMOVE:  return OnMouseMove(hwnd, lParam);
        case WM_LBUTTONDOWN:return OnLeftButtonDown(hwnd, lParam);
        case WM_LBUTTONUP:  return OnLeftButtonUp(hwnd, lParam);
        case WM_RBUTTONDOWN:return OnRightButtonDown(hwnd, lParam);
        case WM_RBUTTONUP:  return OnRightButtonUp(hwnd, lParam);
        case WM_SETFOCUS:   return OnFocus(hwnd, TRUE);
        case WM_KILLFOCUS:  return OnFocus(hwnd, FALSE);
        case WM_CLOSE:      return OnClose(hwnd);
        case WM_DESTROY:    return OnDestroy(hwnd);
    }

Complexity score: 17. Easy to read and verify? Yes.

LRESULT OnMouseMove(HWND hwnd, LPARAM pos)
{
    if (tracking == dragging != selecting &&
        (!cancelled == (buttons & MK_LBUTTON)))
        return UpdateInteraction(hwnd, pos);

    return 0;
}

Complexity score: 3. Easy to read and verify? No.

Comment on

How screwed am I?

Reply in thread

Yeah. Everything depends on the complexity of the product, but it's just as likely that it's the new CTO and his team that gets canned when they get bogged down in the details and the costs start racking up.

Comment on

While reviewing a PR, you find some piece of code that seems to work perfectly well, but some functions are written in a style that you don't particularly favor. What do you do?

Not enough information.

New team member? Show them the style guide and where it doesn't match.

Is the style guidelines consistently followed elsewhere? If not, I'd just approve it.

Do I have a good relationship with the other developer, and can they handle criticism? If not, I probably would not want to be the one reviewing it, but if I did I would likely let it go and fix it later. Fight more important battles.

Otherwise, how important is that piece of code? I'd immediately approve a one-off script, but if it's an core piece of code, I assume the dev missed it and point it out. Happens to everyone.

etc. etc.

Comment on

Backdoor slips into popular code library, drains ~$155k from digital wallets

Reply in thread

Earlier today, a publish-access account was compromised for @solana/web3.js, a JavaScript library that is commonly used by Solana dapps. This allowed an attacker to publish unauthorized and malicious packages that were modified, allowing them to steal private key material and drain funds from dapps, like bots, that handle private keys directly. This issue should not affect non-custodial wallets, as they generally do not expose private keys during transactions. This is not an issue with the Solana protocol itself, but with a specific JavaScript client library and only appears to affect projects that directly handle private keys and that updated within the window of 3:20pm UTC and 8:25pm UTC on Tuesday, December 2, 2024.

These two unauthorized versions (1.95.6 and 1.95.7) were caught within hours and have since been unpublished.

We are asking all Solana app developers to upgrade to version 1.95.8. Developers pinned to latest should also upgrade to 1.95.8.

Developers that suspect they might be compromised should rotate any suspect authority keys, including multisigs, program authorities, server keypairs, and so on.

https://github.com/solana-labs/solana-web3.js/releases/tag/v1.95.8

news

Comment on

Florida set to become second state to ban fluoride in public water

Reply in thread

The mean IQ level was more in the region with medium fluoride concentration in drinking water (56.68) compared to areas with low fluoride concentration (41.03) and high fluoride concentration (31.59).

So according to that study, having "medium levels" (1.2-2ppm) of fluoride is much better. I checked three random water reports in Florida which had 0.5, 0.7 and 0.9 ppm.

Comment on

What's an aspect of life that's currently done privately that you think should be communalized?

The US started using mailboxes 14 years after the UK

In 1849, the Royal Mail first encouraged people to install letterboxes to facilitate the delivery of mail. Before then, letterboxes of a similar design had been installed in the doors and walls of post offices for people to drop off outgoing mail.

In 1863, with the creation of Free City Delivery, the US Post Office Department began delivering mail to home addresses.