lainchan / λ

The Beginner's General

λx.x · 2020-06-07 05:54
This is the Beginner's General for beginners' questions. If you have a simple question and a suitable thread doesn't already exist, just post it here and someone will probably try to answer it for you. Remember to do some research before asking your question. No one wants to answer a question that a simple search can already resolve.
Jane Doe · 2020-06-08 00:00
For someone interested in actual computer science, i.e. the knowledge underpinning all of it instead of just programming, are there decent career opportunities outside academia? Apart from elite research institutes like Bell Labs. I can't think of a job involving that area that isn't research or teaching.
Splicer · 2020-06-09 12:12
>>19079 What's the best book reading order for common lisp? I'd like to learn how to write (readable/performant/expressive) lisp for a research opportunity at my uni. I was currently thinking something like this: >Practical Common Lisp >On Lisp >Let Over Lambda Is there anything else you guys would recommend? >>19095 There's a lot of CS research that's being done by companies nowadays. It's mainly companies who need very performant servers/code/programmers and are willing to do research in-house. There is a lot of programming in any CS job, though. The day-to-day at bell labs/xerox park is writing code, from my understanding.
Chani · 2020-06-09 12:22
>>19112 Give this a read, it's a very comprehensive article which I'm following https://stevelosh.com/blog/2018/08/a-road-to-common-lisp/ tl;dr is > Common Lisp: A Gentle Introduction to Symbolic Computation >Practical Common Lisp >Make something with lisp, e.g. solve project euler problems >Paradigms of Artificial Intelligence Programming >Common Lisp Recipes >On Lisp >Let Over Lambda And many more
Ender · 2020-06-09 12:54
>>19114 This looks great - it seems to be mildly redundant (Practical Common Lisp seems to be fine as an entry text), but PAIP looks interesting and his advice about Emacs+SLIME is also useful.
Lain Iwakura · 2020-06-09 21:34
What's the best way to learn Python for the purpose of landing an entry level job? Books, Tutorials, etc.
藤原純一 · 2020-06-10 01:14
What is the shortest book to learn Java? I need for my uni, research related. I know how to program already, so I just need the essentials.
J.C. Denton · 2020-06-10 03:08
>>19137 >I know how to program already https://learnxinyminutes.com/docs/java/
Jet Black · 2020-06-10 12:36
I am a complete idiot and i don't know first thing about programming or linux or how computers work i just sit at my computer to browse the internet pretty much all day and try to waste time. I found out about the windows terminal however yesterday and i got really interested because i can input commands to do things faster (like reaching a file). Can someone share ressources about commands, keyboard shortcuts and stuff about debloating/optimizing your computer ?
Gyula Kovacs · 2020-06-10 13:26
>>19134 Heads up: don't end up wasting your time by trying to find the best way to learn something instead of just learning it. Most of the time you'll be better off just starting with something. That being said, get a book about Python programming that fits what you want to learn. If you want to learn it to get a general entry level job, choose something like "Learning Python", written by Mark Lutz and published by O'Reilly. If you don't want that book you can probably pick any other general Python learning book. I'm recommending a book as (imo) tutorials on YouTube or wherever else most of the time leave a lot of important details out. A book is very well thought about and tries to touch on important topics, be it big or small.
Cat Mother · 2020-06-10 14:46
>>19146 you cant get a job by just knowing python. They demand hardcore machine learning and devops knowledge for even entry level jobs now
another being · 2020-06-10 15:22
>>19148 The Coursera Course on machine learning by "Andrew Ng" is a fantastic place to learn machine learning (according to data scientist ive talked to). I'm trying to go through the course soon as well
Meddler · 2020-06-10 17:19
I have been given the task at work to debug a program that we use. I don't have any steps to replicate the bug. The code base is around 5000 lines of spaghetti code. I can't use a debugger because the code is run through multiple layers of abstraction ( A server runs the code through the JVM and it's written in JavaScript using RHINO). My question is are their any tactics that I can use to be more efficient? Currently I am reading the code line by line and documenting the code as I read. My hope is that the bug is so apparent that I see it when I read it.
Hitomi · 2020-06-10 18:41
What's the best career path for someone who wants to work from home? It might start with working at an office location but being able to work remotely eventually. I don't want to live in a big city to get a nice wage.
Lady Jessica · 2020-06-10 22:35
>>19153 Maybe security, find bugs and get paid for them. You don't need to get hired to do it. https://hackerone.com/directory/programs
Unknown · 2020-06-10 23:36
>>19155 Thanks, had never heard of that. Are those bounties per bug found? If so it looks like it might be hard to make a living from it. I was already attracted to security, but I have the impression that well paid gigs within the area would be in a company managing their system's security(unless you're some pentester wonderkid)
Unnamed · 2020-06-11 11:24
>>19145 On Windows there should be something called 'Help', probably accessible in a search bar looking thingy. I don't know what Windows looks like nowadays... If you can't find Windows help try the internet. It is a rite of passage to sink 3+ hours reading the keyboard shortcuts help... It could be worse, it could be the builtin Emacs tutorial. It doesn't sound like you want/need to jump into full-fledged programming all at once (though you could...) Generally puttinh `/?` after a command name (in windows console) will display help. GNU/Linux commands usually do that with `--help`. The console may be able to do `IF` statements but just try basic commands first. https://www.thomas-krenn.com/en/wiki/Cmd_commands_under_Windows https://helpdeskgeek.com/help-desk/21-cmd-commands-all-windows-users-should-know/
Roy Batty · 2020-06-13 14:21
What's a good resource for getting into / understanding Linux Driver development? In case this is a "x is dumb, do y" situation, I'm wanting to look into porting some (open source) graphics drivers FROM linux to FreeBSD for example
Nobody important · 2020-06-15 13:07
>>19193 Randall Hyde's Understanding The Machine?
Iverson · 2020-06-15 13:11
I'm beginning to work on 'Eloquent JavaScript' and I'm not understanding something to do with conditionals. A solution to an exercise is: for (let n = 1; n <= 100; n++) { let output = ""; if (n % 3 == 0) { output += "Fizz"; } if (n % 5 == 0) { output += "Buzz"; } console.log(output || n); } But if I instead run this slightly different code which has an "else" at the final console.log instead of nothing: for (let n = 1; n <= 100; n++) { let output = ""; if (n % 3 == 0) output += "Fizz"; if (n % 5 == 0) output += "Buzz"; else {console.log(output || n); } } Then numbers divisible by 5 output as "Fizz" instead of "Buzz" and the number 100 isnt printed. Can someone help me understand whats happening here? Sorry if this is a stupid question
Cutter · 2020-06-15 13:36
>>19219 So, your else there is only for the last if. It's like: if is true, print this; if is not true, then go to else; Else is always true, however, it only happens if the if(or many else if) it's "connected to" is false. In the solution to the exercise, there is no else, so the code flows like this: if n is multiple of three, concatenate "Fizz" to output; if n is not multiple of three, then do nothing. //there is no else related to this if if n is multiple of five, concatenate "Buzz" to output; if n is not multiple of five, then do nothing; //there is no else related to this if now print output or n; So, as you can see, at the end of the code either n or output are printed. Now, this is how your "else" one goes like: if n is multiple of three, concatenate "Fizz" to output; if n is not multiple of three, then do nothing; //there is no else related to this if if n is multiple of five, concatenate "Buzz" to output; if n is not multiple of five, then print output or n; //there is an else here related to this if So as you can see, if n is multiple of five, that else is never going to happens and so multiples of fives are not printed.
Unsigned · 2020-06-15 13:37
>>19219 I think the second 'if' needs to be 'else if'. Right now, you have an unconnected 'if' and then a separate connected 'if' and 'else'. However, this doesen't match the behavior you described and I don't have time to check it. Good luck.
Emmanuel · 2020-06-15 14:20
>>19220 Aha, that has helped me a lot, I understand it now. Thanks very much!
Ishikura "Tatsu" Tatsuhiko · 2020-06-15 22:35
>>19218 Not sure that's what I'm looking for, but it's definitely something I want to have regardless, thanks anon
aliased · 2020-06-18 11:34
I want to learn to program, I want to know something and be a useful person. Let me preface that by saying: I took some Java and C++ courses a lifetime ago, but have forgotten a good amount and confused the rest. The biggest impediment for me was always setting up compilers and IDEs, this undoubtedly sounds stupid and it makes me feel stupid, but it seems like these things run on magic and use terms and names I don't know and am not even expected to know but was expected to use, like the difference between Clang and GCC, or why Eclipse just wouldn't work sometimes because I didn't setup directories exactly like it wanted. Anyway, I would like to start again, this time with either Python or Javascript. I am asking for a textbook recommendation to guide me in this process, not just learning the language but setting things up to use it, I am on Windows. >>19146 Is this a good book? Or maybe the newer edition? I looked around in the various share threads and many posts say "they found" their shares and are just sort of dumping them and that discourages me. I'd like a recommendation that someone has actually used. Thanks for reading my stupid blogpost.
Boris Grishenko · 2020-06-18 14:25
This might be really stupid but can anyone explain the difference in behavior here? I'm trying to understand LinkedLists in C++. class node { int x; node *next; }; int main() { node *root; // This will be the unchanging first node root = new node; root->x=3; root->next = 0; } My question is why do you need the line "root = new node; " when you've already declared root? You would be able to assign things to the contents of the class if I remove the dereference operators, so I guess my question is, doesn't the compiler automatically create the variable and/or location in memory in the declaration "node *root;* like it would with "int x" or something? Why is "new" required exactly?
Y.T · 2020-06-18 14:45
>>19272 >node *root; This is a pointer, a pointer should always be pointing to some memory, in this case, your pointer is pointing to some garbage memory, which you don't want to deal with. > root = new node; In this line, your pointer now points to a new memory that has class node size. It's "tailored" to your pointer, it's not a garbage memory anymore. When you use a pointer, you either pointer it to the memory of another variable or your use the heap(new or malloc) to get a new memory for you. By default, it points to something you don't want to touch nor put some values inside it, that is how bugs and whatnot are created. I think you should read a little about how pointer works in C++, it will help you a lot.
aliased · 2020-06-18 15:03
>>19273 Ah, this helped. The real problem was I was relying too much on the compiler without understanding the meaning of what was happening. It doesn't give you an error in some cases where you screw up, and the behavior seems to change in some cases but it actually doesn't because there's multiple meanings for some terms...I was going crazy because of misunderstandings, like int *foob; cout<<foob; would print the memory address but int *foob=0; cout<<foob; would print the value, or so I thought, I am assuming an address of 0 is what's actually being printed here, "0" is a special term with multiple meanings. If I tried any other number this would have become obvious but I used 0 first and well, here we are. I think I've got it now.
Nobody important · 2020-06-18 23:31
Well, here's a hail marry I guess. I'm an inch away from understanding this LinkList example so please forgive my trespasses. #include <iostream> using namespace std; struct node { int data; node *next; }; class linked_list { private: node *head,*tail; public: linked_list() { head = NULL; tail = NULL; } void add_node(int n) { node *tmp = new node; tmp->data = n; tmp->next = NULL; if(head == NULL) { head = tmp; tail = tmp; } else { tail->next = tmp; //tail and head next are completely identical here tail = tmp ; // head->next remains the same but tail next becomes null here } } void display() { node *tmp; tmp = head; while (tmp != NULL) { cout << tmp->data << endl; tmp = tmp->next; } } }; int main() { linked_list a; a.add_node(1); a.add_node(2); //a.add_node(3); //a.add_node(4); //a.display(); return 0; } My concern has to do with the 2 lines: tail->next = tmp; //tail and head next are completely identical here tail = tmp; // head->next remains the same but tail next becomes null here The question fundamentally is, doesn't " tail->next = tmp;" change both tail and head because they share the same address? But they still share the same address in the next line "tmp = tmp->next"; but this time they don't both change identically. You can also make the 2nd line into "tail = tmp;" and it'd be equivalent, maybe that's cleaner, but I still don't understand why the values of head don't change here despite sharing an address with tail. Please from me from this neurotic fire in my soul, I can be at peace once I understand this.
Motoko Kusanagi · 2020-06-19 05:40
>>19284 >doesn't " tail->next = tmp;" change both tail and head because they share the same address? Nope. They point to the same address, they don't share the same address(every variable has its own address, including pointers, but you never access their own address, only the ones they point to). Suppose I have this simple code: int example1 = 10; int example2 = 20; int *p1, *p2; p1 = &example1; p2 = &example1; // here both p1 and p2 points to the same memory p2 = &example2; // here I changed who p2 points to, it didn't affect p1. p1 still points to example1's memory. Which is what you have in your code. You changed only who tail pointed to, it didn't affect who head was pointing to. >// head->next remains the same but tail next becomes null here Because head never changes who he points to(the first node you created), but you use tail to change who it points to to keep the nodes connected. The first time "else" is executed you have both head and tails pointing to the same node, so the first time the line >tail->next = tmp; is executed it is the same as: >head->next = tmp; This is however only the first time else is executed, the line after this, you have this: >tail = tmp The first time this is executed, you have exactly this: >head->next = tail; However, tail->next is null because tail is now appoints to tmp and some lines above you have >tmp->next = NULL; So every time you call this function, you are connecting a new node(make the last node point to this new node) and making tail now point to this new node so that you never create a new node and loses it memories, which is something that you don't want to happen because then you can't free it and you have leaked memory in your code. You also have head fixed in the first node you create because then you can "walk" into your nodes by just using next, since thanks to your tail, you kept all your nodes connected one after the next one(you don't need tail, but it makes thing easier, since you can easily access your last node by checking who tail points to among other things). If you changed who head pointed to, then you would have leaked memory because you can only check nodes ahead of head, not those that come before it in a linked list(you can in a double or circular link, however). Which is why you keep head fixed, but change who tail points to every time. As long as you have the first position in your linked list, you can avoid leak memories since you can access any of them thanks to it. As long as you keep adding nodes and connecting them right, that is.
quote · 2020-06-19 15:11
So you're telling me that when I use malloc and never free it, then it stays in memory in the heap? For how long? Is the heap used because you need to store things at the end of the stack and heap is a vast empty space? I heard that automatic garbage collection needs a lot of overhead, can't it just be freed when you return from the function?
Y.T · 2020-06-19 16:31
>>19299 >can't it just be freed when you return from the function? Suppose this happens, then we have this: void add_node(int n) { node *tmp = new node; tmp->data = n; tmp->next = NULL; if(head == NULL) { head = tmp; tail = tmp; } else { tail->next = tmp; tail = tmp ; } } Now you can't access tmp(our tail) anymore, why? Because the memory it points to was freed. That didn't help us, right? What was the point of allocating memory if you just lost it at the end, might as well just use the stack. >For how long? Until you close your program. Or you keep allocating memory and not freeing it until two things happens: You don't have memories anymore and thankfully you checked if tmp was null(you never checked in your code) and something happens(the program exit or whatever you decided to do if tmp == NULL after new/malloc). Your computer stops and you have to reboot it. Always check if the memory you got is NULL or not.
Chani · 2020-06-23 01:32
Speaking specifically of C. How do the compilers deal with function calls? Say, when the compiler finds the function call what does it do to execute it's code? I have no problems visualizing it 'moving' to another file to run the code on it but i have some trouble understanding how does it do that in the same file when a function is defined at the end of it, as I've read that in C the compiler only goes once trough each file, no 'double searching' so how does it do what to do then?
progn · 2020-06-23 01:33
>>19336 know what to do*
overriding · 2020-06-23 08:41
>>19155 Sites like that just piss me off, to have the knowledge to fix those issues you'd already have to know enough to land you a well-paying salary at a tech company. Unless you're real lucky, it would only serve as a side job for a little extra cash. Most of those bounties are seriously underpaying for what you're doing for them, as well.
Kay · 2020-06-23 13:17
>>19336 It depends on the system, usually function args are either put on the stack or in certain registers, the return address pushed on the stack (or possibly put in a register) and then a CALL instruction. The actual process can have complications beyond that on some systems, it is common to have a base pointer pushed on the stack. https://stackoverflow.com/questions/14765406/function-prologue-and-epilogue-in-c https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gccint/Function-Entry.html etc. Most discussion of these issues focus on x86/x86_64. C typically uses one runtime stack per process. FORTH has two stacks, and Common Lisp has a different runtime model. But a bunch of languages like Pascal tend to be compatible or semi-compatible with C compiled functions (traditionally C and Pascal tended to pass args on the stack in the opposite order).
SHODAN · 2020-06-23 18:45
Should you start learning programming with Lisp or C/Assembly?
roll · 2020-06-23 22:25
>>19347 >Should you start learning programming with Lisp or C/Assembly? Imo Scheme is great and more pleasant than C, but the later is more useful. While using Scheme or any Lisp dialect, is good to use emacs with paredit to maximize productivity and forget about )))))
Unknown · 2020-06-23 22:28
>>19336 >How do the compilers deal with function calls? This is dependent on implementation and machine. Many processors have some support for subroutines, however light, typically in the form of call and return instructions. A RISC machine may lack these, because RISC machines tend to discard with plenty of useful instructions, in misguided pursuit of ideological purity. A subroutine call involves transferring control and passing parameters. >Say, when the compiler finds the function call what does it do to execute it's code? A C compiler doesn't necessarily perform any execution of code during compilation. A simple compiler would associate functions with addresses and begin spewing instructions relating to each statement. At function call, it would emit boilerplate which achieves transferral of control and, at the end of a function, return of control. >I've read that in C the compiler only goes once trough each file, no 'double searching' so how does it do what to do then? That's not necessarily true, and the language has asinine little tricks like #include guards and #pragma once because of this. This refers to single-pass languages, where everything must be declared before it's used, so a compiler may generally emit instructions as it reads the program text, without needing to revisit it. There are oddities of C which obscure this. Look at the Pascal language for a better example, especially if wanting to learn about compiler subjects. >>19347 I took Stallman's advice and tried to learn C, only to find it a horribly complicated language and stop learning it. C is a complicated language with many pitfalls, a syntax that allows grotesque constructs, and it will teach anti-facts and lead to anti-knowledge. Most of the people who claim to know C and call it simple don't seem to have actually read the standard; some programmers such as Linus Torvalds actually advocate for ignoring the standard; I'd advocate for learning a better language, instead. My advice is to learn a Lisp, pick between Common Lisp and Scheme, and learn an assembler language if wanting to learn more about how some machines work. Learning C won't teach much about abstract topics and will actively misguide when wanting to know what the machine actually does. People tend to have problems with C pointers, just because C uses awful and overloaded syntax for them; a pointer is just an address, which in most machines is just an integer; it's just indirection. Now, here are two threads to use for Lisp and assembler languages: >>15857 >>43
Nameless · 2020-06-24 18:25
>>19347 Start with Lisp. S-expressions are untouchable when it comes to depicting how the different elements of a program relate to one-another. With that said, you definitely should learn C at some point. Being able to do low-level stuff is very useful.
McCarthy · 2020-06-25 18:09
Do you define strict studying schedules for yourselves? I've tried doing it in the past and realized I couldn't quite keep with it long term, I tended to make unrealistic schedules, so I've become convinced that I fare better just trying to be productive during as many hours of my day as possible, instead of following a strict hour by hour breakdown. I'm asking this because I've been feeling overwhelmed lately, it seems there's just so much to learn and I'll never be able to do it, even when already looking at just one particular area. Maybe if I had started as a kid like so many did, but that's not me.
Trinity · 2020-06-25 18:38
>>19361 I have problem being realistic in planning, as well as in executing my studies and due engineering ops. Basically ending up doing that stuff almost non stop (baring sleep and other basic necessities). Get burnt out occasionally, when i just can't do any more of it and have to take a long break (couple months, some time more). Pretty ugly for a modus operandi.
Milner · 2020-06-25 18:57
>>19362 I've been getting "burn out days" about once a week, but I feel soykafty about it because it doesn't seem I accomplished enough the rest of the week to justify having a day off. This is especially bad when there are deadlines to be met and I'm running against the clock.
Cowboy · 2020-06-25 19:48
>>19363 These 'i haven't done/learnt/etc. shmuck' feelings - had them too. The best way to deal with those ideas for me was to be in a good company where your peers could tell you if you're doing bad, good or just ok. Don't get hung up ruminating your progress. Even if there is nobody to ask about it, you're most likely doing fine, whatever that means :). Better spend that energy somewhere else.
:^) · 2020-06-26 12:22
>>19361 Perhaps if you start a modest project. Something of decent size that warrants work into different areas that you consider relevant and on which to apply your recently acquired knowledge. Doing some bit of progress every day, even after just a week, results are going to start to show. It wil also force you to look up some succint information on a particular topic and to try to implement it, so you'll understand it better. If you're anything like me, too much theory may be essential to get a good grounding on a topic but you'll be lacking a foothold on actual practice, and you won't have anything to show (yourself) for it, making it seem like no progress at all.
list · 2020-06-26 20:43
>>19361 >>19362 Good news is I just learn this stuff for a hobby, so it's not like it's a big deal, but yeah I experience the same exact thing. I'll obsess over one thing, and get so burnt out I take long breaks from it. It's been about 2 months and I'm almost ready to go back to SICP after telling myself (and putting myself on the track to) finish it before ~august-september.
Neo · 2020-06-26 20:55
Quick, kinda stupid question. If I was to write a window manager, I would use Xlib/XCB right? That would be the appropriate tool for managing such a low level GUI? Toolkits wouldn't really work for that project, would it?
Kay · 2020-06-27 14:21
>>19079 Pls don't bully, I'm a noob. I need a WFH job, not because I want to, but because my country's economy is going down the drain and I need to save my son from being homeless. I'm a single dad and there aren't any job opportunities here. I don't have any IT background but I'm willing to learn anything. What skill could I learn fast to work remotely and that is enough to land an entry-level job as a 3rd worlder? If I can build a career of it, better, but if not, it's ok. Everybody tells me that sales are the way to go, not IT, but my Latin accent screws me over. The translation field is saturated. Others have recommended to learn infosec but apparently landing a remote entry-level job without an IT background is impossible. Any recommendation is welcome. Insult me if you want to, but please point me to where I should go next. Sorry for the blog.
Apoc · 2020-06-27 16:30
>>19396 The part about infosec is pretty true, people in the industry are pretty jaded with new people. I would highly recommend if you're starting from zero and want to learn more that you do webdev. Try and pick up HTML/CSS and Javascript. Some python is also good. Just pick a javascript framework based on on the job entries you see on a site like this: https://remote.com/remote-jobs/ If you can, try and take a couple of weeks or a month to really learn this stuff, and make a project with it. A fullstack webapp with python Flask, a javascript framework, etc. I think this is your best bet for getting your foot in the door. Good luck.
Backus · 2020-06-27 16:59
Beautiful picture, OP.
Six · 2020-06-27 17:40
>>19396 Others will probably have better information, and I don't wanna steer you wrong. But good luck! You can do it if you put your mind to it, and especially if you have a really good reason for learning it, such as you have. Just some words of encouragement. People are gonna be elitist about everything, but if you are making a living, or working towards something, don't worry about em. Just what I've noticed being around tech areas.
Hitomi · 2020-06-27 23:15
>>19397 >>19400 With one hand on my heart, I appreciate it. I'll start right now. Thanks for the advise and the positive vibes. I'll get back here to give an update as soon as I land anything. Once again, thanks anon.
:^) · 2020-06-28 03:49
>>19396 >my country's economy is going down the drain So we live in the same country then
Project 2501 · 2020-06-28 09:53
Why is programming graphics so difficult? I hate it. It makes me want to cut my veins.
cond · 2020-06-29 05:21
>>19269 The book is great. In the first chapter it walks you through isntalling Python and other basics, even teaching you what an "interpreter" is. If you decide to use this book, don't be discouraged by it's length. It covers everything from the basics to advanced stuff. You just need to get through the basics. Once you do, you can start building stuff and it's much more fun. I loved it, and it makes for a great reference too. I can sympathise with your frustration setting things up. What about starting with just a text editor instead of a full-blown IDE? Theres sublime text, Notepad++ and the like. Super simple, and enough for a language like Python (there are legitimate use cases for an IDE if youre using Java but I dont think you need one to write Python) Tex editors won't do for once you get to an intermediate level, but thats for you to think about later. Oh, and you should join discord channels or IRC channels (#python on freenode is awesome). The community is welcoming and the real-time nature is great for figuring out beginner stuff which you should be able to get fixed in minutes.
Neuromancer · 2020-06-29 06:49
>>19079 What's in your opinion the best tutorial/way to learn C++? I know very basic bash and I've tried learning python multiple times but I just end up super bored due to how bland all the tutorials are and not being able to actually use it to make cool-ish programs quickly.
Unnamed · 2020-06-29 12:29
>>19423 C++ is even more bland and will take you longer to make interesting projects. I suggest go back to python and stop using tutorials.
Fred Nurk · 2020-07-01 09:39
Z-buffering is really pain to solve
Morpheus · 2020-07-01 09:44
>>19440 I would show you the code, but it is the ugliest spaghetti code ever written in the history of mankind. It is so horrible, so extremely horrendous that you would probably get a stroke just from looking at it.
Linda Lee · 2020-07-01 09:50
>>19440 >>19441 But if you want to read it anyway, here it is. Read only at your own risk. Btw. z-buffering only works for walls of the object, but it doesn't work for objects themselves, which means that you have to place the objects that are far from the center first and the objects closest to the center last, or else you will get graphical glitches.
Nobody important · 2020-07-01 16:50
>>19442 Actually there is still a bug if you create an object that starts at the left side of the screen and spans all the way to the right side of the screen through the center. I have to fix that.
pop · 2020-07-01 17:10
>>19446 Actually no, this bug doesn't happen. I don't know why I thought that it does. It seems that I forgot how my own code works. At least one less thing to worry about. Cool.
Splicer · 2020-07-01 19:53
>>19442 Update of the code. It's already doing something... not much, but still.
Crash Override · 2020-07-01 19:53
>>19449 Try WASD
Yamaoto Toshi · 2020-07-02 01:19
>>19450 >>19449 Even more progress!
Liet Kynes · 2020-07-02 01:22
>>19453 You can place objects with P key now and click objects to put them in front of other objects (closest in the Z axis). Even though I will probably change the colors back to black and red, I don't like this very much.
Debbie Charteris · 2020-07-02 01:48
>>19454 Okay, here it is back in RED.
Wirth · 2020-07-02 01:48
>>19455 Looks way cooler imho.
Nguoi La · 2020-07-02 02:21
>>19456 Nice wallpaper? It is 1920 x 1080 and yet it's only 72 kB.
Colmerauer · 2020-07-02 12:43
Can anyone recommend me book/tutorial on how to properly divide code into classes and modules in OOP and functional programming? Whenever I try writing something bigger, I end up stuffing code into few classes, as it is still fine for me and horrible mess for anyone but me and end up with spaghetti.
Fred Nurk · 2020-07-02 17:30
>>19460 I read >>19462 and found it helpful, measured only by the fact that the next time I wrote something biggish I found that making changes and adding features required only very small and localized changes. By my standards, "biggish" means 1000 lines. The book seems to be the Ruby instance of a recurring theme, so you may be able to find a similar one for your language if Ruby ain't it. In the end, I think there's no substitute for trying to untangle spaghetti a few times and learning from experience what makes it hard to maintain, but again, I have no experience with big code bases, so, yeah.
Dox · 2020-07-03 20:02
>>19159 don't know what Windows looks like nowadays... If you can't find Windows help try the internet. The "internet" literally *is* Windows help nowadays. I've recently clicked THE "Help" on a 10 and it literally opened a bing search in Edge.
Motoko Kusanagi · 2020-07-07 01:15
Please help me with this, I have about 12 hours to make a choice: I'm in a "scientific internship" in uni(not sure how it's called in English) but apart from getting to know some researchers this experience hasn't taught me much so far(in August it'll be a year since I got in it), I mostly dealt with some bureaucracies surrounding the project. At one point we were asked to learn how to do tests with Selenium(it was me and a colleague back then) but at the end of it this task was cancelled because a)we didn't yet have the necessary programming knowledge to appropriately deal with the code of a 10 year project and b)there were several setbacks related to incompatibilities with old code(a future task would be "cleaning" the project's code, as it's a mess after many "interns" dealing with it throughout the years). So far this semester I've begun working on a paper instead of doing things in the project itself, although starting next week there'll be some weekly appointments related to ensuring it runs well(I don't even know if I'll be able to do any troubleshooting properly, since until early this year the guy responsible for these things was doing his Masters, but now he finished it and left for a job, but it turns out he was pretty much the only guy with enough knowledge to troubleshoot anything the project might throw at the user in its current form). The problem: this "internship" works on a scholarship basis, I get a small wage paid by the government like someone doing their Masters or Doctorate would, this means that it needs to be renewed(or cancelled) yearly. A couple months ago I renewed mine until June/21, and I'm already a bit older than the average student so I was thinking of trying to at least get a proper internship already in some company next year(I have never worked). The issue is I want to help the project I'm in currently to grow, but more as a hobby of sorts, since I'm interested in its goals but I don't want to completely dedicate to it(especially because of my age and how I should get my foot on the door soon, I don't plan on working in academia anyway), and since this is a scholarship I can't have any professional ties. On top of that, I'm not sure I will be able to get the position I'm thinking of by next year, my coding skills are still very poor and I had just organized myself to study fundamentals(math, OSs, networks, algorithms...) for the rest of this year so I could focus uninterrupted on coding next year. At the same time, I can't just beat around the bush forever, at some point I have to put myself out there. So I guess in more objective terms the question would be: given AVL and B trees are as far as I've gotten programming wise so far, would it be feasible to prepare myself for an interview around June next year if I want to spend the rest of the current year focusing on getting a good grasp of math up to Calculus(wish I could do Spivak but it seems there won't be enough time, so I'll do Stewart for now), doing Tanenbaum's OSs and Tanenbaum, Hennessy and The Elements of Computing systems for architecture? I'll also be doing 4 or 5 classes in uni, but this is an easy place and all I have to do is pretty much keep up with classes(which is also why I want to study books by myself, so I can ensure I learn what I need to). I'm not usually the most organized student, but I hope I can get these things done until February or so, aiming to focus on programming afterwards. I know this is hard to answer without further details, but I'm trying hard not to break anonymity, I already provided more information than I'd prefer for the sake of clarity. This is an important decision and I don't trust myself with it, which is why I ask for your help.
Bob Arctor · 2020-07-07 06:04
>>19480 It seems like you're asking if you should continue with this project or study to get a job elsewhere. I've been in a bureaucracy before and none of what I did amounted to anything, but I didn't do much or try hard, because I recognized this early on. I mostly just collected a paycheck. I didn't have greater aspirations to get a job at some company. My suggestion is to continue with the studying in university on your own time and try to stay with the project, since it seems like guaranteed pay if it's been mismanaged for so many years.
Emmanuel · 2020-07-07 10:20
M I N D B L O W N https://youtu.be/bVJ-mWWL7cE
Case · 2020-07-07 16:14
>>19481 After thinking about it overnight, I think I'll drop the uni project, not because I think I'll get a super meaningful job instead or anything, but because I'm worried that if I don't get in the market somehow soon I'll be fuarrrked. "Dropping the project" in this context simply means I won't renew my scholarship, so I'll still be in it until June/21, which I think is enough time to do something meaningful if such an opportunity presents itself. About guaranteed pay, this isn't an issue in the company I'm looking at, I know several people working there, and at this point it isn't about getting money, it's more about paving the way to having an actual job(i.e. not an internship) in that company in the future. Staying on the uni project would be a huge bet considering what I've seen so far, since most actual work is done by people in their masters and beyond, I'm pretty much a clerk.
Tequila · 2020-07-10 22:39
Let's say i have a cellphone/arduino in a veichle and want it to periodically send data to a server. Would a simple 3g dongle be adequate? What be a "industrial" networking solution for this kind of application?
Six · 2020-07-10 23:20
Hello Lainons, first time posting here after lurking for a while. I was wondering, what's the best book for learning C for someone who only have experience coding in Python? I see people recommend the K&R book a lot, even today, however the book is pretty old and since the language have newer standards in the form of C11 and C18 I was wondering if there are any good books that teaches these newer forms of C?
quote · 2020-07-11 03:16
>>19533 Starting with K&R and then reading Modern C (& friends) is something I've seen people recommend. For one, K&R is short, and C11 and C18 aren't nearly used as much as 89 and 99.
Lady 3Jane.. · 2020-07-12 18:20
Should I bother doing a course through Udemy or Coursera on C or C++? I know the best method is books, but my attention span is soykaf and it seems it would be easier to keep up with things if there was video. On the other hand, I'm aware these courses are usually superficial and tailored for code monkeys instead of true understanding.
Debbie Charteris · 2020-07-13 16:04
How many languages do I need to know to get into hacking in the original and autistic sense of the word? I know python, C++(barely able to solve 5kyu in a reasonable time on codewars), and Js (I can easily replace js functionality that I disable) What am I missing? What languages should I learn?
Mitnick · 2020-07-14 14:03
How long do you think studying these would take? >https://wiki.osdev.org/Books About 4/5 years? More? Of course it varies a lot depending on time spent on it, background, etc., but thinking of someone with a "very light" background, that would learn most of the things taught there for the first time, and has enough time to dedicate entirely to it, how much time do you think it would take?
Unspecified · 2020-07-14 16:28
>>19566 Well there's some napkin math that can be done. If you picked 1-2 books per category then you'd have about 20 books. If there's about 500 pages per book then that's about 500 * 20 = 10000 pages. If it takes 1 hour to understand 10 pages of a hard book with exercises, then it would take about 10000 pages * (10 pages / 1 hour) = 1000 hours. So if you read 1 hour a day you'd finish after about 1000 hours * (1 year / 365 hours) = 2.7 years. This can vary, ie I doubt that all of the books have exercises so they might take less time to read and not all books are the same level of difficulty to comprehend. Putting the napkin math aside, I think that your priorities aren't placed well. By even reading half of one of those books you would be in a good position to do a hard project. It would be better to ask what you want to get done and then try to do it. If you can do it then figure out a solution and see how it compares to the books. If you can't do it then read and think about things until you can do it. All in all, I'd probably only read 2 of those books all the way through because of personal interests, and then I'd use the rest as reference for something in specific that I want to get done. It's not a bad idea to try to understand a work in and of itself, but it's a waste of resources to say that you should read 3 years worth of books and then try to program something.
Ivan Horvat · 2020-07-14 16:58
>>19567 >By even reading half of one of those books you would be in a good position to do a hard project Do you mean half of one book per topic or only one out of that entire list? It spans several subjects, after all.
Ender · 2020-07-15 04:42
My C program has a bug that I don't understand When I run it it prints nothing. I tried looking it into a debugger but a get a message I don't understand Reading symbols from a.exe...done. (gdb) break 49 Breakpoint 1 at 0x10040111e: file exr.c, line 49. (gdb) run Starting program: /home/A/a.exe [New Thread 7812.0x10e0] [New Thread 7812.0x1254] [Thread 7812.0x1254 exited with code 3221225477] [Inferior 1 (process 7812) exited with code 030000000005] I have no idea what any of these errors mean. Never before have I attached my program as a file so I hope it comes out right and you can see what's the deal with my code.
Random · 2020-07-15 10:12
>>19575 This is just for 'main': - Your "return 0;" is inside the 'while'. - You are only scanning on the default branch, all other branches would loop forever with the repositioned return. - Your scanf needs a space. - You are only showing the menu on the default branch, it needs to go to the start of the 'while'. - You are using the first character of your program name for the first 'argb'. - You will have to exit a 'while' from inside a 'switch', so it's cleaner to loop on a flag. - Your order of operations is not the one requested by the exercise. Here's one possible game plan after TakeTen. set keepgoing to true while keepgoing show menu scan option branches [abcd] -> perform the task q -> set keepgoing to false default -> call the user names There are plenty of problems after 'main' as well. You need to review the section on sorting and start with a much simpler plain sorting exercise.
Turing · 2020-07-15 10:36
>>19575 Some more: - Your 'String' array is transposed, it needs to be [ROWS][COLS]. - TakeTen needs to communicate the number of lines it acquired. - TakeTen:fscanf should be on String[Rows]. You don't need Cols in TakeTen at all. - The exercise doesn't ask you to attempt to filter out empty lines. An empty line is a legitimate line that your four tasks should handle. - TakeTen:Rows should advance exactly once per loop step.
Nanashi No Gombe · 2020-07-15 12:51
>>19559 >What am I missing? What languages should I learn? Lisp is a big one. It's kind of hard to put into (concise) words, but learning a Lisp dialect will teach you a ton about how programming languages in general work.
Trinity · 2020-07-15 17:32
>>19575 `argv[0]` is the shell command that invoked the program, it usually isn't input (except for programs like busybox). You should probably be reading lines from a file, stdin, or perhaps asking for 10 args. Reading lines from a file or stdin will need a buffer of some sort, maybe a static buffer or dynamic using `malloc()`.
Debbie Charteris · 2020-07-16 04:47
>>19576 >- Your "return 0;" is inside the 'while'. Silly oversight, fixed >- You are only scanning on the default branch, all other branches would loop forever with the repositioned return. Wait, so all functions will return to main once their job is done? That makes sense, I'll put a message and a scanf under them >- Your scanf needs a space. silly oversight again, >- You are only showing the menu on the default branch, it needs to go to the start of the 'while'. I wanted to make a program that takes an argument from the command line so it assumes the user knows what they want and if they don't it gives them the menu. >- You are using the first character of your program name for the first 'argb'. The compiler won't let me use argv to control the switch so I had to made this variable just for that >- You will have to exit a 'while' from inside a 'switch', so it's cleaner to loop on a flag. ... yes >- Your order of operations is not the one requested by the exercise. Here's one possible game plan after TakeTen. I always take some freedoms >There are plenty of problems after 'main' as well. You need to review the section on sorting and start with a much simpler plain sorting exercise. This program asked too much from me, I had never done a program this big or a sorting algorithm before so I had to read about them; didn't understood much and struggle to implement this one. I know programming is not my thing I just don't want to quit. >>19577 >- Your 'String' array is transposed, it needs to be [ROWS][COLS]. I had the hunch that this was the case. >- TakeTen needs to communicate the number of lines it acquired. I thought about this but I just don't expect to feed the program less than ten lines I suppose that I should do it for discipline's sake, make an actual program for general purposes >- TakeTen:fscanf should be on String[Rows]. You don't need Cols in TakeTen at all. Yes yes >- The exercise doesn't ask you to attempt to filter out empty lines. An empty line is a legitimate line that your four tasks should handle. Never crossed my mind but makes sense >- TakeTen:Rows should advance exactly once per loop step. yes >>19581 `argv[0]` is the shell command that invoked the program, it usually isn't input (except for programs like busybox). This is new to me, from what I've had read argc counts how many arguments where input and argv indexes them >Reading lines from a file or stdin will need a buffer of some sort, maybe a static buffer or dynamic using `malloc()`. This is beyond my knowledge I will polish the program some more out of this advice and see what problems persist or come up.
Nameless · 2020-07-16 10:36
>>19585 >I'll put a message and a scanf under them The menu and the scan properly go to the start of the 'while'. >I wanted to make a program that takes an argument from the command line so it assumes the user knows what they want and if they don't it gives them the menu. While you are a beginner you should first complete the exercise to the book's stated requirements, and only add your own variations after that. For your variation you will have to check that argc is at least two, check that argv[1] is not empty, then use argv[1][0]. For the meaning of argv: https://en.cppreference.com/w/c/language/main_function >The compiler won't let me use argv to control the switch so I had to made this variable just for that See above about argv[1][0]. >I always take some freedoms While you are a beginner you should first complete the exercise to the book's stated requirements, and only add your own variations after that. >This program asked too much from me, I had never done a program this big or a sorting algorithm before so I had to read about them; didn't understood much and struggle to implement this one. Write the most basic parts first and only add more once the basics work. In this case the input acquisition, menu and scan looping and the vanilla printing should work before you tackle the sorted prints. Write your programs in iterative layers by making each layer work before moving on. Your sorting is close to working and will be easy to fix once the basics work. >I just don't want to quit. This is the most important thing and the right attitude. >I thought about this but I just don't expect to feed the program less than ten lines I suppose that I should do it for discipline's sake While you are a beginner you should first complete the exercise to the book's stated requirements, and only add your own variations after that. Some more: - PrintOrg needs an argument for the number of lines acquired by TakeTen. That becomes the loop limit. - Dump PrintOrg:Cols. - You need String[Rows] in PrintOrg. - When you get to the length of the first word task, you will need to switch TakeTen from fscanf with %s to whatever line reading function your book has introduced, possibly getline. At this point the basics should work.
limited · 2020-07-16 19:37
I am anti-Carmack. I worte the slowest pseudo3D rendering engine is the world:
Koichiro · 2020-07-16 19:43
>>19592
Ivan Horvat · 2020-07-16 23:18
What's the difference between a function and an expression? Are they just two words for the same thing?
Jean Dupont · 2020-07-17 00:27
>>19595 In some languages, there are expressions and statements, where the former yields a value and the latter is used purely for some control of the machine. Some languages have functions and procedures, where the function encompasses an expression, and the procedure doesn't, being an analog of a statement. Both functions and procedures compress meaning. They form a shorthand of their body. I'll give a simple example in a simple syntax. Here's an expression which adds one to A; when something uses the expression, it gets one larger than A: (+ 1 a) Here's a function which does the same thing; this function doesn't have a name, because not all languages require that; here, lambda is used to make an anonymous function: (lambda (n) (+ 1 n)) Here's that function given a name; defun is define function: (defun add-one (n) (+ 1 n)) So, the expression is usable in just its one context, but that function can be used in many. It can yield the same value when given A, but also with other variables. By using a function, the meaning is encompassed by it, and becomes something that's more applicable to a wide variety of situations.
cdr · 2020-07-17 03:41
>>19592 >>19593 Just a small fix.
Apoc · 2020-07-17 03:41
>>19598
Jean Dupont · 2020-07-17 05:34
>>19586 >While you are a beginner you should first complete the exercise to the book's stated requirements, and only add your own variations after that. For your variation you will have to check that argc is at least two, check that argv[1] is not empty, then use argv[1][0]. For the meaning of argv I thought I understood this but I was only getting more confused and decided to ditch the command line arguments because I felt I was not using them correctly and that's why the program wasn't running properly. I think the program has the required order of operations now. >Write the most basic parts first and only add more once the basics work. That's what I learned out of this one, big programs should be made little by little >- PrintOrg needs an argument for the number of lines acquired by TakeTen. That becomes the loop limit. >- Dump PrintOrg:Cols. >- You need String[Rows] in PrintOrg. >- When you get to the length of the first word task, you will need to switch TakeTen from fscanf with %s to whatever line reading function your book has introduced, possibly getline. All done but sadly the program still prints nothing upon being executed, because TakeTen comes before the menu I added an error message on TakeTen to see if it's even opening a file but I'm not even getting that message. I compile and run my programs through cygwin so I'm not sure if I'm giving the program the correct address.
Chani · 2020-07-17 05:40
>>19599 I just relased this on itch.io I hope people there will be more interested than people here. https://qrayz.itch.io/redcity
Just another Random Lainon · 2020-07-17 11:30
>>19601 >I think the program has the required order of operations now. It does not, because the menu has to "recycle". That means it has to be shown on every round. - Move the menu to the start of the 'while', not before it. - The menu needs all five choices. - Read the option right after the menu. Dump all other scanfs from main. - Dump the prints from the task branches. - Add a 'q' branch, so it doesn't go to default. - Initialize Arg to anything other than 'q'. PrintOrg has no business modifying the Lines value it receives. For your redesigned TakeTen: - The line count is information that TakeTen produces. Remove Lines as a parameter, make it a local, start it on 0, return it at the end. Switch the TakeTen return to int. - Set Lines in main to the value returned by TakeTen. - Put the "Input == NULL" test right after fopen. In practice opening will only fail if you don't have a "/home/ideas.txt" file. - Every time you increment Rows you must ensure a null terminator for the line. - The "Cols == COLS" test is too late because you have already written to String[Rows][Cols]. - The "Cols == COLS" test is too high because you need space for the null terminator. - The '\0' test is not on an 'else'. You are better off using a 'switch'. - The "Cols == COLS" test is on an 'else', which is wrong. - Cols must be reset every time you increment Rows. - Every Cols reset must be consistent with the unconditional Cols increment you currently have at the end of the 'while'.
limited · 2020-07-18 10:41
I have downloaded libgpg-error and have tried to compile it by using ./configure && make , but it says that my buipd may be incomplete. What did i miss?
⍕ · 2020-07-18 13:49
>>19609 https://stackoverflow.com/questions/3824500/compiling-c-on-remote-linux-machine-clock-skew-detected-warning
Fred Nurk · 2020-07-19 18:04
Hi, lains. I've a question for you. How can I make a script that'll allow me to rewrite filenames with a blank space when posting to 4chan? Like a filename randomizer, but with nothing. And by blank space I mean nothing but a space (eg, ' .jpg', ' .png', etc). There're some examples here of what I mean starting about halfway down the page: https://archive.nyafuu.org/bant/search/country/uy/filter/text/ As you can tell, I don't have much experience with these things. However, I assume the way this works is similar to a filename randomizer - rewriting the file as it's posted. I also assume it'd be as simple as rewriting the randomization part of one of these scripts, but what I'd rewrite it with I don't know. Here's one such script and the section in question below: https://greasyfork.org/en/scripts/40116-4chan-filename-randomiser/code (oldFile.size > 0) && ( blob = oldFile.slice(0, oldFile.size, oldFile.type), fileName = `${Date.now() - Math.floor(Math.random() * 365 * 24*60*60*1000)}` + "." + oldFile.name.split('.').pop(), newFile = new File([blob], fileName, {type: oldFile.type}), t.set("upfile", newFile)), So would it be possible to rewrite this script to produce those instead, and how, if so? Thanks for your time, even if it's just to tell me to fuarrrk off.
queue · 2020-07-19 18:17
>>19628 fileName = " " + "." + oldFile.name.split('.').pop(), Maybe replacing this end up working fine, just try it.
Nell · 2020-07-19 21:51
>>19603 All of that is beside the point now, I will polish the code later on because right the main issue is the fscanf on line TakeTen, after running the debugger some more I can tell the program is consistently crashing at that line. I tried different development environments, looked up online and I really don't know what could the problem be.
fsociety · 2020-07-19 23:12
>>19632 Make sure your file exists by putting the "Input == NULL" test right after fopen. Also, the EOF test needs to be on the return value of fscanf. Use the following to check whether your fscanf works at all: $ cat demo.c #include <stdio.h> int main (void) { FILE *f; char buf [1024]; int k = 0, ret; f = fopen ("input.txt", "r"); if (f == NULL) { printf ("%s\n", "cannot open input file"); return 1; } do { ret = fscanf (f, "%c", &buf[k]); if (ret != EOF) k++; } while ((k < 10) && (ret != EOF)); buf [k] = '\0'; printf ("received: \"%s\"\n", buf); fclose (f); return 0; } $ echo "fluffy kittens" > input.txt $ gcc -Wall -o demo demo.c $ ./demo received: "fluffy kit"
string · 2020-07-21 01:54
do you have to declare a pointer in C, or can you just use any variable as a pointer without declaring? what if I want a pointer to point to type char, then later point to type long long?
Neuromancer · 2020-07-21 03:03
>>19646 A pointer is a datatype on it's own, so you use char *ptr; To declare a pointer to a char. Since a pointer is nothing but a memory address, the size of which is the architecture's wordsize, you can actually point to anything at all, but in your program you need to jump some hoops. int a = 100; char *space = (char *)&a; Where you do a typecast or you could use a void pointer int a = 64; void *voidptr = &a /* Note, however, to do it the other way around you DO need a typecast */ char *c = (char *)voidptr; The original reason for having types of pointers (and not just 'void' pointers for everything is for pointer arithmetic to perform well, as in arrays, where char[4] takes 2 bytes whereas int[4] takes 4 (machine) words. char * chptr; Int * iptr; /* ... */ chptr++; /* adds 1 to the value, ie, skips ahead 1 char */ iptr++; /* adds 4 on 32-bit machines, or 8 in 64 bit */ The second reason is that you need to know what you're doing because you can end up doing a mess or introducing bugs. For this reason compilers enforce a lot of typechecking to make sure you be explicit about trying to take a char from what is declared as an int pointer, in this case.
藤原純一 · 2020-07-21 04:44
>>19635 Modified your example a little, compiled it and it ran perfectly, so the files exists and can be open no problem. I don't know what I did but now the program isn't crashing after the fscans but it's also not copying into the array. From what I've read fscanf is just as soykafty as scanf is normally. I tried using fgets but I don't know how to make it handle the if-else chain. I need to look for more examples to know what to do.
Milner · 2020-07-21 11:32
>>19649 - You need a 'break;' on the 'q' branch. - Dump the repeat 'scanf' from 'default'. TakeTen: - The line count is information that TakeTen produces. Remove Lines as a parameter, make it a local, start it on 0, return it at the end. Switch the TakeTen return to int. - Set Lines in main to the value returned by TakeTen. PrintOrg currently receives 0 as Lines. - Return 0 as the line count after printing on the fopen failure branch, so that you don't call fscanf on NULL. - The EOF test needs to be on the return value of fscanf. - The '\0' test is not on an 'else', but it should be. - The "Cols == COLS" test is on an 'else', but it shouldn't be. - The "Cols == COLS" test is too late because you have already written to String[Rows][Cols]. It goes before the fscanf. - The "Cols == COLS" test is too high because you need space for the null terminator. Decrease the test. - Every Cols reset must be consistent with the unconditional Cols increment you currently have at the end of the 'while'. Alternatively, put the final increment on an 'else'.
aliased · 2020-07-22 03:02
>>19650 >You need a 'break;' on the 'q' branch. done >Dump the repeat 'scanf' from 'default'. done >The line count is information that TakeTen produces. Remove Lines as a parameter, make it a local, start it on 0, return it at the end. Switch the TakeTen return to int. Ah right, I was thinking of Lines as a pointer like String is >Return 0 as the line count after printing on the fopen failure branch, so that you don't call fscanf on NULL. Done >The EOF test needs to be on the return value of fscanf. How will that look like? >The "Cols == COLS" test is on an 'else', but it shouldn't be. >The "Cols == COLS" test is too late because you have already written to String[Rows][Cols]. It goes before the fscanf. >The "Cols == COLS" test is too high because you need space for the null terminator. Decrease the test. I moved it over, i think I get it now >Every Cols reset must be consistent with the unconditional Cols increment you currently have at the end of the 'while'. Alternatively, put the final increment on an 'else'. Yes I see what issues could it cause now and moved it to an else but I was planning on changing how this function worked so none of that matters now.
Zhora · 2020-07-22 09:45
>>19651 >>The EOF test needs to be on the return value of fscanf. >How will that look like? As in >>19635 add a new int variable to hold the return of fscanf, and assign the return value of fscanf to this new variable when calling fscanf. Then use this variable instead of String[Rows][Cols] in the EOF test.
typedef · 2020-07-23 22:39
is a web server a type of orchestration?
Case · 2020-07-24 10:44
Best resources for learning AWK"/Gawk? Just the manpages?
Crazy Jake · 2020-07-24 14:05
why do people around these circles hate javascript so much? I get that it's slow, has security problems and so on and so on but should I absolutely never use it? What about web servers? I'm building a simple website for myself and I want to make a custom 404 page and I don't see how that's doable with just html5 and css3. It doesn't add any bloat and doesn't pose any security problems, will it be a problem if I use it then?
Zuse · 2020-07-24 14:45
>>19690 From a programming point of view Javascript is a browser scripting language with wildly differing implementations and a really soykafty ecosystem filled with security holes and trendchasing, it is not designed to be used for what node.js lets it be used for. From a web user point of view most sites don't need to have JS, a solid chunk of more technically minded people run noscript because its a privacy and security minefield to leave it running so if your site breaks because you did something with JS that could have been done with boring old HTML/CSS its frustrating.
Splicer · 2020-07-24 19:03
>>19692 >and a really soykafty ecosystem filled with security holes and trendchasing Can I somehow use some of its functionality while avoiding the security holes or should I just never even bother using it?
fsociety · 2020-07-24 19:29
>>19697 If you just want to add functionality to your website then sure, just make sure it still functions with scripts turned off and don't fall for all of the JS frameworks unless you absolutely need to make some monstrous webapp.
stack · 2020-07-25 01:53
>>19690 >I want to make a custom 404 page and I don't see how that's doable with just html5 and css3 I don't see why you would need anything else, there is absolutely no programming required to do this. http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page
H.R. Giger · 2020-07-28 09:31
I wrote a prototype of a simple dungeon-crawler engine: https://rentry.co/6vkrw You can play it here: https://qrayz.itch.io/basic-dungeon
Agent Richard Gill · 2020-07-29 12:11
I expect the following programme, filename ``reading_files.c'', to print the very same C source code text---but it also prints a character with hex code FF. ``reading_files.c'': #include <stdlib.h> #include <stdio.h> int main() { FILE *file = fopen("reading_files.c", "r"); while (feof(file) == 0) { putchar(fgetc(file)); } fclose(file); return 0; } Here's what the terminal looks like for compiling then executing ``reading_files.c'': $ cc reading_files.c $ ./a.out #include <stdlib.h> #include <stdio.h> int main() { FILE *file = fopen("reading_files.c", "r"); while (feof(file) == 0) { putchar(fgetc(file)); } fclose(file); return 0; } �$ (The hexadecimal code of the `�' is FF.)
J.C. Denton · 2020-07-29 17:20
>>19776 From https://en.cppreference.com/w/c/io/feof: >This function only reports the stream state as reported by the >most recent I/O operation, it does not examine the associated >data source. For example, if the most recent I/O was a fgetc, >which returned the last byte of a file, feof returns zero. The >next fgetc fails and changes the stream state to end-of-file. >Only then feof returns non-zero. So feof only reports EOF after the fact. fgetc will tell you if you've reach the file's end, so it's better to just use that in your conditions. #include <stdlib.h> #include <stdio.h> int main() { FILE *file = fopen("reading_files.c", "r"); int ch; while ((ch = fgetc(file)) != EOF) { putchar(ch); } fclose(file); // If this program were to continue, remember to set FILE to NULL or 0. return 0; }
Apoc · 2020-07-29 17:49
>>19776 I forgot to mention that the reason for '�' being printed is because fgetc is returning the EOF, which is '�' in this instance.
McCarthy · 2020-07-29 21:20
Does anyone have experience programming for several platforms/languages? I'm womdering whether it'd be possible to write a logic in pseudocode and then translate to more than one language using the same logic largely unchanged, that is, a direct translation. Assuming that both languages are imperative, object oriented (say), or would the idiosyncracies of both languages soon force ever increasing divergence on the methods of translation? And if the former is the case, then could the process be automated (essentially making a DSL and a transpiler?). If the latter happens, could it still be manageable enough to keep the translations somewhat simple?
Leto Atreides I · 2020-07-29 21:40
>>19784 Yes, I've been writing programs in multiple, very different languages for a while now. If direct translation is feasible, the languages really aren't so distinct. It's not impressive to translate pseudocode to C++ and Java or Python or whatever. Why bother? A truly distinct language warrants a specialized approach, even if the same program is being written.
Turner · 2020-07-30 02:40
I finally managed to get a working theme selector for my website using CSS only but then I realized that it doesn't save in between pages. I even thought of using iframes to embed my other pages into one but the main page css doesn't transfer to them. Should I just give up and use js?
Lukasiewicz · 2020-08-02 03:55
I'm trying to implement 2D Perlin noise, but I'm misunderstanding something since my function doesn't match the expected output. (The visual result of my implementation is a repeating grid.) - From what I know, given a point P, generate four 2D pseudorandom gradient vectors that begin at the vertices of the cell in which P resides and that point in some direction. Their magnitudes should be one, i.e. unit vectors. Each vertex of every cell in the grid should map to one and only one gradient, and the gradient should only vary with the seed. - Compute the distances between P and each of the cell's vertices. - Compute the dot products of the distances and their respective gradients. - Interpolate the products with a weight equal to a fade function whose argument is the distance between the cell's upper-left vertex and P. - The result should be a floating point number in [-1, 1]. If a whole number is given to the noise function, then zero will be returned. Regarding the gradients, I don't know what values to give them. For example, given a vertex of some cell in the grid, should its gradient be <cos(θ),sin(θ)> where θ is some pre-computed, pseudorandom angle (in radians)? I'd really appreciate some help.
Yamaoto Toshi · 2020-08-02 12:36
How do you use a debugger to fix an application crash? When I run this program it crashes becuase of a dll, that dll crashes probably because of a USB input device(when I unplug the device the program seems to work OK). I ran windbg & I got this: eax=0019d76c ebx=00000000 ecx=00000000 edx=205a6f54 esi=0019d7b0 edi=0b4b86a0 eip=00000000 esp=0019d768 ebp=0019d7d8 iopl=0 nv up ei ng nz na pe cy cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00210287 00000000 ?? ??? 0:000> .exr -1 ExceptionAddress: 5d26d491 ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 00000008 Parameter[1]: 00000000 Attempt to execute non-executable address 00000000 0:000> .excr Unable to get exception context, HRESULT 0x8000FFFF 0:000> k8 # ChildEBP RetAddr WARNING: Frame IP not in any known module. Following frames may be wrong. 00 0019d764 6f87a72e 0x0 01 0019d7d8 6f87cd8e AgDrag+0xa72e *** WARNING: Unable to verify checksum for C:\DragonsDogma\d3d9.dll 02 0019d7e4 10087b5f AgDrag+0xcd8e 03 0019d7f4 00dad5b5 d3d9!D3DPERF_BeginEvent+0x13f 04 0019d820 0041e0c1 DDDA+0x9ad5b5 05 0019d83c 00def51e DDDA+0x1e0c1 06 00000000 00000000 DDDA+0x9ef51e 0:000> k0 # ChildEBP RetAddr WARNING: Frame IP not in any known module. Following frames may be wrong. 00 0019d764 6f87a72e 0x0 01 0019d7d8 6f87cd8e AgDrag+0xa72e 02 0019d7e4 10087b5f AgDrag+0xcd8e 03 0019d7f4 00dad5b5 d3d9!D3DPERF_BeginEvent+0x13f 04 0019d820 0041e0c1 DDDA+0x9ad5b5 05 0019d83c 00def51e DDDA+0x1e0c1 06 00000000 00000000 DDDA+0x9ef51e Watched this video(https://channel9.msdn.com/Shows/Inside/C0000005) which said that the access violation is trying to execute(8) memory 00000000 . NULL Pointer. I have the code for the dll (https://github.com/Kaldaien/AgDrag). How do i go about fixing it so it does not crash.
dup · 2020-08-02 19:54
>>19830 You make an unstripped debug build of AgDrag.dll and all its dependencies and dependents, usually "-g", then you reproduce the issue with the debug build in place and tell us the exact line number and containing function of AgDrag+0xa72e and AgDrag+0xcd8e, the two frames from AgDrag.dll since the offsets will change with the debug build, and you also find the dump locals and up one frame commands of your debugger and provide a full dump of the locals of those two frames.
push · 2020-08-02 20:27
>>19830 It appears that you should have a logs/AgDrag.log available, which you did not post. Since your problem seems to be that one of the *_Original function pointers in input.cpp is nullptr, look towards the end of logs/AgDrag.log for an entry with " Calling original function: " that is not followed by "(ret=S_OK)".
The Oracle · 2020-08-02 22:33
>>19830 It appears that you should also have an AgDrag.ini file that you should post in full, especially if you modified it to use a custom injector.
Judge Fang · 2020-08-02 23:40
>>19765 I have just updated my dungeon-crawler engine: https://rentry.co/ppnzm I have added the ability to trigger events. https://youtu.be/aaybAP713jo You can still play it on the original itch.io url: https://qrayz.itch.io/basic-dungeon You should definitelly try it.
fsociety · 2020-08-03 09:54
Are Excel/LibreOffice macros "programming"? I don't know. I have this macro I'm trying to run in LibreOffice: https://stackoverflow.com/questions/15554099/write-each-excel-row-to-new-txt-file-with-columna-as-file-name/15554991#15554991 But apparently "Range" is an Excel thing and is unsupported, so it tells me "Unknown data type Range". I found a related answer on Expert Sex Change which is supposed to make an Excel macro (on the left) into a macro which works in LibreOffice (on the right), but I don't know how to make this work with my macro.
Roy Batty · 2020-08-03 21:46
This thing here is easy to make with a compass and straightedge, however with a computer it's different. I want to do this in postscript, but some of the endpoints are found through intersections of existing lines. My question is, is there any resource or any way I can do this without having to resort to something like gaussian elimination? Am I missing something?
Tequila · 2020-08-03 23:03
I remember this being asked at some point but I couldn't find the question and its respective answers: what career paths would allow one to not be forced to work with teams all the time? I often dislike doing group work in uni unless I know the people involved beforehand, but that's not gonna be the case in a random job. With that background, it seems obvious I'm not a good fit for positions that require a lot of socializing. I vaguely remember someone mentioning security when that was brought up previously, but it wasn't expanded upon. As far as I know, working with security generally entails being responsible for a system's security or, in some cases, being part of a pentesting red team or something, but that seems to be a minority(and even then you have to work with others, you can't just play haxxor on your own).
Yet Another Lainon · 2020-08-04 21:53
>>19892 IOS and WebDev are probably going to be best. You'll still want to cut your teeth on some freelancing. Start doing upwork / freelancer.com etc... contracts for cheap. Work your pay grade up. To run solo also start getting some sales skills, Jordan Belfort is a great starting point. His book "way of the wolf" is a good primer.
The Fin · 2020-08-05 03:22
>>19888 I doubt it... Since the compass and straightedge construction has several steps a computer construction probably has several steps (even if you tried to take advantage of symetry). I would calculate all points and intersection points within a small circle (algebraicly if reasonable), then circle positions, and finally connect the dots... There could be a better way. Don't forget to scale all coordinates to fit square! The central spokes might be difficult... Don't forget to shift circle points to circle's position! It might be possible to list coordinate points within one quadrant and rotate pattern, but would still need coordinates and positions and lists for that... Let's see... Using the top-left corner: * circle-1 (0,0; shifted to corner) * circle-2 (2,0; relative to corner) * circle-3 (0,2; relative to corner) * circle-4 ([2 + sqrt(2)], [0-sqrt(2)]) // top center, double-check * center-circle ([2 + sqrt(2)], [2 + sqrt(2)]) // big square side is [4 + 2*sqrt(2)] times a circle radius And then, uhhh... Each circle has 12 points of interest inside... umm... some at radius-distance from circle's center and some a little closer to circle's center... Those spokes intercept at points outside a circle and are going to require line-interception calculation, but you only need to calculate 4 points in top-left, maybe two if symetry of corner used but 4 total and rotate like other parts. Within a circle (radius 1, center 0,0) the points of interest wou;d be: * center (0, 0) * outer north (0, -1) * outer east (1, 0) * outer south (0, +1) * outer west (-1, 0) * outer north-east (+√2/2, -√2/2) * outer south-east (+√2/2, +√2/2) * outer south-west (-√2/2, +√2/2) * outer north-west (-√2/2, +√2/2) And: * inner north-north-east, umm... * y=north-east(y) and x=1-(1/√2)*(√2/2)=1-(1/2)=1/2 * double-check yourself... The spokes are, umm... The central circle has different points of interest/ similar to other circles but rotated 22.5° (π/8 radians).
Agent Richard Gill · 2020-08-07 05:13
Is it worth buying Tanenbaum's books physically? I prefer reading physical books, but I can't ignore that the three of them(Networks, Architecture and OSs) would cost me a little over 700 bucks. And when it comes to architecture, for example, I'd still consider getting Hennesy's at some point.
J.C. Denton · 2020-08-07 05:17
Oh, and what would you say is the best book about databases? It seems every established title I look for has heavy critiques.
Yamaoto Toshi · 2020-08-07 09:33
>$700 for books And you first worlders wonder why the corporations who own your politicians outsource your jobs with impunity.
Moore · 2020-08-07 18:42
>>20063 Some books cost upwards of $500. I remember seeing Knuth's Concrete Math for 580 or something, others cost more. This would be about U$150 back when I saw that.
stack · 2020-08-09 22:49
I completely rewrote the javascript dungeon-crawler engine. Unfortunetely, it seems that it works even worse now than before. On top of that it's really hard to use. I guess I don't know what I'm doing. But if I knew what I'm doing, I would not be doing it. The code: https://rentry.co/y4d7k The game: https://qrayz.itch.io/dungeon-2
x<->y · 2020-08-10 00:18
>>19765 >>19844 >>20146 I haven't had a chance to play yet, but this is good progress, all the way from those earlier screenshots. I enjoy being able to see the progress, and just wanted to make that known.
Special Agent Bob · 2020-08-12 05:40
I am trying to give my website background music. I've already tried autoplay and embed but it just doesn't work. I've heard that Chrome supposedly blocks autoplay, but the thing is, this website has background music and it plays on Chrome https://melonking.net/ I've looked though the code with inspect element but I just can't figure out how he did it.
roll · 2020-08-12 21:51
>>20199 The src of that webpage has this written: <audio autoplay loop> <source src="audio/Lobo_Loco_-_02_-_Summer_Rain.mp3" type="audio/mpeg"> </audio>
Anonymous · 2020-08-13 22:12
I am calling close() but it has a return value. What should I do with this return value? close() returns zero on success. On error, -1 is returned, and errno is set appropriately.
Lady 3Jane.. · 2020-08-13 23:41
For beginners I made a workshop https://learnaifromscratch.github.io/ It actually is from scratch, assuming you nothing in either math, software or AI, because I started form scratch like you anons, I knew absolutely nothing. Not claiming my 'curriculum' is better than any advice here of course, you should make up your own mind what you want to do because that is where the motivation comes from, wanting to finish something. If somebody here suggests something you really want to do then do it. I made this because I also made this: https://functionalcs.github.io/curriculum/ and this: https://functionalcs.github.io/web/ and everybody I showed this too IRL asked me, where do I even start? So I dug into CS education research, found Prof K and his unique teaching style that is backed by research. What is the proven way to learn this material? I found it, now sh i ll it. Up to you if you are interested. Math bothered me too because most people were like me, they had flunked out of school or dropped out and had no idea where to start, so I fixed that too with Terence Tao and some other resources. It teaches you 'mathematical thinking' that nebulous logic nobody can pinpoint that you need to actually do well in math. We learn that it's not how well you can memorize things, it's how you can deduce something and project your real life model into the world of math in order to reduce it's complexity, and work with this model in a proven framework, that's why people sh 1 ll math. (avoiding the word filters like 1990s newsgroups, the state of lainchain) The AI workshop is slow walked so far because it's a very locked up pathway, but we'll soon learn that Sussman has one of the world's best AI courses you've never heard of, and we'll do all of Cornell's AI courses and maybe CMU's as well if I can grab those zoom lectures. Anyway anons I highly recommend my soykaf curriculum if you know absolutely nothing, because it's the only curriculum that takes this position that you know nothing. So who am I? I'm a foreigner, not an American, that grew up a skinhead (non poltical if you realize what that means) https://youtu.be/ugFLHWbFWRQ and I served time in your American federal institutions for hacking crimes back in the day then got kicked out and released to most frightening neighborhood on earth and met real people with real drug problems, wondering how the fuarrrk could I could change my timeline and stop this recursion of destruction in my own neighborhood. It worked for some, others were not interested. If you're not interested ignore this post, if you are then try the meme curriculum I guarantee it's not 'read these 200+ books' is will change your life because it changed mine. My original post totally raped due to language enhancers, hopefully it makes sense.
Donna Hawthorne · 2020-08-14 12:48
The engine is pretty much finished...
Miho Iwakura · 2020-08-14 18:18
>>20237 Projects like this or others need a wiki or sticky so they don't become lost
Joe Bloggs · 2020-08-14 21:04
>>20245 UPDATED You can play here: https://qrayz.itch.io/basic-dungeon
The Phantom Phreak · 2020-08-14 21:14
I'm trying to install Artix Linux. I download the artix-base-openrc-20200214-x86_64.iso and installed it in a USB drive. I partitioned my hard drive as the image follows, but everytime I boot my computer with USB drive containing artix, grub giver me a message like: unknown file system. What did I do wrong?
Cat Mother · 2020-08-14 21:36
>>20257 >What did I do wrong? You posted this in the programming board instead of posting it in the technology board.
Koos van der Merwe · 2020-08-15 09:40
>>20257 Show the gparted of the usb from whatever you used to partition the hard disk.
Church · 2020-08-17 22:48
Does it make sense to study UML diagrams and such before having extensive previous experience? I have a class on this and it seems like such a huge waste of time. I understand the importance it has in a company to organize tasks and so forth, but looking at it from a purely theoretical point of view it seems like just a bunch of buzzwords I'll forget a month after class ends.
Switch · 2020-08-18 21:09
>>20320 its useful if you are doing large project, or with other people, its hard or impossible to keep entire state of large project in your memory. There was lot of UML in my school too, but no practical projects. I kinda regret i did not used UML in conjuction with some webdev project or whatever (because prof did not demand it), because UML itself is very dry
Cowboy · 2020-08-25 10:18
>>19079 Can anyone vouch for the Odin project as an introduction to web development, and then further programming in general? I'm someone who finds stuff like codeacademy very boring. I like figuring soykaf out for myself, and making it a challenge. If thing aren't engaging or challenging I very quickly lose interest.
let · 2020-08-26 13:27
How hard is it to get into reverse engineering? I've had materials to study programming and get decently good at it for a while but I never have the motivation to do it because there's simply no projects I'm truly hyped about building from the ground up. There's a bunch of project suggestions out there but at the end of the day they're just... lists, exercises. Breaking down stuff, however, really excites me, the problem is that it requires substantial programming knowledge already, no?
Unspecified · 2020-08-27 01:37
>>20478 what hypes you about reverse engineering that isn't there for programming? "lists, exercises" are fundamental tools of learning that shouldn't you shouldn't be disregarding. sure they have limited real-world applications, but they are meant as educational vehicles. you may find that your road to reversing is much, much harder without your fundaments
Judge Fang · 2020-08-27 02:12
>>20486 It's a chore. Sure, I now it's important to do it anyways at some point, but still, I was hoping there was some way to make the learning process fun. I enjoy feeling like I've made progress, just not so much going through endless stupid scenarios for which I'll have to write some code I'll never use again afterwards. I especially hate having to create a bunch of classes, but Java is what I need to focus on for now due to the kinds of jobs being offered around here.
Backus · 2020-08-27 18:18
I've started a little project for my blog, the idea is to have an index and a folder full of entries written in markdown (commonmark). I wanted to also add some tags to the entries like the date, etc so I was thinking of adding some tags to my entry files. Would it be dumb to add a <--tags--> and <--content--> separators? Is there a simpler way I'm missing?
Yuki Nagato · 2020-08-29 08:51
Hey lambda. Im building an array in bash. I know how big my array is going to be, and I don't want to waste any compute time on my array inevitably resizing and moving around in RAM several times. Is there a way to let bash know ahead of time that my array is gonna be over 330MiB?
Project 2501 · 2020-08-30 21:22
I have a webpage full of links to different PDFs whose content I want to search in a Ctrl-F fashion , is it possible to make a program that would get that website's link as input and search for terms in the pdfs linked within it? I ask this here because I'm a noob and I don't know if there would be any inherent limitations to parsing due to restrictions imposed because of security concerns and such. I also envisioned something like this that gets a directory path as input instead, so it looks for words in the pdf or txt files within a folder.
Wintermute · 2020-08-31 19:23
>>20548 Use either wget or curl to batch download your pdfs then pdfgrep or the like to search them. http://manpages.ubuntu.com/manpages/bionic/en/man1/wget.1.html http://manpages.ubuntu.com/manpages/bionic/en/man1/curl.1.html http://manpages.ubuntu.com/manpages/bionic/en/man1/pdfgrep.1.html
Church · 2020-09-01 03:49
What are the known vulnerabilities of LynxChan?
Lady 3Jane.. · 2020-09-01 22:55
>>19079 What do you do to program? I just play videogames. What routine/planning do you follow?
Yuki Nagato · 2020-09-03 11:34
hi lainons, its been like almost 2 years since I asked an advice from you like: >read SICP >LISP and somehow they helped my programming career, I skipped college and followed your advices. now I have a job as a programmer and now I want to learn about being a Software Developer. but still I feel so soykafff, I dont know what should I do next. My only dream before is to become a programmer, to know how to code. I can say that I'm more knowledgeable than my colleagues who are currently on IT/CS college. now I want to become a businessman, software developer, I even want to go to college and pursue a financial course. I just want to become relatively successful and help my parents especially financially since we are poor, I want to have a strong financial security using my skills. any advices? thank you!
Ivan Horvat · 2020-09-05 05:50
>>20642 If you read sicp all the way through, youre more than ready to take a look at the linux kernel and start doing real programming. The kernel is a ghost in the machine, fully automated. We dont use the kernel, we just use its interfaces. In order to control the kernel, you must write, compile and run it yourself. The kernel controls the hardware. We just ask the kernel very nicely to interact with the hardware on our behalf. When you consider that macos and windows both have proprietary, closed source kernels, then it becomes clear who really is controlling your computer. If it's not you, it's them.
Acid Burn · 2020-09-07 11:02
>>20659 >linux kernel alright I will take a look at it for sure, I feel like learning the deployment technologies for web applications is not even real programming.
Drifter · 2020-09-08 13:43
>>20706 Web programming is a lot like abstract art: any kid with a computer can do it, but you need experience in "real" programming to actually do it well.
Wilson · 2020-09-08 14:37
>>20721 I've been playing around with tiddlywiki lately. it's basically a stream-processing language that runs on a microkernel inside the browser. And its also a quine of itself. And it's a fully self contained, portable wikipedia. So I guess I just want to point out that web can get crazy too, if you're willing to stretch your definition of the word "web".
Zhora · 2020-09-10 06:10
Best book to learn type theory for e.g for Haskell usage? I'm learning Abstract Algebra from AATA and want to proceed to some Category Theory textbook, but I'd like to know what the best resources are. I'd just like to point out that I actually enjoy mathematics and don't want a watered down book that omits the meat of the topic. So books like "X for programmers" I would like to omit, unless they actually give you the full theory behind it.
Shogun · 2020-09-10 10:34
>>20723 Stop calling wiki hypertext wikipedia. You don't call every anonymous imageboard "4chan", don't, you?
Nobody important · 2020-09-10 21:44
>>20753 Yes I do and you can't stop me
Project 2501 · 2020-09-13 15:17
Hello Lainons, maybe this is a bit too much of a beginner question but I've finished pic related and Automate the Boring Stuff with Python and have created some small, terminal based projects. I was wondering if you guys have any books that'd you'd recommend to read after these two to help improve on my skills?
Jean Dupont · 2020-09-13 15:43
>>20796 If you want to stick with Python, I can recommend Effective Python as a beginner-intermediate book.
John Doe · 2020-09-13 17:18
I'm getting an error when trying to run my python script. c2 = ( v * (t - te) - theta * (te - t) ) ^ SyntaxError: invalid syntax Does anything immediately jump out?
Anonymous · 2020-09-13 18:33
>>20800 That's not where the error is. That's where the parser determined that your program was syntactically wrong. You're probably missing a parenthesis above that. If you were using a code highlighter, you would see it immediately.
x&lt;-&gt;y · 2020-09-13 18:38
>>20802 You were right. Thanks a lot anon.
Lady 3Jane.. · 2020-09-14 00:12
Writing an imageboard, I have a simple javascript function that adds a post number to the reply box when clicked. Right now this function is duplicated on multiple pages, I want to put it in a separate js file and call it . How? I've tried <script type="module" src="jsfunction.js"></script> with jsfunction in the root directory, and it "works" in the sense that no errors are thrown (if I change it to the wrong directory like src=/foo/jsfunction.js I get an error logged). But when I click a post number, which is supposed to add >>123 to the reply box? Nada. Whereas if I manually copy the function in and stick it between <script> tags it works perfectly. Basically what's the secret to importing a function that gets called an arbitrary time later (when a user clicks on a post number). I've searched and found nothing, it's like my page imports the function and immediately forgets about it.
Knuth · 2020-09-14 01:31
>>20809 use script type="text/javascript"
Turner · 2020-09-15 02:18
There is a huge image that show the different ''paths'' you may follow in programming for a bunch of different things (webdev low and high end, cybersecurity, etc) and the languages and things you should learn for each, does anyone have it saved?
Lady Jessica · 2020-09-16 01:30
>>20843 https://roadmap.sh/roadmaps
Koos van der Merwe · 2020-09-16 12:29
>>20721 what does the "real" programming actually looks like? so I know where I am going
Mentat · 2020-09-16 14:11
I want to establish a strict study routine to stop wasting time with bullshit, but I can't see a scenario where I'd do this successfully. Any tips? Outlining a schedule when you're studying for something like the SATs is easy: you know exactly what texts to read and you know exactly the kind of activity you'll need to do, reading and exercises, and they're promptly at your disposal. With something like programming or CS in general, however, there's so much readjusting along the way that it doesn't seem realistic to establish a "closed" routine, yet I feel I need that to finally stop going off the rails. Sometimes I'll take months to do what could have been done in a week or two.
Dox · 2020-09-17 02:32
>>20873 I can only give you a partial answer based on my experience. For one thing, you do have the same textbook cycle available because, well, textbooks. Now, if you pick a middle-sized project to work on, and you work on adding just one functionality each day, you'll have a somewhat streamlined methodology where you locate one thing that needs doing, look up information on the topic you need to solve it, and then do it. Before long, something will start to take shape. In my own workflow I've realized that textbooks are often just a means to an end, the end being the project itself. So lately I take books that are relevant to something I want done and read them as needed to cast my vision.
Nanashi No Gombe · 2020-09-17 16:00
Hello, I'm building a little project and I'm having trouble breaking it down into small chunks and visualizing a solution. I'm trying to make a videogame map navigator. It takes a x,y position from a map and the destination, then returns the shortest path assuming the shortest path is a straight line between portals until you reach the destination. The maps in the game look like pic related, the red dots are the portals that connect maps with each other. This is where I'm not sure how to continue, should I make a graph and make nodes represent warp portals? But then I would have two nodes for every entry/exit point since the game is laid out as: City A portal warps to B field; B field portal warps to City A. prt_fild08,170,378 warp prontera,156,26 prontera,156,22 warp prt_fild08,170,375
Anonymous · 2020-09-17 23:25
>>20885 method #1) A* pathfinding is a popular technique. That is a greedy search using some heuristic and if any branch has a longer partial-path distance compared to so-far best then abandon that branch. Assume infinite/huge distance until a real path found, continue searching to improve. In pathological cases not unlike brute force, but typically much better (most dead ends get pruned mid-way, first few won't however). method #2) You could also have a grid of step distances corresponding to entire map and flood-fill the distances. Init all distances to infinity/huge and the start point as zero. Every frontier point is +1 distance from previous frontier, it is possible for a point to be re-marked because of portals.
Jens Hansen · 2020-09-18 00:19
>>20871 real programming is kernel programming. Go contribute to the openzfs kernel.
Hitomi · 2020-09-19 11:23
hello, I dont have a solid mathematical background so I'm gonna ask you lainons about this. I just dont get how to solve for the solution of exercise 1.7 in SICP. I have my own solution in my head but I think its soykaf. please explain me how do you find the solution here. thank you
Wilson · 2020-09-19 15:20
>>20908 Basically they're trying to teach you how to debug by looking at edge cases you may not have considered. They encourage you to try using your function to compute square roots of very large and very small numbers, observe your function doing the wrong thing, and try to figure out why it's doing the wrong thing. You should use what you've learned so far about stepping through functions by substituting expressions. This one is really easy, because they outright tell you the correct implementation to fix the bug. In the real world it's actually very rare for someone to just tell you what the answer is.
Crazy Jake · 2020-09-20 11:59
Hey guys, I got this in the mail from my friend a few weeks ago. What am I in for and what should I know before I dig in?
Delilah · 2020-09-20 12:20
>>20928 How to read and do math, it also helps being able to use a computer.
Faye Valentine · 2020-09-20 12:35
>>20928 Its really fun but for me it took some time to "get" lisp. Be patient and remember to have fun with the language, try things out yourself! I was actually just doing some exercises from it before coming here.
Cypher · 2020-09-20 13:35
>>20929 Is basic high school math be enough or does it demand me to know more advanced math, and if so, is it something I can easily pick up as I go along?
Jim Hilger · 2020-09-20 14:38
>>20931 Discrete math should be enough, if you want a refresher these lecture notes from Lovász Gábor are famous for being intuitive and easy to understand: http://www.cs.elte.hu/~lovasz/dmbook.ps I dont think you should worry about math too much, SICP is all about explaining the basic concepts behind CS and it doesnt require advanced math skills or anything.
byte · 2020-09-21 12:02
>>20913 wow I can't believe how retarded I am, the solution is already on the paragraph. this destroys my confidence a lot. you're right its supposed to be very easy, and its a shame I struggled to this problem. thanks lainon
nil · 2020-09-22 05:48
>>20941 The book isn't destroying your confidence. You're doing that to yourself by judging and criticizing. I never said "It is supposed to be easy" and "shame on you". Stop putting words in my mouth. It's okay to be confused and ask questions. No judgement here on my end. I am glad you asked for help when you got stuck. Keep going. Forgive yourself. I fuarrrkin love this book and I got through it using wikis like: http://community.schemewiki.org/?SICP-Solutions Mostly just for hints and to check my work.
Zero Cool · 2020-09-24 15:33
>>20928 What's the quality of the new printings like? I've been thinking of picking up SICP for my shelf (already read it), but old hardcovers are kind of pricy now.
pop · 2020-09-25 18:19
How do I go about learning webdev? Usually I just get a book to start me off, but it seems like this won't be enough in this realm. I've never really wanted to learn webdev myself, but now I have to because of a project I'm part of in uni, I need to make a page responsive with bootstrap. I hadn't dealt with html and css before, but that's fairly straightforward, the problem is my instructions were basically "mess around with the console in the website and watch some bootstrap tutorials", but after staring at it for ages I still have no clue where to start from. My "seniors" admit themselves this project's code is a mess, but I don't even know what and where to look for, me asking them for help didn't yield much. For example, there's a menu that covers the screen in mobile/ipads and I need to turn it into one of those standard "hamburger menus", but where the hell do I even start with this? Whatever tutorials I found on "hamburger menus" are either extremely generic or case specific. In case it wasn't obvious by now, I'm largely a noob.
Unidentified · 2020-09-25 21:43
>>20987 >To use bootstrap All you have to do is link the stylesheet, the javascripts, and then you replace the values of the class attributes on your html tags with bootstrap class names. Go look up what the different bootstrap classes are so you know which ones to use. Make sure you delete the old values and just use bootstrap classes. Get rid of any inline CSS if it's there. >to learn webdev Get server up and running on your computer. You're going to do this many times before you die, so you might as well do it now too. Put all the files for your home page in the root directory for your server. If you make another page, put all the files for that page in subdirectory of your root directory. Use relative urls to reference files in your project. That is, relative to whatever html page is loading the resource. Now you can test on your mobile phone by connecting to the same lan as your computer, and typing your computer's IP into the web browser. Go look up how to write a css file that can respond to the size of the screen. Try to separate style and structure between CSS and HTML respectively, as much as you possibly can. Javascript is for filling in any functionality you can't do with HTML or CSS, but you may be surprised how much can be done without touching javascript. You're going to want a book to look at while you write CSS. Back when I was doing this for money that book was "CSS: the missing manual" but it's been years and I don't know if that book is still up to date. It was just the first thing I found in the public library. Check the library. Whatever book you use it should be recent, but something is better than nothing. Validators to check your work: http://jigsaw.w3.org/css-validator/ http://validator.w3.org/ CSS resources officially endorsed by W3C standards committee responsible for CSS: https://developer.mozilla.org/en-US/docs/Learn#CSS https://www.w3.org/Style/Examples/007/ w3schools which is not affiliate with w3c: https://www.w3schools.com/
hash table · 2020-09-27 11:50
>>20987 I feel you bro, my mentor/boss had to turn down one project because of me being noob on designing the page. but typically if I were in your position I would just get a complete HTML/Bootstrap template from some site then find something similar to 'hamburger menus", then make that code a reference to the project. >also a noob here, with a bit of experience
roll · 2020-09-27 19:01
What would be the minimum level/entrance barrier skill wise to start reading materials focused on competitive programming? Knowing how to implement the data structures mentioned in CLRS or something along those lines?
Netrunner · 2020-09-28 05:52
>>21014 Not so advanced for starter strategies... Dynamic programming (caching previous calculations in preference to re-calculation) is a popular technique. Competituve programming isn't like on the job BTW, but here. https://www.hackerearth.com/getstarted-competitive-programming/ https://codeforces.com/blog/entry/23054 http://problemclassifier.appspot.com/ etc. There are books published on this topic nowadays too. Note: studying interview questions is probably better career wise, probably... But if you have fun go ahead!
Technician · 2020-09-28 17:09
>>20990 >>21011 Thanks, maybe if I was starting something from scratch it'd be more fun, but wasting my time looking for specific files in an already existing (and disorganized) project is soul crushing.
string · 2020-09-28 17:20
>>19575 im trying to install icecat through trisquel but when I put the command apt-get update the console give this error Err:4 http://archive.trisquel.info/trisquel toutatis-updates InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B4EFB9F38D8AEBF1 Err:8 http://archive.trisquel.info/trisquel toutatis-security InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B4EFB9F38D8AEBF1
Iverson · 2020-09-29 01:40
>>21021 Thank you
Lord Nikon · 2020-09-30 13:49
>>21023 i download x64 version in 32 system, sorry for my low IQ
↑ · 2020-09-30 18:22
For some context, I have a solid grasp on programming and scripting Everybody that I have asked for advice regarding how to become a better programmer told me to start a project. What kind of project should I work on?
Dozer · 2020-09-30 19:19
>>21047 What about generating a maze? You can output it as ASCII art. There are several algorithms to do it... The common ones all produce a "Minimal Spanning Tree", in terms of mathematical Typography. That means if you held up one of the dead-ends like a thread the rest would dangle down (with neither islands dropping out nor knots & tangles). BTW This kind of maze can be solved by touching a wall with left hand and following all the way through, tracing through every deadend along the way. MST's are used for set-like & floodfill-like operations (every node gets added to the final set only once without loops), but a maze generator is interested pattern of connections followed to get there. The different algorithms tend to have a different look to them, some have long hallways and others branch more. Some have runtime charateristics like needing more memory. Go generate an ASCII maze using two or three different algorithms.
Yet Another Lainon · 2020-09-30 23:37
>>19079 I'm looking for a simple but good way to represent file system tree in my program. Currently I made a class having the following properties: name, type, extension and children. Every object of the class would store other objects of the same class in the children list. I'm a bit scared by the vision of scanning a tree, but maybe that's just because I'm just a beginner. Is tree the best way? I want to be able to for example go through every element of the tree and do some operations on the files. I would like to be able to go through the whole tree like below, and create all the files (index.html, etc.) and directories accordingly to the recipe below. website --- | --- index.html | --- style.css | --- images --- | --- img1.png | | --- img2.png | --- bloat.js
Hong, Guil Dong · 2020-10-01 02:19
>>19888 Sounds like you already knew how to solve it but was too lazy. This is a pain in the butt, I'll give you that...
JARGON · 2020-10-01 06:58
Does Lisp employ a "main" function/entry point for writing programs?
Cat Mother · 2020-10-01 14:54
>>21063 >Does Lisp employ a "main" function/entry point for writing programs? I don't know about Common Lisp, but in Guile Scheme it looks like this: #!/usr/local/bin/guile \ -l fact -e main -s !# (define (choose n m) (/ (fact m) (* (fact (- m n)) (fact n)))) (define (main args) (let ((n (string->number (cadr args))) (m (string->number (caddr args)))) (display (choose n m)) (newline))) But that's probably just for scripts. Ask in the Lisp thread next time >>>/λ/15857
Unsigned · 2020-10-01 16:43
>>21063 Most Common Lisp implementations allow you to choose an arbitrary entry function. But when they don't you can just put a function call at the end of your root file to call whatever you chose to use as your entry point.
Kay · 2020-10-01 16:44
>>21065 In any case, usually you use ASDF which has all sorts of nice fancy things which allow you to not really care what your specific implementation does for this because it manages that on its own.
Church · 2020-10-04 11:10
I was too afraid to start contributing to open-source for a long time and hated myself for it. Now I seem to have started, but so far only done good-first-issues and hate myself for it. Question to more experienced open-source contributors: is it cringey to do multiple good first issues in a row in a project? Would that look like laziness/stupidity?
hash table · 2020-10-04 13:33
>>21120 I wouldn't worry about it if you're still new. It'll be better to move onto more difficult issues but no one is going to begrudge you for having your first few ones be easy.
bit · 2020-10-04 13:55
>>21120 >Question to more experienced open-source contributors: is it cringey to do multiple good first issues in a row in a project? Would that look like laziness/stupidity? You're overthinking this too much. Every issue you solve is good for the project and you're still learning, so this is justified. It takes time to learn and the community should be happy you're willing to help them. But try gradually to do harder task, as this way is the only way you learn.
Morpheus · 2020-10-05 04:59
Need some help with converting a int to string. In the image, i need to be able to define a string variable using just the macro. Problem being the macro contains __LINE__ , which is well, an int, and thus the rest of the strings can't concatenate. Also, does the preprocessor, say, replace the whole macro and then replace things such as __LINE__ or does it start from top to bottom replacing the definition of the macro by the contents of __LINE__?
Tyrell Wellick · 2020-10-05 06:37
>>21130 // requires c99 features like string literal concatenation // in real life just pass __LINE__ as an arg to printf(), perhaps via a macro #define msg(prefix, suffix) _msg(prefix, __LINE__, suffix) #define _msg(prefix, lineno, suffix) prefix _id(lineno) suffix #define _id(x) #x msg("abc", "xyz")
Jean Dupont · 2020-10-05 10:46
Does anyone know of a `literate' (as in literate programming) operating system e.g. written in CWEB?
Cypher · 2020-10-05 14:53
Anyone have recommendations for resources for learning modern Javascript? Webdev moves so quickly I don't really trust stuff from even 5 years ago. I've already started reading Eloquent JS, is that a good pick?
Faye Valentine · 2020-10-05 15:16
>>21137 Eloquent Javascript is a hard read, I feel like you need a teacher to go along you with it.
Unnamed · 2020-10-06 06:43
>>21136 This is as close as you're going to get. https://www.tuhs.org/Usenet/comp.sources.unix/1983-July/003656.html
Frank Garza · 2020-10-07 17:11
>>21151 How does that have anything to do with literate programming? It's literally just C. In case you don't know what literate programming is: http://literateprogramming.com/
Davis · 2020-10-07 19:26
>>21166 I'd love to see some examples of this. The idea sounds good (and I've definitely caught wind of the core concepts from talking to CS people) but I'm having trouble picturing what it looks like in practice.
John Titor · 2020-10-07 20:53
>>21169 TeX is a literate programme. So are the literate-programming programmes (weave, tangle). The basic idea seems to be to write exactly one document per programme, from which everything is derived. That means the documentation and the executable are all in one place. More than just that, it's primarily documentation, with the code added in so that it can compile. Contrast this to `comments' in a machine instructions document, which tend to be abysmal unless you're inured to the highly specific decisions made for that computer language.
Spooky · 2020-10-11 16:53
How does a program read a stream of video/audio bytes and output the content to the user? Are there any programming languages that are incapable of doing that?
Incognito · 2020-10-13 07:00
>>21296 Video codecs allow you to read a stream of bytes into videos
Ivan Petrov · 2020-10-13 07:34
>>21296 On Linux you can pipe data to /dev/audio to listen to raw audio (.wav files I think), and you can pipe data to /dev/fb0 or something, it's the framebuffer, I don't know format of fb0 and obviously depends on your system. This probably doesn't help though
Hong, Guil Dong · 2020-10-13 12:40
>>21296 I might get parts of this wrong... I believe low-level audio output typically puts PCM samples, of some format (s16le, u8, f32 etc. linear alaw ulaw samples), and then points the sound system at the samples. The sound system could be a soundcard, a primituve sound chip, or device driver software, or a sound library of some sort... The functions involved likely tell the sound system the sampling rate, sample format, length of buffer (or equalivant). There may be a callback function registered that the system invokes when the buffer segment is done playing, to load the next buffer segment or what-not. You may need to transcode a media stream if the sound system doesn't operate on all formats/sample rates or otherwise needs preprocessing. It is not a coincidence that old-school basic WAV files had sample data similar to what SoundBlaster cards used directly. I don't know what I'm talking about... Just read these: * https://forums.osdev.org/Sound * https://www.vogonswiki.com/index.php/Audio * https://www.kernel.org/doc/html/v4.15/sound/kernel-api/writing-an-alsa-driver.html * http://www.cs.albany.edu/~sdc/CSI500/linux-2.6.31.14/Documentation/DocBook/writing-an-alsa-driver/index.html * http://manuals.opensound.com/developer/drv_intro.html * https://www.quora.com/How-difficult-is-it-to-create-a-hardware-driver * https://forums.osdev.org/Sound_Blaster_16 The qword-os folks don't seem to have sound yet. https://github.com/qword-os/qword/search?q=audio They have an incomplete libc going, partially based on musl-libc. They love anime and cat avatars over there but have a thing going on. :/
quote · 2020-10-13 19:50
I'm good at C# and SQL, particularly dealing with messy databases, or importing/exporting data from weird places, and I prefer to build cli, desktop or backend. I also have some interest in Functional Programming (F#, Elixir). Should I go into ML, or Data Engineering? I mean, which would be a better fit for my skills?
Dox · 2020-10-14 18:08
What should I know before tackling compilers? I tried reading the Dragon Book in the past and it seemed very cryptic. I'm guessing a good knowledge of architecture, especifically things like state machines? I also wonder if theory of computation is necessary at an early stage. Should I be able to do something like design a Turing complete machine before having a go at it?
Splicer · 2020-10-15 22:36
How can I build an offline/cloudless voice assistant/interface? I'm more interested in voice control than the AI side of it.
Ein · 2020-10-16 00:52
>>21423 For the AI side, I haven't looked into it but MycroftAI may be useful. I think they use a Mozilla voice recognition tool so that might help.
Yamaoto Toshi · 2020-10-16 02:16
>>21405 Not necessarily very much, if the goals are modest enough. Forth deliberately cuts out many features that would have complicated design. Did you have something in mind or just wondering? Technically writing macros is not unlike a mini-compilier that translates mini-structures into host programming language. For example: (defmacro when (pred &rest exprs) `(if (pred) (progn @,exprs) nil))
() · 2020-10-16 14:21
>>21429 Just wondering, I want to learn about compilers in general, not for a specific application.
x&lt;-&gt;y · 2020-10-16 15:57
>>21435 Let's write a TinyBasic clone! In C or what-not, not assembly... https://www.drdobbs.com/web-development/the-return-of-tiny-basic/184406381 This kind of interpreter is not too far from a bytecode interpreter (even when implemented as a text-based "immediate interpreter"). The syntax isn't complicated and there is no tree-rewriting or anything. Just emit tokenized units/bytecode. The line comment token (REM ) can even be implemented as a bytecode of sorts lol. I think that's funny... More complex languages would need more sophistication. TinyBasic only has 26 user variables with one-letter names [A-Z], so there isn't much of a symbol table or parsing... (you do need to tokenize at least). You will need to account for GOTO line numbers somehow... Either the system is organized by lines with a line index, or if there is an array of ints used as bytecodes then still need a index. :/ You COULD execute/interpret a line structure, that holds entire 80-char width lines (only partially filled usually) instead of indexing. That would be wasteful but computers are bigger since back then. There are many ways to do it. Have fun!
swap · 2020-10-19 18:31
>>21496 The compiler doesn't care about where goto sends you, all it does is send you there. When you reach your `goto label;`, the compiled program will simply "move up" a few lines and keep going. When it reaches the end of the function, it exits the function without knowing or having cared about the goto. Apparently it's a real pain point for C compilers because a goto can really point to almost anywhere in the AST, making code analysis tremendously more tedious as well.
Chani · 2020-10-19 21:49
>>21499 thank you
Jean Dupont · 2020-10-19 22:27
Is there any reason to not just use PHP for backend stuff? I don't want to learn a fancy new framework if PHP can get the job done for nearly every task. Is it just because it's old that it's not "popular" anymore among web developers? I feel like I should just learn PHP and not bother with any javascript stuff, like node.js.
stack · 2020-10-19 23:13
>>21502 PHP used to be soykaf, I hear it has gotten better in recent years and there's a lot of Laravel work openings, but I'm to scarred to ever go back to it regardless. If you're already coding in PHP there's nothing wrong with that, but if you're still learning I'd strongly urge you to consider Ruby or Python instead (fuarrrk it, even C# or Java would be better). Javascript is a must if you ever intend to do fullstack or some frontend here and there, maybe learn enough to get soykaf done, but I'm not particularly fond of it on the backend.
Agent Jones · 2020-10-20 01:59
Anyone got PDF(s) of Knuth's Art of Computer Programming series?
Spooky · 2020-10-20 07:52
>>21513 They're on LibGen.
XERXES · 2020-10-20 23:41
>>21151 >>21166 Back in 1972 (around the time UNIX was first being developed) a paper was published explaining source code of an OS. "OS 6—An experimental operating system for a small computer" (Part 1 & Part 2). https://doi.org/10.1093/comjnl/15.2.117 https://unpaywall.org/10.1093%2Fcomjnl%2F15.3.195 another version: https://www.cs.ox.ac.uk/files/3230/PRG08.pdf Almost like the Lion's book! Pic related. I can't tell if the Bell Labs and Oxford projects knew of each other at the time... But it is reference [10], [11] in dmr's "Portability" report. https://www.bell-labs.com/usr/dmr/www/portpap.pdf I *think* it was different than IBM's OS/6 and other things with similar names... But you never know! The terminology is fairly modern already in the 70's, "filing system" etc. OS 6 was written in BCPL and thus described as a "virtual machine" (BCPL was often interpreted).
aliased · 2020-10-21 16:27
Is it worth it putting in time in books like Clean Code or are they just common sense repackaged? I'm thinking of getting it now because it's cheap and I my attention span dwindles quickly with pdfs.
list · 2020-10-23 01:02
hello lainons It feels silly to ask this, I started school this fall, enrolling in CS, but seeing the amount of resources and books on mathematics, programming and CS in general, it feels like CS is mostly self-teachable while hardware is not. In the event I switch to electrical/computer, what will I miss out on if anything? My advisor was near useless when we discussed this.
Pulse · 2020-10-23 01:48
>>21571 I'm a CS graduate and I think you're mostly right. Hardware is a clusterfuck when it comes to getting good information, while coding you can pretty much figure out on your own. I assume HW cirriculum includes an Operating Systems course, but if not that's one CS class you won't want to miss. Taking an algorithms course is also a good idea.
Koos van der Merwe · 2020-10-23 01:49
>>21571 Hi anon, one of my friends did this. He was an EE that self taught CS stuff. Most CS stuff is indeed self teachable since you don't need hardware. EE/CE will miss out on more theory but operating systems and an elective algorithms paper will give a good foundation.
Qt · 2020-10-23 02:02
>>21572 >>21573 that's great to hear. But when you say that it's self-teachable, how effective would it be to do so? I'm considering CE because I want to build and program electronics as a hobby, plus CE seems to have wider career choices. What should I consider while planning for switching ?
Faye Valentine · 2020-10-23 02:23
>>21542 I would continue to take the intro CS classes for your first year since you're already enrolled you'll get a good foundation. With an algorithms and OS class you'll be pretty close to a minor so you might as well go for it. I would bet you get a some amount of straight coding experience in HW classes, but there won't be any focus on good coding practices, so I'd check out books like Clean Code, and Agile Patterns and Practices Self learning effective if you have the drive to push yourself to do it. That's the hardest part. I'd suggest picking a project (something cool with Arduino, a website idea you have, a game idea you have) and try to make it. Use git for source control, it's used everywhere these days.
Jet Black · 2020-10-23 18:52
How to select M optimal elements from the set N? There is some cost function, we can evaluate each element individually, but the problem is that the elements correlate and m elements with the maximum individual value don't give the maximum possible group value. What are the general approaches to solving such a problem?
word · 2020-10-23 20:02
>>21586 Hard to say without specifics, but often you can represent the dependencies between elements as a linear system and solve it. Try to construct an equation where the optimal solution will be a root. Even if you can't solve it algebraically you can restate it as a fixed point problem and approximate the solution numerically.
HELIOS · 2020-10-23 21:01
>>21593 The problem is that the dependency between the samples is too complex and I don't know it. Let's say I have a 52-card deck and I can't go through all 311875200 combinations, I need to find a good hand in a relatively small number of iterations.
Anamika · 2020-10-23 21:39
>>21594 If you can't make some good guesses, there's only brute force. Also, you said "optimal" and then you said "good". Which is it?
Dox · 2020-10-23 21:46
>>21596 "Good" is a good start.
Case · 2020-10-24 03:03
>>21586 >>21594 If scoring poker hands, the correlations form tieted layers without overlapping ranges. Therefore you can try the top layers ("hands") starting with "Royal Flush" on down to "High Card". https://briancaffey.github.io/2018/01/02/checking-poker-hands-with-python.html/ After seeing that a certain "hand" type is possible then evaluate possibilities within that hand type. Of course this means choosing 5 out of 10, up to ten times, and coding 10 functions to examine each hand type... But those 5/10 x are all simpler individually than the full C(10, 5).
Meddler · 2020-10-24 03:41
>>21601 I'm looking for a general solution with much more complex cost function. Thanks for the code, it will be easier to test.
string · 2020-10-25 22:27
i need to process the wtmp file on the user's machine in my C program, but i only need the entries made on today's date, more or less. So I need to loop through the file entries until I reach today's date. My question is this: What's the simplest, most elegant way of checking if a time_t variable is "Today", the simplest I can come up with is converting it to struct tm, then comparing every relevant field with the output of localtime(). Is that simple enough, or is there some standard library function that could shorten this further?
Kay · 2020-10-26 00:45
>>21646 Perhaps finding a numeric value for 'Today 0:00am'? I think mktime(3) is the function for that (returns time_t), ge localtime, change the hour to 0:00 and feed it back to mktime, to have an absolute value of today. Then just compare each record's time as an absolute numerical value. Hope I'm right...
Neo · 2020-10-26 01:15
I'm just starting to learn databases, once I learn it what kind of projects could be done to display in my github? Does it make sense to create a small DB to mess around with it a bit or it's stupid unless you're dealing with a large set of data? I've seen people saying that it's important to have created a couple DBs as a qualification for certain jobs and I found myself wondering how would this happen unless the person had previous experience in a company.
dictionary · 2020-10-26 04:42
>>21646 #!/bin/sh TODAY=$(date +"%F") # pass wtmp file as arg grep -e "^$TODAY" "$@"
Junichi Fujiwara · 2020-10-26 07:52
>>21650 thanks, i've been thinking of something like that, I'm still undecided over whether that's simpler than the first option or not, but i'll have to decide on one eventually.
Arisu Mizuki · 2020-10-26 11:52
>>21604 Determining the best possible subset without any other context is NP-hard, so there's no generic algorithm. You can probably get good enough solutions using heuristics, but we'd have to know what you're actually trying to do here.
Roy Batty · 2020-10-27 18:42
in C code, if I have a function that takes a long int pointer as a parameter but I need to feed it the address of a shorter variable as an argument, what will the end result be. wouldn't the function end up taking junk after the variable I need, even if I cast it, and if so, how do I fix this. as an example: say I have the function: void f(long *param) and a variable int arg; , that has some address (let's assume long is 8 bytes and int is 4 for the sake of the example) if i try to execute f(&arg); , first of all, I'll get a warning about incompatible pointer types. but second of all, even if I fix the warning with a cast for arg, the function will still grab junk after the variable. is there any way to make sure the function only uses the content of the int variable, without getting anything afterwards, even tho it's parameter is (long *) width
Naomi Nascimento · 2020-10-29 00:56
>>21675 I'm not a C programmer and I don't mess around with it often. (So if anyone more qualified could answer the question, that would be lovely.) Anyway, the problem is that casting a pointer between types doesn't reallocate space or change alignment (so casting to a pointer of a larger type is unsafe). Take this source code for example: int main(void) { int64_t A = 0x40; int32_t B = 0x20; f(&A); f((int64_t*)&B); } If you look at the disassembly, you will get this: main: ... mov qword [rbp-0x10], 0x40 mov dword [rbp-0x14], 0x20 lea rax, [rbp-0x10] mov rdi, rax call <f> lea rax, [rbp-0x14] mov rdi, rax call <f> ... f: ... mov qword [rbp-0x8], rdi mov rax, qword [rbp-0x8] mov rax, qword [rax] ... Here's what the stack looks like (at rbp-0x14): 20 00 00 00 40 00 00 00 00 00 00 00 Can you spot the bug? The cast didn't change the initialization from dword to qword. You initialize B as a dword but then you always treat it as a qword. The problem is that if you want to treat it as a qword, you have to make sure that everything next to it is set to \x00 so it doesn't interfere with whatever you're doing. In other words (and this is probably easier to understand), if you allocate enough space for a dword (4 bytes), you can safely use only those 4 bytes. I believe you understand this already (you even described this, probably): when you call <f> with [rbp-0x10] as an argument, you pass it a qword pointer to 40 00 00 00 00 00 00 00 . However when you call it with [rbp-0x10], you pass it a qword pointer to 20 00 00 00 40 00 00 00 . The stack is not clean and simply recasting an address (&) from one type to another won't magically clean it up. What you could do is allocate B somewhere where there is no interference (good luck with that), initialize it as a qword or somehow clean the space next to it. I'll show you why you could easily cast it if the <f> function didn't take a pointer: main: ... mov qword [rbp-0x08], 0x40 mov dword [rbp-0x0c], 0x20 ... mov eax, dword [rbp-0x0c] cdqe mov rdi, rax call <f> The cdqe instruction copies the sign bit of the dword in the eax register into the high 32 bits of rax. Basically, it correctly cleans up the rax register so that you can safely pass eax to a function which would otherwise take an rax. This is the same thing as cleaning up the stack except we're using rax, not the stack.
Koos van der Merwe · 2020-10-29 01:01
>>21702 >However when you call it with [rbp-0x10], I meant [rbp-0x14]. Also would you look at that, you can't use tabs for indentation :-/
Pulse · 2020-10-29 07:04
>>21702 Thanks for the explanation, I guess the only solution is basically to move what I meant to be the argument into some other empty variable that's the right width, and then copying it back if I need to.
Hitomi · 2020-10-30 14:41
What are exactly the pointers in C++?, I'm so confused about that, I know what are things of memory and manipulation of memory.
t · 2020-10-30 16:02
>>21735 A pointer is a variable that happens to contain a memory address. Memory addresses are basically integers. Consider the following: C int a[5] = {10, 20, 30, 40, 50}; long unsigned int ptr_a = &a[0]; long unsigned int ptr_last_a = ptr_a + (4*sizeof(int)); int b = *(int *)ptr_last_a; assert(50==b); /* true */ The first line creates a region of memory big enough to hold 5 integers and assigns it the values 10 to 50. The second line creates a long unsigned int, basically a regular non-negative integer, and assigns it the memory address of the first element in a (you could also just write that like ptr_a = a, but the reason why this works would require further elaboration). The third line computes the *memory address* of the last element in the array, by taking the memory address of the first element and adding the size of an integer four times. The fourth line simply says "copy the value of the memory address stored in ptr_last_a to b". Now you might be wondering why the (int *) part is necessary. If memory addresses are just integers, couldn't you just do `int b = *ptr_last_a;`? This is why pointer types are useful. Pointers can of course point to things that aren't integers, but in order for the compiler to be able to copy whatever a pointer is pointing at to some other memory region (like we did when we assigned a value to b) it needs to know how big both memory regions are. This is what that (int *) bit is saying: "interpret the memory region at address ptr_last_a as an integer". Clearly you would never actually write code like that example, but seeing that it works should tell you a bit about what pointers are. Here are some more conventional ways to do the same thing: C int a[5] = {10, 20, 30, 40, 50}; int *ptr_a = &a[0]; /* The following are equivalent */ int b = a[4]; int b = ptr_a[4]; int b = *(ptr_a + 4); /* Bonus: why didn't we have to use sizeof() here? */
Debbie Charteris · 2020-10-30 18:20
How much experience in programming should I have before starting to study testing? When I try to find out what path I should trail in regards to self-learning and possibly posting in github in the future I always see testing being mentioned, but it seems there's so much stuff to do beforehand.
overriding · 2020-10-30 18:35
>>21738 By testing do you mean unit-testing? If so, you can start now. Is not hard to grasp and is helpful for planning the development of your app
The Oracle · 2020-11-07 20:17
I want to develop my problem solving skills in general, regardless of code. Would doing some math puzzle books help? I mean the more complex kind, there are some at Amazon based on math olympiads problems, for example.
Shirou Emiya · 2020-11-07 20:49
>>19146 Sorry but this book is just straight up ... horrible. I read the first 600 pages and dropped it after that because it just pissed me off. The writer is obsessed with Python as if it's a fetish and lives in this world where he thinks languages like C andC++ will be taken over by Python is the future just because it's "easier" to read. Every language got it's own usages and I don't see any point in calling one language the "best".
The Oracle · 2020-11-08 00:05
>>21933 Those kinds of puzzles are in general not, umm not generally life-improving in their own right. Of course you need to pass an interview and maybe get a degree anyways. :/ In principle the most advantagous forms of problem-solving are akin to a farm-boy fixing tractors and things around the farm, business accumen and social/life-skills like negotiation. Of course hardly anybody works at a farm anymore... >test prep Oh I see... There are many search results for that, it is important even if semi-artificial. Study hard and get as many interviews as possible! One of them may hire you eventually... Read all the books, and not just the technical questions but other aspects too. But study hard, start now. Try not to lie on your resumé, but you may have to lie...
Random · 2020-11-08 13:01
>>21942 >akin to a farm-boy fixing tractors and things around the farm Do you mean I should try to fix things whenever an opportunity rises? Around the house, for example, so I learn to solve all kinds of problems. As much as that interests me, and it does, I don't think it'll be all that useful for an interview focusing on math-y problems, unless we're talking about having a hobby like electronics. >business accumen and social/life-skills like negotiation I wish to improve those as well, but I'm afraid it's not as straightforward as getting a book.
Koos van der Merwe · 2020-11-09 00:37
Can anyone tell me where to find an archive of all the threads posted in this board? I just discovered this site and I didn’t know it was made in 2017. For research purposes
Hitomi · 2020-11-09 14:24
After going through books like Silberchatz and Tanenbaum, what's the next step in studying operating systems? I'm aware there's always more to be learned about architecture, circuits and many other things, but I was thinking about books dealing specifically with OSs.