The Big Programming Thread - Page 858
| Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
|
Deleted User 173346
16169 Posts
| ||
|
Thaniri
1264 Posts
Thanks for the link though!! | ||
|
DickMcFanny
Ireland1076 Posts
| ||
|
Hanh
146 Posts
| ||
|
Manit0u
Poland17737 Posts
![]() And another good thing: http://naildrivin5.com/blog/2013/05/17/source-code-typography.html Especially for people doing JavaScript... The most important part of a variable declaration is the name of the variable (the second being its default value). Putting a comma first creates at typographic roadblock between the reader and the information they need (the variable name). That a comma is required between variable declarations is one of the least important pieces of information in this code, yet it’s front and center. This is bad typography. Whoever invented this "comma first" stuff is evil. | ||
|
waffelz
Germany711 Posts
| ||
|
Nesserev
Belgium2760 Posts
| ||
|
BluzMan
Russian Federation4235 Posts
On March 08 2017 23:50 Manit0u wrote: http://naildrivin5.com/blog/2012/07/17/adventures-in-functional-programming-with-ruby.html ![]() And another good thing: http://naildrivin5.com/blog/2013/05/17/source-code-typography.html Especially for people doing JavaScript... Whoever invented this "comma first" stuff is evil. God, please never ever do this in production code: Let’s re-set the argument list, aligning like with like, forming a table structure Anyone who thought of that never thought of using a VCS to merge stuff or auto-refactoring tools or even just manually renaming a variable. It's such a horrible habit people have despite any good styleguide (such as PEP8) explicitly recommending against it. Code is not there to look pretty, whitespace longer than one space should be used for indentation purposes only. Also, commas in javascript are the saddest thing ever. Starting as an Internet Explorer parser bug, the lack of trailing comma in array definitions inexplicably made it's way into the JSON standard, giving literal thousands of people nightmares about VCS conflict resolution, turning an innocent "me and that other Joe both added an item to the same array, what could go wrong?" situation into a syntax error after the merge. I'm still amazed how this got silently accepted by everyone. | ||
|
shz
Germany2687 Posts
| ||
|
Deleted User 3420
24492 Posts
It came in 3 stages. First stage was easy, it was debugging various snippets with a short time limit. Clearly for weeding out. I aced it, I am sure most people did too. Second part was also easy. 24 logic puzzles. I doubt I missed many. Unfortunately I do know I missed one because I realized I misread it after I submitted it. 3rd part I kinda botched. It was 2 coding questions and you got 70 minutes total. First question I got right except I was only passing 15 out of 18 test cases.. not sure why, I must have not read the question closely enough. I decided to move on to the 2nd question and come back to question 1 if I had time. Second question, I understood the question - and had an idea of how to do it. But I think I didn't plan properly, and I committed to a poor plan and wasn't willing to scrap it. And I tried to hack my bad code to make it work and I wasn't able to solve my bugs in the time limit. So I ended up completely failing on the 2nd coding question despite understanding how I could solve it. Oh well! I actually came in expecting to get my ass kicked. Most of the students there were going into senior year next year. Next time I have an assessment like this I am sure i will do much better. | ||
|
Manit0u
Poland17737 Posts
On March 09 2017 07:13 shz wrote: At least it will be fixed in ES2017: http://www.2ality.com/2016/02/ecmascript-2017.html Not a fan of trailing commas in function arguments though. It introduces some uncertainty when reading code (does this function take any more parameters? Are they set to null this way? Did someone forget or accidentally removed something?). | ||
|
BluzMan
Russian Federation4235 Posts
On March 09 2017 07:13 shz wrote: At least it will be fixed in ES2017: http://www.2ality.com/2016/02/ecmascript-2017.html Lol why would JS need atomics haha. Strange times we live in. | ||
|
Deleted User 173346
16169 Posts
| ||
|
Blisse
Canada3710 Posts
If you're reading the struct from read, or any network interface, you don't have that guarantee, so you have to sanitize the input. This is done by either force-writing a null character to the end, or reading only the char array into a buffer that you know is terminated with a null character. Reading your client code, you initialize a size 14 array and then fgets 14 characters + 1 null character, which is beyond the end of the array, but then you also overwrite that array with a string? You also never open privateFIFO in your client so your server never unblocks. https://linux.die.net/man/3/mkfifo Once you have created a FIFO special file in this way, any process can open it for reading or writing, in the same way as an ordinary file. However, it has to be open at both ends simultaneously before you can proceed to do any input or output operations on it. Opening a FIFO for reading normally blocks until some other process opens the same FIFO for writing, and vice versa. See fifo(7) for nonblocking handling of FIFO special files. You should really also, declare struct variables (fromClient, toClient) locally instead of statically declare main with the correct return type (int) use functions to compartmentalize functionality use a common header file to share code between the files | ||
|
Deleted User 173346
16169 Posts
| ||
|
Neshapotamus
United States163 Posts
| ||
|
Wrath
3174 Posts
On March 09 2017 07:18 travis wrote: I ended up going to that amazon coding assessment/interview thing. It came in 3 stages. First stage was easy, it was debugging various snippets with a short time limit. Clearly for weeding out. I aced it, I am sure most people did too. Second part was also easy. 24 logic puzzles. I doubt I missed many. Unfortunately I do know I missed one because I realized I misread it after I submitted it. 3rd part I kinda botched. It was 2 coding questions and you got 70 minutes total. First question I got right except I was only passing 15 out of 18 test cases.. not sure why, I must have not read the question closely enough. I decided to move on to the 2nd question and come back to question 1 if I had time. Second question, I understood the question - and had an idea of how to do it. But I think I didn't plan properly, and I committed to a poor plan and wasn't willing to scrap it. And I tried to hack my bad code to make it work and I wasn't able to solve my bugs in the time limit. So I ended up completely failing on the 2nd coding question despite understanding how I could solve it. Oh well! I actually came in expecting to get my ass kicked. Most of the students there were going into senior year next year. Next time I have an assessment like this I am sure i will do much better. I like puzzels. Could you please share some? | ||
|
bardtown
England2313 Posts
| ||
|
Deleted User 3420
24492 Posts
I can't because you have to sign a non-disclosure agreement and I am going to honor that. But I will tell you that they were not particularly hard, the only hard thing about them is solving them without making errors within the time limit. You wouldn't be particularly satisfied with them - any of us here would be able to answer them given enough time. | ||
|
Blisse
Canada3710 Posts
5-minute hard limit. Time yourself. Find the longest palindromic substring in a list of strings. For example, given strings: "carracecar", "aabbaa", "aabbbabab", return either "racecar" or 7. | ||
| ||
![[image loading]](https://media.giphy.com/media/OK27wINdQS5YQ/giphy.gif)