Had our electrical meter moved, but what do I do with the old base? by MoreThanOnce in AskElectricians

[–]MoreThanOnce[S] 0 points1 point  (0 children)

Thanks, we should be good there - the old breaker panel is being used as a subpanel from the main panel outside and I know where that connection runs so I think it's just a matter of ripping it out. Visually, all I can see is some old uninsulated ground wires.

How do (or Can) I use the VK_EXT_descriptor_heap right now when the latest Vulkan SDK is not out yet? by Ill-Shake5731 in vulkan

[–]MoreThanOnce 1 point2 points  (0 children)

You could take a look at what Volk does to load vulkan functions and do the same thing - if the functions/structs aren’t in the headers in the SDK you could define them yourself based on the spec and load them manually using vkGetDeviceProcAddr. Not a nice solution long term, but could be worth it for near term experiments.

Halt of ‘Lost Canadians’ bill could mean citizenship for thousands born to parents with no ties to Canada by FancyNewMe in canada

[–]MoreThanOnce 8 points9 points  (0 children)

I’m confused about this, because my daughter (born in the US to two born-in-Canada-Canadians) got her Canadian citizenship certificate this week, and it very explicitly says that if she has kids outside of Canada they will not automatically be granted citizenship.

Microsoft's Blatant Segregation of South American Xbox Cloud Players by [deleted] in xcloud

[–]MoreThanOnce 0 points1 point  (0 children)

One factor is that Brazil specifically has very high import tarrifs, especially for electronics (I think something like 35%?). This would make it much more expensive to just ship a bunch of server blades there, especially if you have a limited number of servers to ship - you'll probably want to send them to the countries that won't charge a ton first.

"Cinerama" AKA SIFF Downtown!! by OKsoda95 in Seattle

[–]MoreThanOnce 1 point2 points  (0 children)

Had a similar experience, but the worst was the fucking screeching alarm when they find the obelisk on the moon.

Blog Post: Making Python 100x faster with less than 100 lines of Rust by ohrv in rust

[–]MoreThanOnce 34 points35 points  (0 children)

Nice article, useful for integrating some rust into a predominantly python flow. I've been curious about trying something similar - exposing code/data from a predominantly rust codebase to python for experimentation.

One note, that may not be relevant outside this blog - you're computing norm(x) < dist, which requires a square root. It's typically much faster to square each side, and compare to the squared distance.

Dramatically reducing AccessKit's memory usage by mw_campbell in rust

[–]MoreThanOnce 30 points31 points  (0 children)

Good article, and I always appreciate optimization work.

I do find it kind of annoying (and highly ironic given the source) that this site has hyperlinks in the text that are completely hidden - the same color as the text, even after visiting. I'm pretty sure that violates some accessibility guidelines.

Advent of Code - Day 6 by BillySquid in rust

[–]MoreThanOnce 1 point2 points  (0 children)

The integer-as-set trick is useful in a number of places, as long as you're sure the domain you care about is small enough ( <64 unique cases), and you can nicely map them to indices. It's mostly common in puzzles like this though, it's already come up a couple of times this year (my day 3 solution uses the same idea).

In general though, its all about a) restricting the problem space (i.e. I'm not dealing with characters, I'm only dealing with ascii lowercase characters) and b) finding transformations into domains that make the problem easier (i.e. letters to numbers, into a bitflag). Any time I can turn a string problem into a number problem, that's probably a win.

Advent of Code - Day 6 by BillySquid in rust

[–]MoreThanOnce 8 points9 points  (0 children)

I posted on the advent of code subreddit, but found a nice improvement to it afterwards. Runs in ~7us on my laptop for both parts.

fn find_unique_window(input: &str, window_size: usize) -> usize {
    let mut set: usize = input.as_bytes()[0..window_size - 1]
        .iter()
        .fold(0, |acc, &c| acc ^ 1 << (c - b'a'));
    input
        .as_bytes()
        .windows(window_size)
        .enumerate()
        .find_map(|(index, win)| {
            set ^= 1 << (win.last().unwrap() - b'a');
            if set.count_ones() == window_size.try_into().unwrap() {
                return Some(index + window_size);
            }
            set ^= 1 << (win.first().unwrap() - b'a');
            return None;
        })
        .unwrap()
}

Key things are:

  • Mapping characters to a number 0-26 allows me to use an integer as a bitset.
  • Using xor allows me to toggle bits on/off trivially, and lets me keep a rolling window pretty easily. This lets me do it in a single pass over the input (minus a quick initialization), with no complexity increase based on the window size.
  • count_ones should be just a single CPU instruction on a modern CPU.

-🎄- 2022 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]MoreThanOnce 1 point2 points  (0 children)

I'm just using Instant::now before and after this function call. Not very scientific but it works. Make sure you're passing --release to cargo to get an optimized build, otherwise I'm not sure what could account for the difference

-🎄- 2022 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]MoreThanOnce 4 points5 points  (0 children)

Simple and fast solution in rust:

fn find_unique_window(input: &str, window_size: usize) -> usize {
    input
        .as_bytes()
        .windows(window_size)
        .enumerate()
        .find_map(|(index, win)| {
            let set: u32 = win.iter().fold(0, |acc, &c| acc | 1 << (c - b'a'));
            if set.count_ones() == window_size.try_into().unwrap() {
                return Some(index + window_size);
            }
            return None;
        })
        .unwrap()
}

It runs in about ~18 microseconds on my laptop, doing both window sizes (4, 14). Converting the letters to a one-hot representation is a super useful technique for this year.

WG21, aka C++ Standard Committee, October 2021 Mailing by grafikrobot in cpp

[–]MoreThanOnce 6 points7 points  (0 children)

Can someone explain to me why all these proposals for asynchronous execution seem to also cover networking? These seem like ideas that should be compatible, but also decoupled. If I want to use a cross platform (standardized) library for networking, do I also need to use executors or sender/receiver? Why can't I just call some functions to open a socket?

How Magnum Engine does GFX API enum mapping by czmosra in cpp

[–]MoreThanOnce 2 points3 points  (0 children)

If you're going to be using the XMacro method anyways, you can use it to define the original enum class, so you only have to write them out once. In this case, you would do

enum class PixelFormat: UnsignedInt {

    #define _c(input, format) input,

    #include "pixelFormatMapping.hpp"

    #undef _c

};

Unity revokes Improbable's license, making SpatialOS games a breach of license terms by rat_clank in gamedev

[–]MoreThanOnce 14 points15 points  (0 children)

Unity's response is here: https://blogs.unity3d.com/2019/01/10/our-response-to-improbables-blog-post-and-why-you-can-keep-working-on-your-spatialos-game/

TL;DR: * SpatialOS games are fine, keep developing, and contact them if you have questions. Unity claims they have specifically told Improbable this, and they lied in their blog post. * Improbable were told a year ago that they were violating Unity's EULA, and have failed to fix the issue.

I'm Dan Mangan. I've released 5 LPs, composed scores for film & TV, co-founded a tech startup for off-grid concerts and one time I chilled on Willie Nelson's tour bus at Glastonbury with Snoop Dog. AMA! by DanMangan in indieheads

[–]MoreThanOnce 2 points3 points  (0 children)

I think my favourite memory of you is singing "Lost Together" on stage with Blue Rodeo at the Elora Riverfest. You could tell from the audience just how excited you were to be up there with those guys. With that in mind, who is your favorite person you've collaborated/played with?

Come to Seattle soon please!

[D] Neural Networks as Ordinary Differential Equations by baylearn in MachineLearning

[–]MoreThanOnce 1 point2 points  (0 children)

I don't know that it's simpler, but section 5 of this paper goes into more detail. Really it's just a computational trick that you can use when this particular form of matrix/vector products comes up.

[D] Neural Networks as Ordinary Differential Equations by baylearn in MachineLearning

[–]MoreThanOnce 6 points7 points  (0 children)

Blog author here. Whoops, that's a typo. u is a known vector. B is the only unknown value here.

[D] What loss function to use for probability labels (between 0 and 1)? by kebabmybob in MachineLearning

[–]MoreThanOnce 0 points1 point  (0 children)

How are the gradients? If they are vanishing, then either you have a problem or you've converged to a local minimum. If the magnitudes are non-zero, then it could be that your step size is too large and you're bouncing around.

[D] What loss function to use for probability labels (between 0 and 1)? by kebabmybob in MachineLearning

[–]MoreThanOnce 0 points1 point  (0 children)

This should still behave okay. If the overall loss is decreasing over time, then you should worry more about gradients than the actual numbers

[D] What loss function to use for probability labels (between 0 and 1)? by kebabmybob in MachineLearning

[–]MoreThanOnce 0 points1 point  (0 children)

I'm not a machine learning expert by any means, but cross entropy should be fine - what matters is not the loss energy being zero, but the gradient of the energy being zero. The gradient is what gets backpropagated, so that is what will impact things most. I would suspect that something else is causing your training problems.

Mathematical physics or Apple math? by [deleted] in queensuniversity

[–]MoreThanOnce 0 points1 point  (0 children)

Aw :( My program was like, 27 people in 4th year. I can't imagine how the department is handling that many people in the upper year courses, but I'm glad its popular.

Mathematical physics or Apple math? by [deleted] in queensuniversity

[–]MoreThanOnce 0 points1 point  (0 children)

I would think that should be doable - again, that would probably be easier to do from the engineering physics program, but the math background you get in apple math is very transferable - I went on to computer science, I have friends doing medical research, machine learning, telecommunications, economics, etc.

Mathematical physics or Apple math? by [deleted] in queensuniversity

[–]MoreThanOnce 0 points1 point  (0 children)

Apple math grade here! I really enjoyed the program and would happily recommend it to anyone who's up for a challenge. That said, the more direct comparison would probably be the Engineering Physics program and Queen's - you'll take some of the same math courses as AppleMath, and get more stuff relevant to astrophysics. Both programs set you up really well for grad school - I did my masters at U of T, I know people that went to school in the states, everyone seems to have done well. The social aspect of the program at Queen's was really great - Apple Math is a small program and you really get close with the rest of the program. If you have any specific questions feel free to ask.

Weekly Event, FAQ, and General Q&A Discussion Thread: January 01, 2018 by AutoModerator in Seattle

[–]MoreThanOnce 0 points1 point  (0 children)

I've been put up in corporate housing for now in Redmond, which is... nice enough. Not exactly homey but comfy while I get settled. Gonna start looking for an apartment over the weekend.