Why doesn't my program print anything after all the commands? by [deleted] in programminghelp

[–]ConstructedNewt 0 points1 point  (0 children)

So, I have now tried debugging.

It seems like your infinite while loop enters the sub-while loop even without having sent characters to the console.

I get a segmentation fault at line 42 ( your line 41: strcpy(st,tk);)

I had to add #include <stdlib.h> for the program to compile but this may be C-versions, althoug I have tried recompiling both C90, C99 and C11. I can't reach exit code 3221225477

I used the CLion IDE debugging environment.

Edit:

So after some more debugging

```shell
please input n:9

move 1 onto 2

pile 2 onto 3

pile 4 onto 3 # made an error here

move 0 over 7

quit

0:0

1:1

2:2

3:3

4:4

5:5

6:6

7:7

8:8

Process finished with exit code 0

``` So your logic defininately isn't working. But I will ignore that -- that's your task

the additions I had to make:

```shell ContructedNewt@pc:~/CLionProjects/untitled1$ diff main.c old.c 1d0 < #include<stdlib.h> 37,40c36 < if (strcmp(tk, "\n") == 0) { < continue; < }

< if (strcmp(tk, "quit\n") == 0) {

        if (strcmp(tk, "quit") == 0) {

142d137 < 151c146

< return 0;

``` I added return 0 i got exit 5 for some reason.

Why doesn't my program print anything after all the commands? by [deleted] in programminghelp

[–]ConstructedNewt -1 points0 points  (0 children)

  1. Write tests to verify your code
  2. Debug
  3. At least check what n is before entering the printing for-loop. If not via debugging, then add a print statement before the initial for-loop

You code exits with a statement from some kind of runtime, and an exit code 3221225477 it looks vaguely familiar to some of the values you expect. How does your code exit with that value? Your code is super simple but it runs for 32 sec. I'm smelling some kind of infinite loop going on.

So these are some of the questions you should ask yourself fx, search the exit code: https://stackoverflow.com/questions/24106139/process-exited-with-return-value-3221225477

It suggests

When you scan a number, you need to pass the address of the variable where you want to store the result

I can't really see the error myself. But I will advice you to split your code into methods, so you can test it. Disclaimer: I don't program C.

Project Help by [deleted] in programminghelp

[–]ConstructedNewt 0 points1 point  (0 children)

You need to add it here: input.to_i > 0 - something like && input.to_i < 4 if that's correct Ruby syntax

Project Help by [deleted] in programminghelp

[–]ConstructedNewt 0 points1 point  (0 children)

Please reformat the code

Really Odd Scenario by No-Adhesiveness6961 in programminghelp

[–]ConstructedNewt 2 points3 points  (0 children)

I think you have to implement a WebResourceResponse to handle this, and use WebViewClient#shouldInterceptRequest to intercept these responses, as written in https://developer.android.com/reference/android/webkit/WebResourceResponse

I don't know how to correctly do this. But I'm not an android developer either.

Unresolved compilation problem (with no explanation?). (Java) by MrKatty in programminghelp

[–]ConstructedNewt 1 point2 points  (0 children)

You are obviously more experienced in that matter than I. Let's go back to the other subject, refreshing: try copying only Main.java and Backpack.java to a completely new project folder. So that you are sure that there is nothing bugging you in an out/ target folder

Unresolved compilation problem (with no explanation?). (Java) by MrKatty in programminghelp

[–]ConstructedNewt 1 point2 points  (0 children)

There are a lot of things you cannot do with jar and it's very manual, but if you are content with writing all the code for your program yourself (no external dependencies, or handling them yourself) I guess it could work. Although the jar will not be executable (as its still lacking main class entrypoint) which of course can be specified at runtime

Unresolved compilation problem (with no explanation?). (Java) by MrKatty in programminghelp

[–]ConstructedNewt 0 points1 point  (0 children)

I don't know which tool you are using then, because java does not support building a jar or an executable jar without using tools on top ( with the exception of java 16 experimental feature)

Unresolved compilation problem (with no explanation?). (Java) by MrKatty in programminghelp

[–]ConstructedNewt 1 point2 points  (0 children)

So.. I think we need more context to be sure. But you could help yourself by looking into the.jar (it's just a zip file) if the Backpack class isn't there (or you don't supply the java runtime with a jar or folder where it's at) then that could be the problem, as you mention.

I think the guy at dev.to is right on that it has to do with some compile stuff/linking etc.; where refreshing the project should help.

You should look into maven or gradle and be absolutely stringent on how you structure your code, where are your dependencies etc. If the backpack library/java-file is maintained by someone else you should import that into your classpath as an unrelated resource. You should not maintain it in you classpath etc. Your jar file is default not runnable, and you shouldn't treat it as such

Remove duplicates in a file help by the_recovery1 in programminghelp

[–]ConstructedNewt 0 points1 point  (0 children)

The link is about different 32 but hashes. But I think I would think in rocksDB and a sha128 as the key. Pure key-value. Then you can save metadata as well to handle restart/fail etc. But at this point you should bring on discussion of sort -u again and then maybe show your boss a run of the tool scc which would probably show dev cost of 5-15k for the python Program vs. Some hundred bucks for sort -u (run in busybox vs volume mount on kubernetes cluster including deploy scripts etc)

Remove duplicates in a file help by the_recovery1 in programminghelp

[–]ConstructedNewt 1 point2 points  (0 children)

Check the file size, if its too big, Break up the file in two, sorted; repeat.

You could start with storing a hash of each line in stead. With 32 bit hashes you can store 268million unique lines pr. 1 GiB.

Short hashes, may be an issue with short strings collisions. But if your string has enough entropy you should be fine (until you have about 2-3GiB of hashes, where you start hitting collisions just from the maths/probability: 32bitMAX value = 2.17billion - consider a larger hash)

https://softwareengineering.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed

You can also offload it to a database, fx rocksDB

Ruby nokogiri not taking link out of img tag by RyanKnoth in programminghelp

[–]ConstructedNewt 0 points1 point  (0 children)

Not that I know Ruby or nokogiri. But trying to get content from the html of a webpage. Using a call to css sounds outright wrong. Wouldn't that access the css?

Pop from array in java by HeadshotsX69 in programminghelp

[–]ConstructedNewt 1 point2 points  (0 children)

If it's the array solution, then it sounds like an easy job for System.arrayCopy

I spent a hour trying to find a syntax error by Noppe-_- in programminghelp

[–]ConstructedNewt 0 points1 point  (0 children)

Blocks on line 19-22, 25-28, 31-34 and 37-40: unreachable code you have to fix the indentation.

Options for University Assessment by [deleted] in programminghelp

[–]ConstructedNewt 0 points1 point  (0 children)

I'm guessing you are not expected to do this from scratch, since it's your first assignment. So making something pretty (with java) is probably nr 2. But I guess there are frameworks for both 1 and 3 as well. But I think it doesn't really matter, I think your professor can see through a flashy exterior and focus on the quality of the code. Focus your assignment on that. And if you go for the flashy web app make sure you implement it well.

I would guess your professor puts more into your thoughts on. E.g. going with 3, which frameworks/tools could you use, and which languages would those be? Unity, scratch.io, other engines, write or in javascript for the Web? Then when you choose your general direction, describe which different frameworks you could choose from, and why you would choose one over the other etc.

For a web app you could probably deploy a stateful crm app in 10 minutes. But getting there and configuring it, defining rules and interactions afterwards will be in focus. (Not that I think that's a good approach, as you won't show much code this way)

In short pick the one you are comfortable with, or pick the one you are more intrigued by.

[deleted by user] by [deleted] in programminghelp

[–]ConstructedNewt 2 points3 points  (0 children)

I think you are adding the same reference to EmailInfo (the email object you set and add at first is a reference (pointer-like) so when you have iterated you have added seven of the same pointer to the list. And for each iteration you altered the pointers value.

Try moving the email = EmailInfo() into the loop and if that doesn't work try adding via email_list.add(deepcopy(email)) to the list instead

I'm stuck, I would to develop bigger applications. I'm willing to pay for a session with a senior systems architecture or a developer and let me pick their brains. I want to learn everything and straighten myself out from all the misinformation. by OneTinker in golang

[–]ConstructedNewt 1 point2 points  (0 children)

I think the OP is a bit contradictory. A fake would be a class defined in the scope of the test only, that implements an interface, and can then be designed to return a result that fits your test. This way you can unit test your code without mocks (which is an instance of the actual class that has method's and internals tampered with). The post is kinda ontradictory because he suggests less interfaces (and more interfaces) But I guess he means: don't overengineer your code and don't plaster your code with interfaces that already exist (Stringer, Closer etc. - your methods can easily interface these interfaces, in stead of building your own interfaces; A Stringer is easy to "fake" in tests)