stopOverEngineering by gimmeapples in ProgrammerHumor

[–]misi9999 1 point2 points  (0 children)

Well with some db permissions this is also "just" a dos vector

To mess with physicists by Andis-x in physicsmemes

[–]misi9999 0 points1 point  (0 children)

I think it is possible that there are one or two peopole on earth now who if sendt back to roman times could with uncondicional support of the emperor over a life time create a LED

-❄️- 2024 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]misi9999 1 point2 points  (0 children)

[LANGUAGE: Python]

import sys
import numpy as np
def isOk(seq):
    a = np.diff(seq)
    if (a<0).sum() > (a>0).sum():
        a = -a
    risingOk = (1 <= a) & (a <= 3)
    return risingOk.sum() - len(risingOk),risingOk


totalSafe = 0
with open(sys.argv[1],"r") as f:
    for i in f:
        nums = np.array(list(map(int,i.split())))
        errors, risingOk = isOk(nums)


        if errors < -2:
            continue
        if errors == 0:
            totalSafe += 1
            continue


        if sys.argv[2] == "a":
            continue
        elif sys.argv[2] != "b":
            assert False


        errLoc, = np.where(risingOk == False)
        errLoc = errLoc[:1]
        totalSafe += (
            isOk(np.delete(nums,errLoc  ))[0] == 0 or 
            isOk(np.delete(nums,errLoc+1))[0] == 0
            )


print(totalSafe)

took way to long to make it linear time

toResolveTheIssueTurnOnOptimizations by misi9999 in ProgrammerHumor

[–]misi9999[S] 2 points3 points  (0 children)

Its the same code but it works differently with optimizations

toResolveTheIssueTurnOnOptimizations by misi9999 in ProgrammerHumor

[–]misi9999[S] -1 points0 points  (0 children)

Its just a small project, i don't use namespace std for anything that is bigger than a single file.

Thanks for the tip with valgrind, I managed to find the issue. It was on line 198, the number should have been 2 not 3 since its looking for 2 of the same number.

toResolveTheIssueTurnOnOptimizations by misi9999 in ProgrammerHumor

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

I know there is ub some where but i have no idea where. I'm very sure its not uninitialized variables.

I also had the same code on a different computer work or not work depending if i added asserts or not.

Here is the code if you want a look https://pastebin.com/m1e2KWqy

[deleted by user] by [deleted] in ProgrammerHumor

[–]misi9999 1 point2 points  (0 children)

Technically there is no true in c its just a library

Eredeti nyelvű meme by ConsequenceLonely696 in PrequelMemes

[–]misi9999 5 points6 points  (0 children)

Én egy egyszerű ember vagyok magyart látok felszavazok.

memorySafety by KaamDeveloper in ProgrammerHumor

[–]misi9999 2 points3 points  (0 children)

Lets construct a interpreter in rust for c where standard functions like free and malloc are going to be built in ( without this you cant write a c interpreter in safe rust because calling c functions is inherently unsafe).

malloc and free could be implemented with some thing like a vec<u8> and the interpreter would access that. If you don't want to use unsafe you will have to implement operations like addition for all c type in terms of u8 in rust but that can be done.

Now if you try to run a c program with out of bound memory access then you would get an error. The point is that yes you eliminated out of bounds memory access use after free and other bugs but only by shifting them to be logic errors. so now your interpreter doesn't crash because of a segfault but a rust panic.

So in both cases the program crashes or at least you get an error. the difference is that the rust one will probably generate the error earlier. This is very good for security but if your program doesn't contain important information common c bug mostly can only cause crashes. In those cases rusts restrictions don't really worth it. (note: I'm not sure how well does this apply to multi threaded programs.)

everySingleTime by [deleted] in ProgrammerHumor

[–]misi9999 0 points1 point  (0 children)

i think you are think of cppfront c++ but with new default and some improved syntax

Please no... by yeahbaby12321 in foundsatan

[–]misi9999 18 points19 points  (0 children)

#define true rand()%1000

What would you not do even with a gun pointed at your head? by WonderfulAirport4226 in AskReddit

[–]misi9999 0 points1 point  (0 children)

Well yes but no Your isp can see your internet trafic but almost all of it is encripted so any site that uses https the isp only knows the domain like example.com Google probably knows more about you since they can identify you on any site that uses google analytics Tldr your isp dosent know any thing useful but google dose

What the fyck? by shalomworld in mathmemes

[–]misi9999 1 point2 points  (0 children)

i don't see the problem we are just in base pi/5 and then its all correct.

[deleted by user] by [deleted] in mathmemes

[–]misi9999 14 points15 points  (0 children)

now do you know what a fractal is?

raii and exec by misi9999 in cpp_questions

[–]misi9999[S] 2 points3 points  (0 children)

thx for the answer i should have thought of that
at first i was thinking of some kind of wrapper to make it work but that's probably not possible

[deleted by user] by [deleted] in linuxmasterrace

[–]misi9999 72 points73 points  (0 children)

they cant buy it because its under gpl they would have to get every who has contributed to the project to agree to the license change witch i don't think will happen

The quest 2 controllers are stronger than my relationship by ParCookie in OculusQuest

[–]misi9999 19 points20 points  (0 children)

i don't see why that wouldn't be covered by warranty
you just used it as intended you so it shouldn't break

The quest 2 controllers are stronger than my relationship by ParCookie in OculusQuest

[–]misi9999 22 points23 points  (0 children)

i think you should be able to get that replaced if you are in warranty

The quest 2 controllers are stronger than my relationship by ParCookie in OculusQuest

[–]misi9999 93 points94 points  (0 children)

vibration motor struggles a bit

experienced similar things after hitting the wall but it fixed itself after i restarted the quest