Recent posts

#1
General Chat / Re: The NVIDIA GeForce Experie...
Last post by viviridian - May 04, 2025, 10:22 PM
it's not exactly related but I need to write this down *somewhere*. i was having an issue with pipewire where whenever i'd launch steam games on my thinkpad p14s gen 5 (intel), audio playback would be totally blocked until i closed them.

tangent
a workaround I used previously was to just use pulseaudio. unfortunately this fell apart as soon as I wanted to play a game *and* capture its video and audio in obs, i'm on wayland and afaik *need* pipewire for that to be possible. whee!

i found that removing the connections between the game and the output device in qpwgraph and putting them back would restore audio (for the game and everything else!), but if basically anything happened that added or removed a connection to the output device (say, a notification sound being played, or opening the volume control plasma widget) it would break again until I re-added the connections.

i eventually stumbled on this: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/618

Quote from: Wim Taymans on gitlab.freedesktop.orgTry setting api.alsa.headroom = 1024 in /etc/pipewire/media-session.d/alsa-monitor.conf

that ended up fixing it, but I had to figure out how to adapt it to wireplumber. here's what I ended up with:

Code (~/.config/wireplumber/wireplumber.conf.d/alsa-p14s-g5-intel.conf) Select
# ALSA node property overrides
# docs: https://pipewire.pages.freedesktop.org/wireplumber/daemon/configuration/alsa.html
# to reload,
# systemctl --user --now restart wireplumber

monitor.alsa.rules = [
  {
    matches = [
      {
        node.name = "~alsa_output.pci.*HiFi__HDMI1__sink"
      }
    ]
    actions = {
      update-props = {
        node.description = "HDMI1 Out" # less verbose
        api.alsa.period-size   = 1024
        api.alsa.headroom      = 256 # introduces latency for badly behaved drivers; 256 seems to work, 2048 may be a decent option idk
      }
    }
  }
]

what that setting actually does (reference):
Quote from: pipewire docsapi.alsa.headroom

    This adds extra delay between the hardware pointers and software pointers. In most cases this can be set to 0. For very bad devices or emulated devices (like in a VM) it might be necessary to increase the headroom value.

    Type:
        integer (samples)

i need to start collecting notes like this somewhere. like a "web site"
#2
General Chat / Re: The NVIDIA GeForce Experie...
Last post by lifning - May 04, 2025, 07:07 AM
...the fact that it doesn't output anything to indicate that that's what's happening is a little absurd
#3
General Chat / Re: The NVIDIA GeForce Experie...
Last post by viviridian - May 04, 2025, 02:49 AM
hey so I learned today I was wrong about the akmod thing!

when booting after a new kernel is installed, my laptop would sit at a black screen with a flashing prompt, and the fans would spin up. i assumed this meant it was unrecoverably dead (because in my experience, that's usually what that means!) but during that time it's actually *synchronously building the missing kernel module*. so all i had to do was wait!

this page which is like, the canonical source for "how to use nvidia gpus on fedora" doesn't mention that at all 🙃
#4
General Chat / Re: good talk(s)
Last post by snow - May 03, 2025, 04:10 AM
Quote from: lifning on May 03, 2025, 03:43 AMAT&T Archives: The UNIX Operating System, a presentation largely by a young Brian Kernighan

Can highly vouch for this one. This was what made the whole UNIX system idea "click" for me when I was in high school. It's so in-depth and yet approachable for those who might not understand the technical aspects.



Somewhat relatedly, while I'm not sure most would consider them talks:

"How I Became a Phone Phreak" series by Evan Doorbell (YouTube playlist)

If you aren't familiar with Evan Doorbell's tape collection, this is probably the best place to start. The story of a "classic" phone phreak getting his start in the circle by way of curiosity in the weirdness of the old Bell System. The "Production Tapes" collection is actually a narrated tour of actual tapes Evan kept from the '70s to today, with this series being the most edited of the bunch.
#5
General Chat / Re: good talk(s)
Last post by lifning - May 03, 2025, 03:43 AM
AT&T Archives: The UNIX Operating System, a presentation largely by a young Brian Kernighan

Describes how the UNIX pipeline and philosophy empowers users to solve their own problems by composing existing, simple programs together without having to write new programs outright. This is something those of us who've used UNIX shells for years take for granted by now, but there's something really enjoyable about seeing Bell Labs folks articulate their then-new idea for this paradigm, and seeing how much of it is still very relevant today.
#6
General Chat / Re: ye olde reverse jukeboxe
Last post by lifning - May 03, 2025, 12:25 AM
it is Bandcamp™ Friday®, which means i have purchased the 2025 remaster of Gay Bar by Electric Six and spliced the first verse with that of its Japanese radio edit
#7
General Chat / Re: zen of stack overflow
Last post by semaphore - May 02, 2025, 10:45 PM
Quote from: Electronics StackExchange (comment score: 3)You get a body diode whether you want it or not.
#8
Creations and Ideas / Re: SMF Modifications and Hook...
Last post by lifning - May 02, 2025, 05:57 AM
...okay i had no idea the WYSIWYG mode even existed. very impressive that you got this working with that!!
#9
Creations and Ideas / Re: SMF Modifications and Hook...
Last post by snow - May 02, 2025, 03:38 AM
Types of BBCode

The spoiler plugin I've built, which adds spoilers and "restricted" blocks of text in the form of BBCode, involved working with the BBCode renderer in SMF. Surprising, I know!

Maybe a bit more of a surprise is that SMF 2.x has not one, but two BBCode renderers. The one SMF 1.x hackers might remember is the server-side rendering code that's an undocumented mess. Don't worry, it's still a mess. We'll have to worry about that soon, but first, I want to talk about the JavaScript-based SCEditor used in SMF 2.x.

There are two modes to SCEditor: plain text and WYSIWYG. You can switch between the two by clicking the page icon in the toolbar:

image.png

The text-based editor is as basic as it gets, and the WYSIWYG editor is... an iframe that you edit because it's content-editable. Which, okay fair, I can't think of a better way to do it. But that does mean we have to convert between HTML and BBCode. So how to we do that?

By hand, of course :rember:

I won't go into the details since the SCEditor docs handle it pretty well, but basically: you either receive the BBCode form pre-parsed and have to turn the values into an HTML fragment (text -> WYSIWYG), or you receive the HTML element in the DOM and have to return the BBCode as a string. Somewhat annoying when you have something as complex as a details/summary pair of elements, but I couldn't think of a better way to do it generically.

This is all client-side, though. SCEditor always sends the BBCode to SMF when you hit Post or Save Draft, since SMF doesn't know what to do with the HTML. Unfortunately, this aspect of SMF is poorly documented. I have come to expect this at least.

So, to start off, we have to hook integrate_bbc_codes with a function that we'll use to include our BBCode. That hook function will look a little something like this:

Code (php) Select
function hook_my_bbcode(&$codes, &$no_autolink_tags) {
  // $no_autolink_tags is an array of tags that shouldn't have their
  // content automatically turn into links. we'll be ignoring that
  // here.
  $codes[] = array(
    // the tag will be [box][/box]
    'tag' => 'box',
    // more on this in a moment!
    'type' => 'unparsed_content',
    // $1 is the content between the tags
    'content' => '<div style="border: 1px solid white;">$1</div>',
    // Provide a function to transform the content the user entered.
    // For example, [noguest] uses this to hide text from guests.
    'validate' => function(&$tag, &$data, $disabled, $params)
    {
      // If the user didn't provide content, provide it for them :)
      if (empty($data)) {
        $data = "im in the box!";
      }
    },
    // yes this is a block element
    'block_level' => true,
  );
}

There are a bunch of other array keys I'm skipping over here, which are only really documented in the SMF parse_bbc function in Subs.php. The main thing that I want to share that tripped me up is the "type" key. Here it's "unparsed content," but what does that mean? What is "parsed content"?

Fear not, curious reader, for I shall share the code comment in the middle of a function documentation with you:

  type: one of...
      - (missing): [tag]parsed content[/tag]
      - unparsed_equals: [tag=xyz]parsed content[/tag]
      - parsed_equals: [tag=parsed data]parsed content[/tag]
      - unparsed_content: [tag]unparsed content[/tag]
      - closed: [tag], [tag/], [tag /]
      - unparsed_commas: [tag=1,2,3]parsed content[/tag]
      - unparsed_commas_content: [tag=1,2,3]unparsed content[/tag]
      - unparsed_equals_content: [tag=...]unparsed content[/tag]

Well. This is useful, but only vaguely elucidates what "parsed" content is. It's referring to the parsing of BBCode: for example, the content of [mytag][b]hello[/b][/mytag] would be "hello" if [mytag] is parsed content, but "[b]hello[/b]" if it's unparsed. In retrospect, this was probably obvious...

There's an important caveat to the first one, internally "parsed_content" but actually defined by the lack of a "type" parameter: you cannot use the "content" field, and "validate" can't be used to modify the content. To actually convert the tag to HTML, you have to use the "before" and "after" fields, like so:

Code (php) Select
$codes[] = array(
  // the tag will be [box][/box]
  'tag' => 'box',
  // what to add before the content
  'before' => '<div style="border: 1px solid white;">',
  // what to add after the content
  'after' => '</div>',
  'block_level' => true,
);

This is because the parser is effectively replacing the beginning tag with the "before" parameter, noting there's an open tag currently, and continuing on with parsing. Once it finds that closing tag (or the BBCode ends abruptly), it inserts the "after" content.

As far as I can tell, this doesn't happen for any other form of parsed content, as it recursively calls parse_bbc in those cases. I suppose it's far more likely for the actual content to have lots of recursive calls; e.g. a pile of nested quote blocks. But it's an annoying pitfall if you don't know about it!

This especially caused issues for me with the [noguest] tag, because the "validate" function is the core of it. So, at least at the moment, you can't actually use BBCode within that tag. I might just fix it by doing a recursive parse_bbc call, but I want to see what (if any) impact that has first.
#10
Bugs and Feature Requests / Re: [RfC] Adding new forums
Last post by snow - Apr 29, 2025, 08:20 PM
Checking the poll results, and all of the "yes" options are tied. Hrm.

I think it's reasonable enough to start by splitting out the projects forum, and we'll go from there. I'll include this in the next announcement post, in case anyone misses this (I'll be making some changes on that front, too).