News for hackers. Stuff that matters.

_TwoFinger

Re:Software Disenchantment on Monday October 23, 2023 @04:10PM (#37990890)
Not PP, but I used to work for an automotive subcontractor company, and I've heard a few stories about fatal car accidents that lead to lawsuits, which proved that the car design was the reason for the accident, yet the car manufacturer just payed "damages" to the relatives (or settled out of court, maybe) and never bothered to change the design. Apparently, it was more expensive to reconfigure their production pipelines than pay for an occasional death.

That said, this is probably what any big enough company would do. So your point still stands, maybe car manufacturers are no different.

Re:Word Warriors' "Words that deserve wider use" on Saturday October 14, 2023 @10:24AM (#37880687)
Your Indonesian is pretty good, sir. Have an upvote.
Re:Forty Years of Programming on Monday October 09, 2023 @07:33AM (#37819268)
[delayed]
Re:Forty Years of Programming on Monday October 09, 2023 @05:29AM (#37818584)
Just want to mention sticky keys[1], as it seems often overlooked.

Instead of holding the modifier key(s) when activating a shortcut, you can press and release each modifier sequentially.

It does come with some of the fancy keyboards' firmware, but is also a built-in feature of all major OS-es. You can get it without spending a single dollar.

[1]: https://www.emacswiki.org/emacs/StickyModifiers

Re:Making Hard Things Easy on Saturday October 07, 2023 @02:31AM (#37799490)
Emphasis on "also".

If you optimize a shell feature for general-purpose programming, interactivity will suffer (increased verboseness, usually), and vice versa.

If we try to bring shells closer to the real PLs, instead of just using those PLs when it matters, we'll lose some of things that made shells attractive in the first place.

Re:Making Hard Things Easy on Saturday October 07, 2023 @12:12AM (#37798959)
> So, bash is a programming language, right?

No, it's a shell that lets you interact with the OS. All the "clasical" UNIX shells were created with interactive use in mind and optimized for it, but happen to be good enough at batch processing[1] to be conflated with programming languages (mostly these days, like, 40+ years later).

The focus on interactive use is the reason you don't have to

- surround command argument lists with parentheses

- put commas between command arguments

- put semicolons at EOL

- surround string literals with quotes (unless the content interferes with the syntax, like, sigils or IFS chars, and you want to escape it).

- surround variable names in braces (unless you want to use some advanced substitution)

- call commands to manipulate I/O; it's baked in.

And these are just the things that existed 40 years ago. Bash gives you so much more stuff that makes interactive use a bliss, but I'm not going to dump the man page here.

[1]: https://en.wikipedia.org/wiki/Batch_processing

Re:Don't worry about global population collapse on Sunday October 01, 2023 @01:56AM (#37723082)
Ah, we are really just one smart kid away from extinction.

Something something boson something neutron, and the Earth goes kaboom.

Children can be very dangerous.

Re:The roots of an obscure Bourne shell error message on Monday September 11, 2023 @11:11PM (#37476615)
> Missing semicolon.

It's not missing. PP is making a point about "single-command variables."

Re:fish-shell: the user-friendly command-line shell on Saturday August 26, 2023 @10:57AM (#37273460)
> I had to [...] and set my shell to bash/zsh

Most likely a command in your script (or one source-d into it) makes an assumption about your $SHELL or login shell that is true for bash/zsh but not for fish.

Merely adding a shebang won't fix such a script.

Re:Antonmedv/walk: Terminal file manager on Tuesday August 22, 2023 @06:47PM (#37229594)
> having to retype the whole filepath when using mv can lead to errors.

If you use bash, or any readline-based command line (in emacs mode):

  mv long.file.name |^W^Y^Y
results in

  mv long.file.name long.file.name |
(| is the cursor). Then, you just edit the second copy of the filename. BTW, M-C-b/M-C-f will move by one whole "argument" (even if it contains escaped spaces).

edit: and if your filename has spaces, replace the ^W above with M-C-b C-k

Re:The Physics of Readability on Sunday August 06, 2023 @11:27PM (#37029725)
> we effectively have infinite vertical space

It's only infinite if you scroll for infinitely long time.

I think the author's point was about how much code you have on the screen at any given instant. Without having to scroll or jump.

Re:Fast Machines, Slow Machines on Wednesday June 28, 2023 @12:12PM (#36508565)
I don't use the tiling at all.

I use the multiple desktops feature a lot, though. Some programs are pinned to a dedicated desktop and run all day. Others I start in (or move to, later) a numbered desktop, and switch to them by changing the desktop. Often, most of the desktops contain only one window.

I once used i3 and sway the right way, of course. I guess I had one too many of those programs that were not designed to work at arbitrary window sizes, added the above rule and called it a day.

Re:Fast Machines, Slow Machines on Wednesday June 28, 2023 @10:28AM (#36507003)
Just an idea, if you find yourself unable to warm up to tiling:

  for_window [all] floating enable
It's stupid, but I've been using this for a couple of years now.
> If you're talking about Indonesians refererring to Indonesian in an English language context, yeah

yes, my only source for my previous comment was a passport control officer asking me "do you speak bahasa" at the airport :-)

Indonesians themselves call it "bahasa". I guess the user you responded to is either Indonesian, or has been there.
Re:Moving Fast with the Core Vim Motions on Thursday June 15, 2023 @01:39AM (#36336820)
* * *
Re:CLI tricks every developer should know on Monday May 01, 2023 @08:11AM (#35771693)
They mention history expansion, but only briefly. It is a favorite of mine. Learning the full syntax probably doesn't give good ROI these days of mice, but I think the following shortcut notations are worth knowing:

Everything but the last argument:

  % git add -p dir1
  % !!- dir2
  git add -p dir2
Everything but the command:

  % textadept a b c
  % vim !*
  vim a b c
Substitute a string (once):

  % echo helo world
  % ^lo^llo
  echo hello world
First and last arguments:

  % diff path/a/file path/b/file
  % diff !$ !^
  diff path/b/file path/a/file
A cool detail is that even a long quoted string containing spaces is considered a single argument, and it all works fine.

Also, the bangs can be anywhere on the command line, even inside other kinds of expansion; history expansion has highest priority of all.

Edit: the above is csh-style history expansion, available in bash as well.

Re:CLI tricks every developer should know on Monday May 01, 2023 @07:34AM (#35771396)
* * *
Re:916 Days of Emacs on Friday April 14, 2023 @02:47AM (#35566307)
Here is my current keyd configuration (on US QWERTY hardware): https://dpaste.org/aGp3o/slim (I'm not entirely happy with it, though.)

The one thing I wanted the most was to avoid any long presses. Everything that requires holding a modifier, even if I do it touch-typing style, with the opposite hand, is unpleasant (to me). So, besides moving most of the punctuation characters to lowercase positions, I also switched to sticky modifiers. (keyd might have some flaws wrt sticky modifiers, and they... get stuck. Not when I want them to be. I might try to go back to XKB.)

Regarding the home-row modifiers, I've only tried moving Control there. I always ended up triggering it by mistake when typing, because when you are typing fast, there is an almost unavoidable overlap in certain sequences, you press the next key before fully releasing the previous key. Some people advice practicing, other software provides various options with timeouts, it's a rabbit hole of work-arounds. So I settled with sticky modifiers.

Re:916 Days of Emacs on Thursday April 13, 2023 @08:06PM (#35563873)
ADM-3A also has

- the : key to the right of the 0 on the number row, no Shift needed.

- the Enter key to the right of the P.

I've made both changes to my keyboard layout and, not surprisingly, it's quite convenient.

Downside is, you'll have to move the original keys somewhere else. But since I already intended to totally reshuffle all the non-alpha keys for RSI reasons, it wasn't an issue for me.

Re:Awk: Power and Promise of a 40 yr old language (2021) on Monday January 16, 2023 @01:04AM (#34397360)
You can still do it with awk, but with different "ergonomics":

  awk -F= '$2 ~ /[0-9]+/ { print $2 }'
With imaginative choice of FS and RS you can push it very far.

Whether other people having to deal with such code will appreciate your imagination is another matter, though.

Edit: I missed the detail where you want to specifically match "foo" as lhs. So the correct condition would be even lengthier : ^ ) You have a valid point. Captures would provide for shorter patterns.

I remember one of the projects I was part of, in a big company.

It was called Voyager, and was about porting the company's software, that was currently running on SunOS/SPARC, to Linux/x86. (As SPARC was about to be EOL'd.)

Like Voyager, the space probe, it was about moving away from the Sun (OS) :-)

Re:Vim9 Script Feature-Complete on Saturday January 01, 2022 @02:23PM (#29761712)
> it has poor handling of strings and I don't know how that fares with an editor extension language.

I guess the parent refers to Lua treating strings as simple byte arrays, whereas a text editor has to deal with characters in various encodings, some of which can be multi-byte.

Re:How I Write Code: Pen and Paper on Friday September 03, 2021 @11:33AM (#28405551)
I used actual toilet paper to write programs on for the first year or two after I started programming. (I just had no computer of my own.)

This was not the kind of toilet paper you would see nowadays, though. It was not in a roll, but a deck of precut pieces, and they were not soft at all. One side was glossy, and the other - rough. The glossy side was perfect for writing. It was almost like a notebook, only cheaper.

Here's a link to a somewhat similar kind - https://www.ebay.com/itm/VERY-RARE-OLD-ORIGINAL-RUSSIAN-TOIL...

(I'm not the seller, I swear.)

I do miss these times. I could actually write a whole program without compiling it, and it would run fine on a computer later. Most of the times.

Re:Cosmopolitan Libc 1.0 on Monday May 17, 2021 @08:02AM (#27182497)
> Not sure I will write my Makefile generator, since my project is also not that big.

gcc has a family of command-line options starting with -M than can generate dependencies as a byproduct during compilation. The generated files are in Makefile format, and only need to be included in your main Makefile.

https://make.mad-scientist.net/papers/advanced-auto-dependen...

Re:Toxic positivity does more harm than good on Sunday January 17, 2021 @09:32AM (#25810888)
> Uggghhhh, I loath being asked that.

Some of them hate asking you too. Sometimes it's a policy forced on them by management, and they are to be fined if they skipped a customer. Overheard this in the bus, a cashier was complaining to her friend. There were cameras installed at every register specifically for that.

To be honest, the cashiers and waitresses I've talked to in the US delivered a pretty good act, totally believable. When the big chain stores in my country decided to copy the US, the lack of acting skills in our culture was very noticeable.

Re:Physical attractiveness bias in the legal system (2017) on Tuesday August 04, 2020 @03:06AM (#24047464)
> The second then tried to imitate that manner, failing pathetically.

Your comment reminded me of a similar experience of mine, but in reverse.

I was washing my hands in the restrooms at work, and decided to drink some water. I bent over, cupped my hand and started drinking.

At this moment, a guy went out of another stall and walked up to the sink next to me. He was some sort of manager, I guess, because he'd always be in a suit when I've seen him around the office before. When I got up, I saw him drinking water the same way I did, only he was failing to get much of it into his mouth. :-) Obviously, this was his first time.

They might have falsified the statistics in order to boost people's morale, but they were also very serious about actually progressing.

Bulgaria was under USSR's wing when I was a kid, and I have first-hand experience about that.

There was this thing called "kruzhoks", (a Russian word, diminutive of "circle", like in "circle of friends"), which were after-school interest-based clubs, mainly about technical stuff. Every other kid was a member of some kind of kruzhok. Back then I didn't realize that, but the state must have had some sort of "master plan" to prepare as many kids as possible for technical careers when they grow up.

I also distinctly remember the exceptional quality of the textbooks (math, mechanics, electronics). The content was presented in a pedagogical order, with increasing difficulty, and carefully selected exercises that helped the concepts sink in. I used Russian textbooks from the 60's and 70's up until I graduated the university in 2005. (I'm a mechanical engineer, physics hasn't changed much since then, heh.) The typography was also excellent. When I first saw LaTeX output, the first thing that came to mind was Russian textbooks. I don't know how they did it back then.

Older »