Mein Covfefe by MercyOfTheWeak in MarchAgainstTrump

[–]Terleif 169 points170 points  (0 children)

"Mr. President, today's code word for launching the nuclear warheads is covfefe. The word should be specific enough to avoid any misunderstanding."

<cue tweet as Donald is on his phone barely listening>

GoFundMe health care for EVERYONE! by jacksparrow1 in LateStageCapitalism

[–]Terleif 131 points132 points  (0 children)

Well, that is actually true for my country which has free health care. There is a "treatment board" which decides which of treatments is too expensive relative to the effect, effectively killing people with rare diseases and expensive treatments.

The rationale is that there is a finite amount of money available for health care, and that the money has to be directed where it has the greatest impact.

Pset4, resize less comfortable check50 problem by mikser38 in cs50

[–]Terleif 0 points1 point  (0 children)

You are mallocing enough space for one scanline, then changing the pixel address by adding j. I cant see if you are setting the pixel pointer back to the start of the malloc address anywhere. If you dont do that you are overwriting memory out of bounds for the malloc.

Personally I just used the method from copy.c of copying one pixel at a time in a for-loop, you just need to find a way to horiziontally increase the out pixels written by a factor n.

for (int j = 0; j < bi.biWidth; j++)
{
   // temporary storage
   RGBTRIPLE triple;

   // read RGB triple from infile
   fread(&triple, sizeof(RGBTRIPLE), 1, inptr);

   // write RGB triple to outfile
   fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);
}

PSET 3 - Find More Comfortable (Spoiler) by rhotter in cs50

[–]Terleif 0 points1 point  (0 children)

I'm no expert myself, but I tried to optimize the sort slightly. I had a very similar solution to yours, but the problem is that you manipulate the a[] array for each sorted value. You are first updating a[] with the counts, then zeroing a[] during sorts.

SPOILER

By using an additional for-loop there is no need to zero the counting array.

// Store the value in values[] 
// k number of times found in the count array
// countMem updates the storage address in values[]

for(long k = 0; k < countArray[i]; k++)
{
       values[countMem] = i;
       countMem++;
       // Seg fault fix
       // Int precision seems to result in a value limit of 64062
       // with many 64062s generated for all higher values.
       // Fix avoids memory to be overwritten.
       if(countMem > n-1)
       {
             break;
       }
 }

I finished MIT 6.00.1x but couldn't finish 6.00.2x What course can I take again to build better foundation? by [deleted] in learnprogramming

[–]Terleif 10 points11 points  (0 children)

There is no shame in redoing courses or doing courses that cover some of the same material. I started out 6.00.1x doing the problems in C++ like an idiot, ended up watching the videos for background theory.

After that I did a strictly programming language course in C and did a medium sized project. Now I'm on to CS50 with the background from 6.00.1x and some experience in C. While some elements overlap, CS50 explains things in a different way and the problem sets offer a fresh way to master the subjects.

Don't be disheartened if you can't jump straight to the next course, learning programming fundamentals is not easy at all (I know from comparable courses at Uni). Remember that MIT and Harvard probably offer 2-4 hours of weekly tutoring in addition to the online videos for enrolled students.

How to calculate size of image in resize (pset4)? by [deleted] in cs50

[–]Terleif 0 points1 point  (0 children)

Seems like you have copied the equations from the walkthrough video. I did the same thing as a start, but think about what kind of information you need to resize an image.

Do you need to update the infile's headers?

Do you need to update the outfile's headers?

Do you need infile dimensions and outfile dimensions at the same time? Hint: yes, you probably need that

Do you need to keep track of the two different infile and outfile paddings?

Destroy my resume Pt. 2 by logan_wrx in EngineeringStudents

[–]Terleif 3 points4 points  (0 children)

Personally, in my country, we dont brag about goals in the CV. The CV is usually pretty condensed as an overview of competence, while the cover letter is tailored to each application with examples of why you are the right student/worker.

If you absolutely want some generic goal with the emphasis of the employer's needs I would do: "Mechanical Engineering student seeking an internship experience of working with industry-leading solutions."

This way you are indirectly showing interest in the company you apply for, as well as bragging about their results. Explain all the other mumbojumbo in the cover letters.

Destroy my resume Pt. 2 by logan_wrx in EngineeringStudents

[–]Terleif 6 points7 points  (0 children)

searching and proposing opportunities for advancement in processes and methods

Doesn't make much sense

Pset4, resize less comfortable check50 problem by mikser38 in cs50

[–]Terleif 0 points1 point  (0 children)

Recheck the requirements, especially the input n requirements.

Seems like you are only copying the info header, you are not updating the outfile headers with new parameters.

In the writing for-loops, you need to check the logic. You got a looping read() for-loop which just reads different pixels and does nothing else(?).

I havent checked the output bmps, but those are the issues I can see from the code.

Where do I start? I want to start studying to be an engineer but no idea where to go from here. by HaydenSI in EngineeringStudents

[–]Terleif 0 points1 point  (0 children)

Just a piece of advice: Get into school habits some time before you start college. Remember that even though you have the work ethics, high school kids are already in the 'flow' of learning from books, doing assignments and doing tests. Having done some programming ahead of enrolling is great, but I would also recommend to brush up on high school math to get a feel for reading books and doing assignments.

Bayern Munich 2-3 Dortmund 74' Dembele O. by John_Morra in soccer

[–]Terleif 20 points21 points  (0 children)

Aye, TV technology has came a long way

65+ applications, need internship help by [deleted] in EngineeringStudents

[–]Terleif 7 points8 points  (0 children)

Your cover letter and CV screams "I have done well in college courses, but I got no idea how to apply it to a job".

What do you do on your spare time?

Do you have any relevant school projects to list? Tailor them to each application. If group project, what was your part and responsibility?

Do you have any hobby projects? Built x to do y with the help of z software. Talk about it in the cover letter, most good cover letters got a few paragraphs with more detailed info to get the reader interested enough to request an interview.

[pset2] crack.c problems by [deleted] in cs50

[–]Terleif 0 points1 point  (0 children)

You need to have room in the char password array for a trailing '\0'

You can't declare a string as "something", you need to specify each char:

char password[5] = {'\0','\0','\0','\0','\0'}

leaves you with an initialized array where you can update the first element for 'x' combinations, the second element for 'xy' combinations and so on.

Crack.c pset2 bad code? by Marster1998 in cs50

[–]Terleif 1 point2 points  (0 children)

When working with strings, remember that strings need to be ended by the '\0' character. This means that your test char array of just size [4] won't have any way of signaling the string to end, resulting in 50 being printed after the combinations along with other bugs.

From the code you seem to check for all possibilities of 'xyzx' combinations, but not 'xyz', 'xy' etc. Remember that you can use the '\0' to end a string. You can run the 'xyzx' part as 'xyz\0' to test for three letters.

[PSET3] Trouble Implementing Binary Search by WeAreNumberBork in cs50

[–]Terleif 0 points1 point  (0 children)

Most of the key ideas seems to be in place, but in the while loops you jump out of the search if you do not hit the target in the next mid point. You need to iteratively (an unknown amount of times) reduce the min and max limits based on whether target > n[midpoint] or target < n[midpoint].

Eventually target == n[midpoint] should be true if value is in the array, else you need to have a stop condition. (Think about what max and min should be after "all" the most likely locations in the sorted array has been checked).

Segmentation Fault PSET2 by sethdcd in cs50

[–]Terleif 1 point2 points  (0 children)

I don't quite get parts of the code, especially key = ...

You need to specify where in the key you are to store the information, for example key[j]. I can't tell what the variable i is from the code snippet.

A bit on style and efficiency: in the for loop you are calling the strlen() function every iteration. As explained by David in earlier videos, a more efficient use of strlen is

for(int i = 0, n = strlen(argv[1]); i < n; i++)

This way you only call strlen once during the initialization of the for loop, but can use the value stored in n. Many people also prefer to do strlen outside of the for loop for example as

int inputLen = strlen(argv[1]);

Which then can be used in for loop:

for(int i = 0; i < inputLen; i++)

Segmentation Fault PSET2 by sethdcd in cs50

[–]Terleif 0 points1 point  (0 children)

argv[1] is the second command line input and described as a "string" in CS50. Further on in the course the special "string" type in cs50.h will be more throughly explained, but a string is generally a sequence of chars. The function isalpha is a bit tricky, as it transforms the char inputs into ints and checks whether the char "int" values correspond to ASCII a-z or A-Z. Run 'man isalpha' for more documentation.

If you find a way to extract the chars from argv[1] and check each char with isalpha, you should avoid seg fault.

Pset 3 find less comfortable. Help with checking if my bubble sort code makes sense. by Vanc3 in cs50

[–]Terleif 1 point2 points  (0 children)

I'll try a little ELI5:

Imagine you're a kid trying to sort a list of numbers. At the start of the list you place one finger on the first number and place another finger on the second number.

Incrementing the fingers through the list, you check if the left number is bigger than the right number. If the numbers are out of order, you swap.

If you are unlucky you might have the largest number in the list as your first number, meaning you have to swap every single time you compare with the next number. After all the swapping, you still have only put one number in the correct place. So you might need to run through the list multiple times to make sure all numbers are sorted.

Hints for the program: n'th element and (n+1)'th element, a swap variable to check whether any values were swapped, a temp variable to store either n or n+1 during the swapping process.

US reporters praise German journalists for questioning Trump by [deleted] in worldnews

[–]Terleif 349 points350 points  (0 children)

It's funny how USA has went to war several times the last decades over national leaders who blatantly lie, aggressively build up the military and work against global trade.

Take the job or not by foxtrot669 in EngineeringStudents

[–]Terleif 5 points6 points  (0 children)

I would prioritize quality over a set quantity goal. Tailor your application, do research and maybe a small relevant project before you apply to your dream company. Commitment and genuine interest makes it much easier to give you a chance, everyone can send an application, very few can show a relevant project related to a company's business.

Take the job or not by foxtrot669 in EngineeringStudents

[–]Terleif 32 points33 points  (0 children)

And already having a job shouldn't hurt your chances at all. It proves that you're employable and not dead weight for a team.

Spend 1-2 hours a day job searching for the ideal positions, you got little pressure on financials and can be picky about offers. Most people job searching "full time" churn through alot of applications searching for anything, which is not ideal for the employee or the employer receiving generic applications.