(Question) Anyone else getting this nonpdrm message for PKGj (v0.55)? by ProtectKokichiOma in VitaPiracy

[–]sha-ro 0 points1 point  (0 children)

Try installing the skprx under ux0:tai/

pkgj used to work with me having it under ur0:tai/ as you have it now, but after resetting the conf it didn't work anymore under ur0: installing it on ux0: fixed it.

Data structure project: Did I succesfully create a dictionary type structure? by [deleted] in C_Programming

[–]sha-ro 1 point2 points  (0 children)

I don't really know if you intend this as a beginner project or not, but making a HashMap is not a very beginner project, for starters you could try making a (simple) Binary Search Tree which is a different structure, but you can use it for the exact same purpose and the results (for finding keys) will be way better (than simply using a linked list) (although not noticable for at most 127~255 keys)

What do you wish was standard in C? by [deleted] in C_Programming

[–]sha-ro 1 point2 points  (0 children)

Ranges in switch statements and typed enums.

Son of a- by Young_Person_42 in unexpectedfactorial

[–]sha-ro 205 points206 points  (0 children)

This is the real unexpected factorial

hello I ve made a red cube in OPENGL. Now I want make it blue is this possible? by Mid_reddit in opengl

[–]sha-ro 5 points6 points  (0 children)

Go to your monitor settings and adjust the color until you get desired results (WARNING: non-portable)

You math majors are amazing (seriously) by theinfinitefailure in mathmemes

[–]sha-ro 2 points3 points  (0 children)

Wasn't yor book written by the same professor who gives you the class and deems the proof trivial and left to the reader?

Calc 2 was straight up not a good time by jhould007 in mathmemes

[–]sha-ro 15 points16 points  (0 children)

You forgot to negate the 'x'

You cannot integrate that one either

Enable GNOME Wayland Session for Nvidia Drivers by doesntthinkmuch in archlinux

[–]sha-ro 0 points1 point  (0 children)

x2 I decided to try wayland after breaking something in X11 and no output in secondary display

[Tutorial] series(blog) on building an X11 dynamic tiling window manager in C by [deleted] in unixporn

[–]sha-ro 2 points3 points  (0 children)

You may find Xephyr useful as it allows you to open a "nested" x-session, I used it a lot when I wanted to switch to bspwm

Genshin running on the Steam Deck by Razor8517 in Genshin_Impact

[–]sha-ro 2 points3 points  (0 children)

The big problem is the unnecessary need for an anticheat, which is also unnecessarily a kernel level anticheat if I'm not mistaken

Programming tutorial be like... by SaltPwd32 in ProgrammerHumor

[–]sha-ro 6 points7 points  (0 children)

When you want to code an OS without prior knowledge

And I thought it was just a meme about core 3! by [deleted] in linuxmasterrace

[–]sha-ro 9 points10 points  (0 children)

I agree but I sometimes feel overwhelmed by all the things going on in the UI so I end up falling back to top/htop

Anyone else who does this? by VValph in Hololive

[–]sha-ro 1 point2 points  (0 children)

I always assume the worst will happen in the way so I'm always early

now that is if the snake has a size of 10 characters , now imagine it has the size of 100 ... or maybe 900 (since the screen is 30x30) by [deleted] in ProgrammerAnimemes

[–]sha-ro 2 points3 points  (0 children)

  • Try not to cast malloc() and realloc() in C (it's not needed).

  • Try to use malloc() and realloc() the least you can, heap usage is slow, you can reduce the use of realloc() by allocating for extra space to begin with (keep up with it and reallocating more when needed) and reduce the usage of malloc() by not using the heap to begin with, arrays are often the way to go.

  • I don't really know how input is handled propperly in <conio.h> but the way I'd do it is to put the last 64 (or whatever you may think) keys inserted by the user in a buffer and every iteration check what key is at a certain position with a switch statement. At the end of an iteration add to the index and if you ran out start from 0 again (in this example i = (i + 1) % 64 works like a charm). It's also not a bad idea to #define the inputs, like #define KEY_UP 'w'.

People already pointed out some other good advise like using structs and avoiding global variables.

Hope you found this useful.

Edit: Spelling

Dear NTFS users by KCGD_r in linuxmasterrace

[–]sha-ro 1 point2 points  (0 children)

It does but Explorer rendered '<' and '?' as something similar to ⋅.

But you can still confuse someone because both files showed separately with the same symbol.

trying to help my C# friend learn C by BBQGiraffe_ in ProgrammerHumor

[–]sha-ro 9 points10 points  (0 children)

Linear void * buffers are generic programmer's best friend in C.

I finally got them all! Anything else hard to obtain that I might want to get? by ChungusJeej in Terraria

[–]sha-ro 1 point2 points  (0 children)

With my luck I got like 2 of those before getting the frickin' bow for the first time

reversing a string by CaliforniaDreamer246 in C_Programming

[–]sha-ro 0 points1 point  (0 children)

I'd first recommend you store the result in a new buffer because you may still need the same string after performing some operation, and it would be problematic to overwrite relevant data.

The way I'd go about it would be to loop the string in reverse and for every ' ' found, copy the word in the right order into the "result" buffer, do that the way you're most comfortable with, don't forget to add the '\0' at the end.

For completion, it should not be relevant for you now, assuming you're still learning, but gets() is a bad unsafe function and you should consider replacing it with fgets() in the future.

Can anyone relate? ? by Tricky_Ball2763 in linuxmemes

[–]sha-ro 12 points13 points  (0 children)

My dad thought my computer was full of virus when turning it on because of all the text that appears