News for hackers. Stuff that matters.

pksadiq

Re:CLI tool to insert spacers when command output stops on Monday December 23, 2024 @08:14PM (#42498916)
I wrote a similar tool[0] a few days back because I wanted a bit more accuracy with timestamp and `ts` occasionally had a deviation of several 100ms. If I new this, and is accurate enough for me, I might not have written one.

[0] https://www.sadiqpk.org/projects/tis

Re:Wikipedia switches to CC BY-SA 4.0 license on Monday July 03, 2023 @08:38AM (#36572055)
This specific change shall excite many as CC BY-SA 4.0 is one way GPLv3 compatible, but CC BY-SA 3.0 is not. Which means that free software developers can now embedded many Wikimedia contents in their GPLv3 applications. This seems not mentioned in the blog post though.
Re:Fast midpoint between two integers without overflow on Wednesday December 07, 2022 @11:26AM (#33896288)
> since the decimal average is -0.5

The C standard says: When integers are divided, the result of the / operator is the algebraic quotient with any fractional part discarded (This is often called ‘‘truncation toward zero’’).

So it should be 0 (as per C standard, not sure what C++ standard says)

Re:Fast midpoint between two integers without overflow on Wednesday December 07, 2022 @10:25AM (#33895396)
> x/2 + y/2 + (x & y & 0x01)

This returns -1 for x = INT_MIN and y = INT_MAX were the answer should be 0 (for an example). so not a correct solution

Re:Fast midpoint between two integers without overflow on Wednesday December 07, 2022 @09:48AM (#33894901)

  int mid(int x, int y) {
    return (x/2 + y/2) + (1 & x & y);
  }
would be a more readable solution

edit: Actually, this fails on mid(INT_MIN, INT_MAX) and possibly other mixed sign values (returns: -1, expected: 0 (or -1 is okay?), where the precise answer is -0.5)

more edit: The C standard says: When integers are divided, the result of the / operator is the algebraic quotient with any fractional part discarded (This is often called ‘‘truncation toward zero’’).

So -1/2 should be 0.

Tell HN: How to close your LinkedIn account

In the past, I have tried deleting my LinkedIn account several times. Every single time, in the last step, the final deletion button was inactive, and no reason given for why it's so. The Internet wasn't helping my either.So today, I tried once again: But this time, I used my browser inspector, removed 'disabled="true"' for the "Done" button, then clicked it.voilà! LinkedIn said: "We’ve closed...

( Read More... | 2 comments | 2 points | on HN )
Re:Learn Enough C to Survive on Monday October 17, 2022 @01:19AM (#33230023)
> I still occasionally hop on CodeWars just to do write some algorithms in NASM using the skills I learned from this book.

> https://download-mirror.savannah.gnu.org/releases/pgubook/Pr...

There is an updated version of the book from the author: "Programming Under the Hood" or "Learn to Program with Assembly". See[0]

[0] https://github.com/johnnyb/programming_under_the_hood

> Why is this even a thing? Maybe I should just go back to buying everything with cash, it's impossible to keep up with all the crap we need to disable or hack around

And some agencies may be more interested in these exclusion databases. So I don't think there is any way to get out of this maze. When you sign up to exclude from a list, you get included in many other.

Re:The State of Linux Debuggers on Sunday December 13, 2020 @10:54AM (#25407368)
And it's much better when used with gdb-many-windows and speedbar
Re:GTK+ 4 checklist (2019) on Wednesday April 08, 2020 @11:10AM (#22813625)
Note: GTK+ has been renamed to GTK about a year back[0]. The title may better be updated.

[0] https://mail.gnome.org/archives/gtk-devel-list/2019-February...

Re:Encoding your WiFi access point password into a QR code on Sunday December 29, 2019 @04:31AM (#21905029)
There is a Merge Request to support QR code for hotspot created in GNOME control center: https://gitlab.gnome.org/GNOME/gnome-control-center/merge_re... Hopefully, shall be available in next release
Re:C, what the fuck??! on Sunday December 15, 2019 @07:24AM (#21795880)
> What is the probability of something like this appearing in a normal program written by somebody who is unaware of trigraphs?

A good compiler (eg: gcc) will warn if any token is interpreted as a trigraph

Edit: digraph works a bit differently [0]

[0] https://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C

Re:Efficient string copying and concatenation in C on Thursday September 12, 2019 @09:26PM (#20958263)
> The committee chose to adopt memccpy but rejected the remaining proposals.

Is that the case? Reading the updated standard draft[0] they also included strdup and strndup. May be they rejected first, then chose to add later.

[0] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2385.pdf

> Ultimately if you're okay with running AGPL code you're okay with running Mattermost. Which means as long as you don't intend to fork it and not share your changes you should be fine.

That's not how [LA]GPL works. You are free to fork, and not share the changes. The modified source code can be provided only to the people whom you gave the binary (Edit: AGPL has bit more terms, as said in comment below), and you can make it private to the rest of the world (though you can't add additional restrictions).

As Mattermost is dual licensed under AGPL, anyone who uses it under the terms of AGPL can live safe as long as they obey AGPL.

Software pieces using GPL licenses can't add additional restrictions to the software, but of course authors are free to dual license under different terms.

Say for example some one can specify the following for their project: "We provides the project under the terms of MIT for you to modify and run for your own purposes." This might look a harmless statement, but it could mean something very different and may be intentionally written, that essentially makes it non-free. GPL doesn't allow such additional clauses.

Disclosure: IANAL. So I don't know how/if it works in court

The mattermost-server licensing[0] is somewhat skeptic:

Mattermost Licensing

SOFTWARE LICENSING

You are licensed to use compiled versions of the Mattermost platform produced by Mattermost, Inc. under an MIT LICENSE

- See MIT-COMPILED-LICENSE.md included in compiled versions for details

You may be licensed to use source code to create compiled versions not produced by Mattermost, Inc. in one of two ways:

1. Under the Free Software Foundation’s GNU AGPL v.3.0, subject to the exceptions outlined in this policy; or

2. Under a commercial license available from Mattermost, Inc. by contacting [email protected]

You are licensed to use the source code in Admin Tools and Configuration Files (templates/, config/default.json, model/, plugin/ and all subdirectories thereof) under the Apache License v2.0.

So that means, only the binary provided by Mattermost is MIT, not its source code, the usage of 'MIT' in their website sounds deceiving.

[0] https://github.com/mattermost/mattermost-server/blob/master/...

Re:So you think you know C? (2016) on Friday July 05, 2019 @10:17PM (#20367326)
> The code is undefined, but "I don't know." is still the correct answer for what happens to the variable.

Well, then a better choice would be "I can't know."

Re:So you think you know C? (2016) on Friday July 05, 2019 @09:58PM (#20367256)
There are a few problems with the questionnaire. "I don't know" is pretty generic choice to be given/choosen.

Say for example, in question 5, the statement "return i++ + ++i;" is undefined, because the value of i is read and modified twice in a single sequence point (and of course, the order of addition is unspecified), which is not allowed in C. So the answer is "Undefined." (The explanation given in the page not accurate enough in terms of C)

And for question 1, the code is valid, but the result is not strictly defined. It depends on the implementation. So the answer is "Implementation defined."

The usage of "main()" hurts me, the strictly conforming way is to write it as "int main(void)" (or similar)

I feel like the questionnaire piss off people who really knows C.

> ... security comes first, whatever else...

Really? the feeling of being secure may come first. Think of how much modems/routers/phones or any other embedded device comes with obsolete software pieces with lots of security bugs. The non-free methodology of software development, I feel, is actually killing security, and making everybody more vulnerable.

Most firms don't like giving the source code of the devices away. I understand that they have their own reasons for that (whether it is right is another thing). But at least, there should be an official way to unlock those devices and run custom software pieces (which of course, voids warranty).

These days more people are moving to "Open Source," but not "Free Software." See how Linux & busybox essentially making any hardware non-free. Hope people understand the difference and help make the world better.

Re:Open Source Electronics Lab for $30 on Friday June 07, 2019 @07:28PM (#20129524)
I have been following a promising project[0] for quite long. They haven't yet released the product though.

[0] https://madresistor.com/box0/

Older »