Acters

joined 2 years ago
[–] Acters@lemmy.world 2 points 1 month ago

My sister has that snap 4 luxe type item from Amazon and it definitely has such a strong magnet that even attached to the case, it will stay stuck on the wireless charger haha, but I doubt the peltier cooling as effective at keeping it cool because the case is quite thick with snap 4 luxe increasing thickness too. While for my case less phone with only the slim magsafe ring, it is working really effectively at cooling the phone.

I tried those slim frameless cases that had a magsafe ring embedded, too. Unfortunately they were a complete failure. One issue is that they break on the corner that has the S-pen, and one case in particular would fail to stay attached on the phone properly. I wish they were made properly but they were epic fails.(The other case had a metal plate for the magsafe notch, fails at preventing product from twisting)

I looked at those frameless types but they are made of metal and would affect wireless performance. on top of that the design made me feel uneasy.

[–] Acters@lemmy.world 32 points 1 month ago (1 children)

Ah but that means they will have to think about driving instead of going on autopilot

[–] Acters@lemmy.world 2 points 1 month ago

I personally went without a case myself and also decided against putting anything on the phone except the ESR magnetic ring to make my s25 ultra able to attach to magsafe products.(Small dab of Loctite glass glue to keep it from popping off with the magsafe products or just slide off the product instead of straight popping it off)

I agree on it helping the phone keep cooler without the case. I even got one of those peltier cooling qi2 wireless chargers to make the phone extra cool when I am driving.

Its a bit annoying to think a bit more on where I place my phone down or holding it but at least I am making sure I am using the phone and placing it in places that will not lose it.

[–] Acters@lemmy.world 2 points 1 month ago

I am thinking of the nothing CMF phone 2 rn

[–] Acters@lemmy.world 2 points 1 month ago* (last edited 1 month ago) (2 children)

Get the loctite glass glue and place a few dots around to help with adhesion but nott too much that it is permanent when you want to remove it.

I personally sprung for the ESR magsafe hololock ring because I wanted it to be as flush as possible on my Samsung S25 Ultra. Being slim but still help with attaching to magsafe products is nice, especially since I live in a place that gets hot, I bought a qi2 car charger that has a peltier cooling unit in it. Phone is ice cold when I slide it off the charger

Side note:
popping it perpendicular to the surface has shown me that without the loctite glass glue, the ESR magnet ring will stay on the charger. So I just make sure to slide it off horizontally.

[–] Acters@lemmy.world 1 points 1 month ago

Wait doesn't the cyber truck had an issue where it was possible for it to rust? Not to mention the unreasonably large glass windshield that would be expensive to replace?

[–] Acters@lemmy.world 1 points 2 months ago

I got two ifixit kits and that's all I need, even though I stopped repairing the phone and just trade in every three years.

[–] Acters@lemmy.world 1 points 2 months ago

Got a hearty chuckle out of me lol

[–] Acters@lemmy.world 9 points 2 months ago (5 children)

I thought this was a scene from the hunger games where the character peeta mellark used his cake baking skills to do some crafty camouflage

[–] Acters@lemmy.world 1 points 3 months ago (1 children)

I don't understand what this has to do with a PhD in cyber security but I do agree with what you said though

[–] Acters@lemmy.world 1 points 3 months ago* (last edited 3 months ago)

Glibc's qsort will default to either insertion sort mergesort or heapsort. Quicksort itself is used when it cannot allocate extra memory for mergesort or heapsort. Insertion sort is still used in the quicksort code, when there is a final 4 items that need to be sorted.

Normally it is simply mergesort or heapsort. Why I know this? Because there was a recent CVE for quicksort and to reproduce the bug I had to force memory to be unable to be allocated with a max size item. It was interesting reading the source code.

That is if you are not on a recent version of qsort which simply removed quicksort altogether for the mergesort + heapsort

Older version still had quicksort and even some had insertion sort. Its interesting to look at all the different versions of qsort.

[–] Acters@lemmy.world 2 points 4 months ago* (last edited 4 months ago)

Don't listen to the haters but it would have been nice if you collapsed this because it is very long and generalized to the point that it is pretty much an eyesore. Plus most people can ask their AI of choosing semi-random topics. I don't see what was interesting in the AI response at all. It states some blatantly obvious facts and is rather too wordy. I intentionally include into the system prompt or "personalization" about how I like things to be kept short and to not reiterate what I had posted especially if it just sounds like the "AI" is thinking out loud.

 

hi I know this is a year old, but I solved it and used a custom implementation of binary search to solve this.
interestingly enough, in python at least, it is almost as performant as the quadratic equation for solving this lol (43.7 microseconds vs 64.9 microseconds) but now that I realized it is a simple parabola, you can just get the maximum after getting the minimum time and practically matches the quadratic equation performance. lol I know the math is faster as search space grows but I still think its interesting how performant this was.

TLDR: I'm so data structures and programming pilled that I forgot basic algebra.

code

from os.path import dirname,realpath,join

def profiler(method):
    from time import perf_counter_ns
    def wrapper_method(*args: any, **kwargs: any) -> any:
        start_time = perf_counter_ns()
        ret = method(*args, **kwargs)
        stop_time = perf_counter_ns() - start_time
        time_len = min(9, ((len(str(stop_time))-1)//3)*3)
        time_conversion = {9: 'seconds', 6: 'milliseconds', 3: 'microseconds', 0: 'nanoseconds'}
        print(f"Method {method.__name__} took : {stop_time / (10**time_len)} {time_conversion[time_len]}")
        return ret
    return wrapper_method

def binary_search(low_point, high_point, record_distance,record_time,min_or_max):
    if min_or_max == 'min':
        # custom binary search algorithm for minimum charge time to surpass the target distance
        while low_point < high_point:
            mid = (low_point + high_point)//2
            if ((record_time - mid) * mid) > record_distance:
                # if it is valid then we mark it as the high_point and continue searching
                high_point = mid
            else:
                # if it is not valid then we check if the next number up is valid and that should be the minimum time
                if ((record_time - mid + 1) * (mid + 1)) > record_distance:
                    return mid + 1
                # else we continue searching
                low_point = mid + 1
    elif min_or_max == 'max':
        # custom binary search algorithm for maximum charge time to surpass the target distance
        while low_point < high_point:
            mid = -((low_point + high_point)//-2) # math trick to do ceiling division
            if ((record_time - mid) * mid) > record_distance:
                low_point = mid
            else:
                # if it is not valid then we check if the next number down is valid and that should be the maximum time
                if ((record_time - mid + 1) * (mid + 1)) > record_distance:
                    return mid - 1
                # else we continue searching
                high_point = mid - 1

@profiler
def solver(input_str: str) -> tuple[int,int]:
    part_1_solve = 1
    for record_time,record_distance in zip( *[ [ int(number) for number in line.split()[1:] ] for line in input_str.split('\n') ] ):
        minimum_time = binary_search(0,record_time//2,record_distance,record_time,'min')
        # maximum_time = binary_search(record_time//2,record_time,record_distance,record_time,'max') # before I realized it was parabola lmao
        maximum_time = record_time - minimum_time
        part_1_solve *= maximum_time - minimum_time + 1

    # part 2
    # instead of splitting the numbers into multiple pairs, we will just remove the spaces and have one pair of numbers for time and distance.
    record_time,record_distance = [ int(line.replace(' ', '').split(':')[1]) for line in input_str.split('\n') ]
    minimum_time = binary_search(0,record_time//2,record_distance,record_time,'min')
    # maximum_time = binary_search(record_time//2,record_time,record_distance,record_time,'max') # before I realized it was parabola lmao
    maximum_time = record_time - minimum_time
    part_2_solve = maximum_time - minimum_time + 1

    return part_1_solve,part_2_solve

if __name__ == "__main__":
    BASE_DIR = dirname(realpath(__file__))
    with open(join(BASE_DIR, r'input'), 'r') as f:
        input_data = f.read().replace('\r', '').strip()
    result = solver(input_data)
    print("Part 1:", result[0], "\nPart 2:", result[1])

view more: next ›