Help Bites


  • Banned

    I've got this adblock filter, applying to all body elements on every page:

    *##body:style(overflow: auto !important)
    

    How do I write an exception filter that would disable the one above for iframes? I tried the following:

    *#@#body$subdocument
    

    But it doesn't work. Anyone knows how to fix it?



  • @Gąska I haven't tried it myself (:kneeling_warthog:), but I noticed the following in the ABP docs:

    Example: If you add the filter ##aside.info on https://help.eyeo.com/en/adblockplus/how-to-write-filters, eyeo.com#@#aside will not whitelist anything. If you add the filter ##aside, eyeo.com#@#aside.info will not whitelist anything. The filters must be exactly the same, i.e. eyeo.com#@#aside.info.

    Perhaps

    *#@#body:style(overflow: auto !important)$subdocument
    

    could work?


  • Banned

    @aitap Unfortunately, no. I mean, it figures - the part after : isn't a filter but rather a setter.

    For anyone wondering what I'm doing, I'm trying to get rid of the overflow: hidden attribute many websites set on body in an attempt to coerce people into accepting their privacy policy. But the filter I'm using now has the unfortunate side effect of putting scroll bars on full-screen YouTube. And I don't want to disable adblock on YouTube.



  • @Gąska I've just been setting it manually with the devtools, along with getting rid of any adblock popup and backdrop that they apply


  • Banned

    @hungrier yes but it gets boring when you have to do it every time you visit Wikia. And when I'm gaming, I visit Wikias a lot.



  • @Gąska I actually haven't noticed any popups like that on Wikia (or fandom.com or whatever it is now). For me it usually only happens on news articles



  • @Gąska Another thing I've done is make custom userscripts for particular sites if they have something annoying enough. Like one site used to have an adblocker popup that would come up after a couple seconds, so after figuring out how it was implemented (setTimeout to a global function) it was easy to counteract


  • Banned

    @hungrier maybe because you've accepted it once already? Before you do, the page is overlaid with half-transparent overlay that has a unique ID generated on each page visit (so that you can't block it with Adblock easily), and scrolling disabled.

    Or maybe they only show it to EU users because they're not legally obliged to do it for Americans as well.



  • @Gąska It must be the location based one; I just tried it on a brand new machine and didn't get anything



  • Anyone have any experience with desktop wifi adapters (cards or USB sticks)?

    I'm at home on my parents wifi. Mostly it works OK. I'm in a place where the signal is strong (directly below the router, only a thin floor between the two). But periodically (and not really correlated with anyone else on the network doing anything significant), I get major latency spikes. I see it most in games, where it will go from isolated 1.5-second lag to constant 1+s latency (so everything is moving in jerky motions and the game is basically unplayable), but I get it randomly while on the internet--sites that were loading just fine suddenly take forever to do anything.

    I'm wondering if it's the wifi adapter I'm using on my desktop (which doesn't have that built in). Currently I'm using a small, cheap USB wifi stick. Speedtests show that we're not getting nearly what we should be (paying for 100 Mbps down, getting 20), but the ping is low (70 ms) and stable.

    Advise? I can't run an ethernet cable, sadly. So that's off the table.


  • Discourse touched me in a no-no place

    @Benjamin-Hall said in Help Bites:

    Advise? I can't run an ethernet cable, sadly. So that's off the table.

    Powerline? Relatively inexpensive adapters should be able to manage 100Mbps



  • @loopback0 knowing the house wiring (which is... Likely not up to code in any way), I'm not confident that would work.


  • I survived the hour long Uno hand

    @Benjamin-Hall I'm using a powerline ethernet adapter in an apartment where I don't know how the place is wired. The connection is from one side of the apartment all the way to the far other side. I just tested the speed and it's about 10 MBps (80 Mbps). That's more than fast enough for my purposes, and significantly faster than my internet connection which means it isn't the bottleneck. I could have just gotten lucky with the apartment wiring though.

    My adapter cost about $40. That may be a low enough price for you that it's worth buying one to experiment with even if it doesn't work out in the end.



  • @Placeholder said in Help Bites:

    @Benjamin-Hall I'm using a powerline ethernet adapter in an apartment where I don't know how the place is wired. The connection is from one side of the apartment all the way to the far other side. I just tested the speed and it's about 10 MBps (80 Mbps). That's more than fast enough for my purposes, and significantly faster than my internet connection which means it isn't the bottleneck. I could have just gotten lucky with the apartment wiring though.

    My adapter cost about $40. That may be a low enough price for you that it's worth buying one to experiment with even if it doesn't work out in the end.

    I might do that...

    I do know that the place was wired first by the builder (who screwed up lots of things electrically), then finished by my dad, who is not exactly an electrician. And my UPS says that there's a "wiring fault" in the outlets. I'm hoping the issue isn't upstream at the DSL box or beyond. The house is now 45+ years old, and there's mice in the walls.


  • Discourse touched me in a no-no place

    @Placeholder said in Help Bites:

    My adapter cost about $40. That may be a low enough price for you that it's worth buying one to experiment with even if it doesn't work out in the end.

    If you get it from Amazon, their return policy is pretty decent.



  • @Benjamin-Hall said in Help Bites:

    And my UPS says that there's a "wiring fault" in the outlets.

    The most common things are ground not being connected correctly (or at all!) or hot/neutral being flipped.



  • Well, I'm pretty sure I've narrowed it down to the adapter. Another laptop on the same network, right next to it, was getting stable 100 ms pings (using https://packetlosstest.com), while the desktop was getting anywhere between 1400 ms pings and 100 ms pings. One test had an average of 900 ms, the next 100 ms (with a huge spike). I think the USB adapter is just derping.


  • Discourse touched me in a no-no place

    @Gąska said in Help Bites:

    Before you do, the page is overlaid with half-transparent overlay that has a unique ID generated on each page visit (so that you can't block it with Adblock easily), and scrolling disabled.

    You block that by blocking the loader script for that crap. While almost everything about that popup is intentionally awkward to circumvent, the thing that the authors of it can't really control is that the site owners don't want to be editing their site frequently. (The power of :kneeling_warthog: will not be denied!) The initial injection is at an address that is easily stifled.


  • Banned

    So anyway, in case someone wonders - I have found a workaround in the form of adding site-specific exceptions. Turns out that, despite the iframes being from different domains, the exceptions still apply.

    *##body:style(overflow: auto !important)
    youtube.com#@#body:style(overflow: auto !important)
    

  • Notification Spam Recipient

    @Benjamin-Hall said in Help Bites:

    I get major latency spikes. I see it most in games, where it will go from isolated 1.5-millisecond lag to constant 1+s latency

    ❓

    I do know that Windows will attempt to scan for wifi APs periodically, even when you're already connected ( :wat: ) which is super fun when you're streaming VR and has a similar effect.

    @Benjamin-Hall said in Help Bites:

    I think the USB adapter is just derping.

    It wouldn't happen to be an Intel one, would it? Would check to see if there's a driver update, even if it doesn't actually help...



  • @Tsaukpaetra said in Help Bites:

    @Benjamin-Hall said in Help Bites:

    I get major latency spikes. I see it most in games, where it will go from isolated 1.5-millisecond lag to constant 1+s latency

    ❓

    I meant that occasionally, everything network-related would just freeze for ~1.5 seconds, then go back to normal (100ms pings in between). Then, after a bit, it went to 1100 ms constant pings.

    I do know that Windows will attempt to scan for wifi APs periodically, even when you're already connected ( :wat: ) which is super fun when you're streaming VR and has a similar effect.

    Since switching to a PCIE card (instead of a USB 2.0 stick with basically no antenna plugged into a front port), the issue has completely gone away and I'm back to ~100 ms pings constantly.

    @Benjamin-Hall said in Help Bites:

    I think the USB adapter is just derping.

    It wouldn't happen to be an Intel one, would it? Would check to see if there's a driver update, even if it doesn't actually help...

    A cheap netgear. The (slightly more expensive, but PCIE) new one is an intel chipset.


  • Notification Spam Recipient

    @Benjamin-Hall said in Help Bites:

    USB 2.0 stick

    Eww, yeah, I've never had any good experiences doing WiFi with a USB device, except maybe when using it as an NDIS with my phone's USB connection...



  • @Tsaukpaetra said in Help Bites:

    @Benjamin-Hall said in Help Bites:

    USB 2.0 stick

    Eww, yeah, I've never had any good experiences doing WiFi with a USB device, except maybe when using it as an NDIS with my phone's USB connection...

    Yeah. I'm pretty sure that it was just choking on constant data streams as the buffers filled up (or got buffered in weird ways). Fortunately the new one was pretty darn cheap ($40) and I had leftover Amazon gift card balances from earlier.


  • ♿ (Parody)

    Status: New KVM showed up yesterday (https://what.thedailywtf.com/post/1703689). Overall seems to work pretty well. It handles up to 4 machines so I have my personal machine, work laptop and customer supplied laptop hooked up.

    All inputs and outputs are HDMI. For the laptops, I'm using a DisplayPort-to-HDMI and a Mini-DisplayPort-to-HDMI in addition to the HDMI outputs.

    My personal machine only has HDMI and VGA out so I had to get a VGA-to-HDMI adapter. The quality on that is not great and that monitor is a little bit blurry. Might have to look into a different adapter. Had bought this one:

    Any recommendations on something better?

    EDIT: Oh! Actually, it has a DVI output. I think I'll try that.



  • @boomzilla said in Help Bites:

    My personal machine only has HDMI and VGA out so I had to get a VGA-to-HDMI adapter.

    I'm assuming you need multiple displays and only have one HDMI, rather than just converting VGA to HDMI for fun. But anyway

    EDIT: Oh! Actually, it has a DVI output. I think I'll try that.

    Yeah, that should be better


  • And then the murders began.

    @boomzilla What KVM did you get? I have to manually flip inputs on one of my monitors, so if it's got multiple outputs that might be worth investing in...

    (Before yesterday would also have been interested in hooking my server up to it too, but that may be a 🐄 point now.)


  • ♿ (Parody)

    @Unperverted-Vixen said in Help Bites:

    @boomzilla What KVM did you get? I have to manually flip inputs on one of my monitors, so if it's got multiple outputs that might be worth investing in...

    (Before yesterday would also have been interested in hooking my server up to it too, but that may be a 🐄 point now.)

    @hungrier said in Help Bites:

    I'm assuming you need multiple displays and only have one HDMI, rather than just converting VGA to HDMI for fun. But anyway

    Yes.


  • And then the murders began.

    @Tsaukpaetra - you said you have your domain controller running on your NAS - what are you using?

    Trying to convince myself I don't need a DiskStation DS1819+ and can stick with the smaller DS420+ (which has a weaker CPU). Right now I have 5 drives, but can cut that down to <= 4 by using a larger disk in lieu of some of the older 10 TB drives.

    While having 27 TB of storage space does have its appeal, I'm not sure it's $400 worth of appeal.


  • :belt_onion:

    @boomzilla said in Help Bites:

    @Unperverted-Vixen said in Help Bites:

    @boomzilla What KVM did you get? I have to manually flip inputs on one of my monitors, so if it's got multiple outputs that might be worth investing in...

    (Before yesterday would also have been interested in hooking my server up to it too, but that may be a 🐄 point now.)

    @hungrier said in Help Bites:

    I'm assuming you need multiple displays and only have one HDMI, rather than just converting VGA to HDMI for fun. But anyway

    Yes.

    That's a rather nonstandard use of HDMI cables...


  • Banned

    @sloosecannon said in Help Bites:

    @boomzilla said in Help Bites:

    @Unperverted-Vixen said in Help Bites:

    @boomzilla What KVM did you get? I have to manually flip inputs on one of my monitors, so if it's got multiple outputs that might be worth investing in...

    (Before yesterday would also have been interested in hooking my server up to it too, but that may be a 🐄 point now.)

    @hungrier said in Help Bites:

    I'm assuming you need multiple displays and only have one HDMI, rather than just converting VGA to HDMI for fun. But anyway

    Yes.

    That's a rather nonstandard use of HDMI cables...

    Hey, have I told you about that one project I worked on where we used HDMI to connect GPS receiver?


  • :belt_onion:

    @Gąska said in Help Bites:

    @sloosecannon said in Help Bites:

    @boomzilla said in Help Bites:

    @Unperverted-Vixen said in Help Bites:

    @boomzilla What KVM did you get? I have to manually flip inputs on one of my monitors, so if it's got multiple outputs that might be worth investing in...

    (Before yesterday would also have been interested in hooking my server up to it too, but that may be a 🐄 point now.)

    @hungrier said in Help Bites:

    I'm assuming you need multiple displays and only have one HDMI, rather than just converting VGA to HDMI for fun. But anyway

    Yes.

    That's a rather nonstandard use of HDMI cables...

    Hey, have I told you about that one project I worked on where we used HDMI to connect GPS receiver?

    .. oh dear


  • Banned

    @sloosecannon and the cable had to be exactly 2 meters long or the clock synchronization wouldn't be precise enough to be usable. Fun times.



  • @Gąska said in Help Bites:

    @sloosecannon and the cable had to be exactly 2 meters long or the clock synchronization wouldn't be precise enough to be usable. Fun times.

    This needs a more detailed write up, I think. Get to it, and give us a link here when you finish.


  • Banned

    @abarker unfortunately, I was too far detached from that part of the project to know any spicy details. But I did write code related to propagating the info about GPS cable length across the system (it was "extensibility theatre"; the sender was hardcoded to always report 2 meters.)



  • @Gąska IR disappoint 😞


  • Notification Spam Recipient

    @Unperverted-Vixen said in Help Bites:

    @Tsaukpaetra - you said you have your domain controller running on your NAS - what are you using?

    FreeNAS (well, the renamed it to TrueNAS), the domain controller is a VM with 3 GB allocated to it (could be less if I turn of WSUS and rip that out, piece of shit...). Custom Mini ITX build with 4 spinners, two SSDs and an NVME with 32 GB of RAM.

    Trying to convince myself I don't need a DiskStation DS1819+ and can stick with the smaller DS420+ (which has a weaker CPU). Right now I have 5 drives, but can cut that down to <= 4 by using a larger disk in lieu of some of the older 10 TB drives.

    While having 27 TB of storage space does have its appeal, I'm not sure it's $400 worth of appeal.

    Hmm, if you go the DS420+ route you'll definitely want to upgrade the ram from the base model's 2Gb, but it should work decently enough. Definitely install your Windows Server in Core mode, with lower RAM things get kinda interesting (I should know. 😉 ); you can administer it from Windows 10 using tools or pop a VM on a better PC and use that when necessary.


  • And then the murders began.

    @Tsaukpaetra Thanks. I think I've had enough with the roll-my-own route!

    I splurged a little and went with the DS920+. ($60 more than the DS420+, and gets me 4 cores/4 GB of RAM for only 1W more idle power usage. Could throw in another 4 GB later, but I'll roll the dice with this for now. Using Server Core will be good practice for work.)

    I think my next steps look like this:

    1. Set up Synology with the spare hard drives I have, and build the new domain controller VM.

    2. Back up existing machine's OS disk with Clonezilla.

    3. Upgrade the existing server to Windows Server 2019, in hopes that this lets me sign in.

    4. If it does, start migrating everything off and pull drives as I free them up.

    5. If not, blow away the OS drive and do a fresh install, then go back to step 4.

    If I'm adventurous I may do 2/3 before 1.

    ...who am I kidding. starts downloading Clonezilla ISO


  • Notification Spam Recipient

    @Unperverted-Vixen said in Help Bites:

    Upgrade the existing server to Windows Server 2019, in hopes that this lets me sign in.

    Why? You can join the 2019 instance to the domain just fine, don't need to do that if you don't want to.

    Edit: Oh, you meant your current server which you don't have the password to...

    Wait, does that mean your file shares are also not working? 😕
    Further details will be necessary... Maybe a new thread since this is sounding a bit more than a Help Bite...


  • ♿ (Parody)

    @boomzilla said in Help Bites:

    EDIT: Oh! Actually, it has a DVI output. I think I'll try that.

    The cable just showed up and now everything is much sharper.


  • Notification Spam Recipient

    FreeBSD, trying to get fam responding. Internet suggests portmapper (which is not a program, but the man pages mark it like it is) is "confused" and that I should "restart networking" based on the following output:

    02ed7370-25cc-4fa3-9c8c-cf979bb626d6-image.png

    Thoughts?

    This is apparently blocking access for the actual program I'm trying to make work, which is showing the following:

    a46ab8c2-9c4f-4694-9043-0a5acd469210-image.png


  • Considered Harmful

    As our wise @Tsaukpaetra said:

    Forgive my ignorance, but...

    static string Zleek<T>(T val) => Splurm(val);
    static string Splurm(int val) => val > 9000 ? "Over 9000!" : val.ToString();
    static string Splurm<T>(T val) => val?.ToString();
    
    > Zleek(9001)
    "9001"
    

    Why won't it pick the int overload?

    ---

    I can do:

    A)

    static string Zleek(dynamic val) => Splurm(val);
    

    But dynamic is evil.

    or

    B)

    static string Splurm<T>(T val) => val as int? > 9000 ? "Over 9000!" : val?.ToString();
    

    But that box-casting is horrible.

    or

    C)

    static string Zleek(int val) => Splurm(val);
    

    I'd choose door number C.

    However, it all falls down if I want to have more than one generic type, in which case it will pick the most generic <T, U> instead of any specific overloads. Even with dynamic, which seems especially weird.

    There must be some dead obvious reason that I'm missing here (other than :doing_it_wrong:), because I don't understand inner workings of... well, anything really. But what is it? 😕


  • 🚽 Regular

    "dynamic is evil" notwithstanding, you can also change Zleek<T> to

    static string Zleek<T>(T val) => Splurm( (dynamic) val);
    

    Casting val to dynamic gets rid of "hardcompiling" a call to Splurm<T> and forces dynamic dispatch.


  • Considered Harmful

    @Zecc Alright, it's not really a help question. I'm mildly curious, but it didn't warrant a topic of its own.

    Provided that all I want to do is ToString(), with two or three special cases (a "special" serializer), I have Zleek(object val) and it works just fine. But 80% calls are with value types. I thought "let's use language features to shave away some boxing, the compiler should be able to statically determine all my types". But it wouldn't.

    As it's bound to happen with language features, I lost forest for the trees...


  • Banned

    @Applied-Mediocrity said in Help Bites:

    As our wise @Tsaukpaetra said:

    Forgive my ignorance, but...

    static string Zleek<T>(T val) => Splurm(val);
    static string Splurm(int val) => val > 9000 ? "Over 9000!" : val.ToString();
    static string Splurm<T>(T val) => val?.ToString();
    
    > Zleek(9001)
    "9001"
    

    Why won't it pick the int overload?

    C# compiles to bytecode. In CLR bytecode, only one implementation of each generic method exists, and further specialization is done by JIT. At bytecode generation time, the compiler doesn't know what T is, so it chooses overload that works for all T.


  • Considered Harmful

    @Gąska I see.

    Resharper is able to determine that int overload is unused, but VS cannot. :@levicki: :wharrgarbl:!!

    @Gąska said in Help Bites:

    the compiler doesn't know what T is

    Well, let me explain it to the compiler...

    further specialization is done by JIT

    How can JIT do any specialization (such as finding which ToString() to call) if it doesn't know what T is?


  • Banned

    @Applied-Mediocrity said in Help Bites:

    further specialization is done by JIT

    How can JIT do any specialization (such as finding which ToString() to call) if it doesn't know what T is?

    JIT knows. Bytecode compiler doesn't.


  • Considered Harmful

    @Gąska Fine. The compiler doesn't know. Doesn't matter. When the JIT generates Splurm<int> (and others if necessary), is there a good reason why it doesn't try and look if there is non-generic candidate with a matching signature Splurm(int)? As far as SharpLab tells me, even though it's private and unused, it doesn't get stripped away.


  • Banned

    @Applied-Mediocrity said in Help Bites:

    @Gąska Fine. The compiler doesn't know. Doesn't matter. When the JIT generates Zleek<int> (and others if necessary), is there a good reason why it doesn't try and look if there is non-generic candidate with a matching signature Zleek(int)?

    There are very good reasons. Listing them will inevitably lead to another round of "but couldn't they..." from you, but I'll try anyway.

    The job of JIT is to translate bytecode to machine code with perfect accuracy. It can switch things around, it can run various optimizations, it can inline things etc., but the end result of running the program must be indistinguishable from the original. If the bytecode says "call this particular generic method specialized with these particular type arguments", it better calls this particular generic method specialized with these particular type arguments. If it ran some other method, it could potentially have a different result than the one prescribed by bytecode (especially considering you WANT a different result!), and that would break the "indistinguishable" rule. Remember that bytecode doesn't contain the original context and the JIT has no way to know what made the compiler choose one method over another. The most sensible thing to do is to trust the compiler that it's done its job and do exactly what it asked for.

    If you really want JIT to resolve the method at runtime, you can cast the object to dynamic before calling the method. Who knows, maybe it'll be smart enough to inline the lookup result!

    Edit: as for stripping, I don't know the .Net toolchain very well, but considering that you can call object's private method through reflection, it's possible nothing ever gets stripped from classes so the ugly hacks like that don't randomly break down based on dead code analysis.


  • And then the murders began.

    @Applied-Mediocrity said in Help Bites:

    When the JIT generates Splurm<int> (and others if necessary), is there a good reason why it doesn't try and look if there is non-generic candidate with a matching signature Splurm(int)?

    Adding new methods is supposed to be a binary-compatible change. If library 1 calls Splurm<int>() in library 2, the library 1 behavior shouldn't change because you upgraded library 2 to a version that adds a Splurm(int) method.


  • Considered Harmful

    @Unperverted-Vixen Thank you for answering the original question.

    Bonus question: I guess then it is not possible to avoid boxing unless I'm willing to write an overload for every value type myself? My intention was up to <T1, T2, T3, T4>. I mean, it isn't worth the bother to micro-optimize like this to begin with, but it isn't for work, so I didn't profile. I wanted to find whether it can be done at all.

    Because I tried:

    Splurm<T>(T val) where T : struct => ...
    Splurm<T>(T val) where T : class => ...
    

    and it didn't fly, because (I didn't figure) constraints are not considered by the compiler either.


Log in to reply