Jump to content

3.14159

Member
  • Posts

    15
  • Joined

  • Last visited

Awards

This user doesn't have any awards

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

3.14159's Achievements

  1. I would like to second CodeWars as an excellent resource for coding "puzzles". As a beginner I found the easy puzzles on this site the most approachable. Two more similar "puzzles" resources: HackerRank LeetCode Books: But How Do It Know? by J. Scott. Hardware Basics in layman's terms C Programming: A Modern Approach by K.N. King. Massive comprehensive resource; best "textbook" source I've used. Online courses in roughly 20 programming languages: SoloLearn (also has a phone app for those who like to learn that way) C Basics on YouTube (Controversial link - but I found the material too helpful to not share.) Online Programming in C for Beginners It appears the author has not visited for > 1 year, but hopefully someone finds these helpful!
  2. Yes, once I start programming more. At the moment (and with my current very short scripts) I find it more of a distraction or mild hinderance. I have to restrain myself from typing <shift> <"> and instead arrow over. Obviously this is a minor gripe, mainly wanted to see if I was even using it right lol. Like you said, with more practice I'm sure this will become natural.
  3. Gotchya, that makes sense. Maybe when I start writing code that requires more than a dozen lines I'll appreciate this feature more.
  4. Hello, As a very new programming student I am a bit confused by the "autocomplete" feature. Specifically I'd like to talk about the double quotes (programming in C). If I write something in double quotes and the second double quote is auto-generated, I still have to arrow over the character in order to close the parens or do whatever next. Am I doing something wrong? I feel like using the arrow key to skip over the auto-generated double quote is in no way a time saver compared to just typing <shift> + <">. Cognitively I find it easier to just type the second <"> naturally. Same with parens and even braces. I feel like I'm not using this feature right, is there another key to press that will automatically skip you to the end of the autocompleted text or something? Sorry if this is question is too basic - I'm literally brand new to this stuff. Looking forward to your responses! edit: in case anyone is wondering I'm referring to this feature as used in codewars.com editor, but I believe I've seen it around other places too.
  5. I follow - thank you everyone for the explanations. Will play around with this some more, or maybe just move on I'm getting tired of thinking about this one lol.
  6. Interesting comments about malloc(0). Was playing around with different values in there and I was also surprised when zero worked. I left it in there just to see if it triggered any comments from you all! Regarding the memory leak - it appears you are saying it is preferable to not put the burden on the function doing the calling. This makes sense to me, no need for a called function to require "clean up" after it's called. However, I still couldn't get the code to run without malloc. Replacing line 8 with char out[16]; occasionally passed one of the three "tests", but usually crashed. Here is the error message: solution.c:20:10: warning: address of stack memory associated with local variable 'out' returned [-Wreturn-stack-address] return out; ^~~ 1 warning generated. It looks like the "out" variable (when declared as "char out[16]") cannot be used as a return value as it is local to the function (??). Just for kicks I wrote a script and compiled on my computer and got the same error message. edit: the message is just a warning but the function doesn't actually return any value when called.
  7. Hello, I was hoping someone could offer some insight on my code below. I am learning to code C and still learning the fundamentals. Description of function: The following function written in C (written for a "codewars.com" puzzle) takes a string as an input and returns a fraction indicating how many characters are not "between" 'a' and 'm'. These characters are called "errors". The fraction is formatted and returned as a string ( error characters / total characters ). My working solution is below, along with the non-working solution second. I have a few questions regarding the solution: 1) Why does the pointer "out" need to be malloced? - my thought is because strings in the "stack" cannot be written, but I'm not certain if this is the reason (or if it's even true). 2) Is there a way to write this program without using malloc( ) ? 3) If malloc is used inside the function, how can I free the pointer "out"? - I read you should always free any memory allocated with malloc( ) link to problem description: "Printer Errors" Thanks in advance. Any general comments on my code are always welcome. -DR note: The only difference is on line 8. Working code: #include <stdio.h> #include <string.h> #include <stdlib.h> char* printerError(char *s) { int i = 0, errorCount = 0, totalChars; char * out = malloc(0); totalChars = strlen(s); for( ; i < totalChars; i++) { if (s[i] < 0x61 || s[i] > 0x6D) { // This tests if s[i] is a char between 'a' and 'm' errorCount++; // If s[i] is not bewteen 'a' and 'm' it is an "error" } } sprintf(out, "%d/%d", errorCount, totalChars); return out; } Non-working code: #include <stdio.h> #include <string.h> #include <stdlib.h> char* printerError(char *s) { int i = 0, errorCount = 0, totalChars; char * out = "This is a string"; totalChars = strlen(s); for( ; i < totalChars; i++) { if (s[i] < 0x61 || s[i] > 0x6D) { // This tests if s[i] is a char between 'a' and 'm' errorCount++; // If s[i] is not bewteen 'a' and 'm' it is an "error" } } sprintf(out, "%d/%d", errorCount, totalChars); return out; }
  8. Got the Transcend drive to successfully boot fedora. Also tried installing Arch on my Samsung SSD and that failed too. I think it's safe to say the problem is something I'm doing and not the hardware. For now I will have Windows on Samsung and fedora on the Transcend.
  9. One last thing: When I go into "Secure Erase+" in BIOS advanced settings I get the same menu as the SSD Self-Test from my previous post post except they both say "Ready". I didn't erase either SSD but it seems like sometimes the board can recognize the Transcend SSD.
  10. I did indeed install an OS on the EFI partition, here is the part of the tutorial I followed where the bootloader is installed on the EFI partition. Also I just confirmed secure boot is disabled in BIOS. One thing I just came across while confirming those - in BIOS there is "NVMe SSD Self-Test" (last option under settings\advanced). When this self-test is selected the menu looks like this: M2_2 Samsung SSD 97 Ready 500GB M2_1 TS128GMTE... Not Support 128GB (Currently have both SSD plugged in). I abbreviated the Transcend SSD name, but does this mean this MSI board cannot support this card? I seemed to have no trouble making modifications to it during the Linux install.
  11. Hello, I am having trouble booting from this Transcend SSD I got off Amazon. I bought it as a second drive to boot linux. My first drive (Samsung 970 SSD) has no trouble booting in both PCIe slots on my MSI Z490m board. I installed Windows on that SSD and it runs fine. The Transcend SSD is recognized by the board - it appears in BIOS under "Storage" - however is not present in the Boot Priority list or Boot Menu. Are some SSD not usable as a boot drive? I don't understand why it's not on the Boot Priority list. I've tested in both slots with and without the second SSD present - not sure what else to try. I just spent the last few hours installing Linux on this SSD and I had no trouble partitioning and writing to the SSD while installing linux (Arch). Thanks again for any help. DR
  12. Just a follow up - installed RAM and there were no issues at 1.2 V. No need to change any settings (as you may have all already known).
  13. That's good to know - I'm gonna have to do some research to understand exactly what you mean! Thanks for the responses.
  14. Thanks - what about the voltage? Are CPUs designed to run with any voltage RAM or one specific voltage? I have seen mainly 1.35V and 1.5V but I don't see any mention on intel's specs.
  15. Hello, First time PC builder here - I have a question about RAM compatibility. How do I check if my CPU is compatible with the RAMs voltage rating? I have an Intel i3-10100, but I can't find anything about RAM voltage on the processor product page (see link). The ram is OLOy DDR4 (2x16, 3200) which is 1.35 volts. For reference I am building on an MSI Z490M. Please let me know if I can provide any other necessary information. Thanks for any help, -DR
×