-
Posts
2,989 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by Green Baron
-
Sliding in 127. I am primarily sorry ... I should read. 137 it is, sorry.
-
I had to, i ran out of fingers. 109 Hu ? Is this the first time i'm in the games subforum ? Time for a new KSP version ! :-)
-
Well, it is not a question of investigations (there are more than one, including listening for "artificial" signals) or explanations. There are quite a bunch of suggestions and proposals to explain the different kinds of dimming. For those who are content with a Dyson sphere, here you go. The rest of us must live with the current explanations or wait for better ones.
-
Hi ! No problem, you can buy it online and directly download the pdf version and start right away: https://www.rheinwerk-verlag.de/c-von-a-bis-z_2132/ In contrary to my hint above it is C99, not C11. But that does not really matter right now. What is missing is high level stuff, oop things like function overloading for example. When you're that far that you think about methods in structs and function overloading you're probably a C++ candidate anyway :-). They also have an Arduino book https://www.rheinwerk-verlag.de/arduino_3797/ but i do not know it. It probably covers the library that comes with Arduino, like the functions to read interfaces and switch on and off lights etc. They are not basic C. Maybe somewhat superficial .... Looks like the next nights are planned, eh ? But C basics until Monday is sporty. Edit: and if you have questions concerning C we will help, i am sure. If your questions concern Arduino specific functions calls and things it may be a good idea to provide us with the function declarations.
-
One of the irregularly/aperiodically dimming stars.
-
totm nov 2023 SpaceX Discussion Thread
Green Baron replied to Skylon's topic in Science & Spaceflight
Oh ! Seems i confused flights. Thanks ! :-) -
totm nov 2023 SpaceX Discussion Thread
Green Baron replied to Skylon's topic in Science & Spaceflight
That signature is ... distracting when typing :-) ------------ Aluminum corrodes in seawater only when there is a current, but then aggressively. Aluminum is pretty far up in the galvanic row, zinc and magnesium are "better", that is why they are frequently used as sacrificial anodes. More resistant conducting materials otoh must be thoroughly isolated from the hull. Apart from galvanic corrosion, aluminum is a superb shipbuilding material because it passivates itself, other than steel which slowly rots away. A nicely built aluminum boat will last longer than a lifetime. It is the second best material for sturdy sailing boats on the ocean, after epoxy resin. Causes for electric currents on a ship are manifold of course, the source doesn't even have to be on the same ship, the neighbour berth in a harbour can be the culprit and source of a current in the basin, or loose cables on the seafloor. But if it corrodes around the engines like the link states then chances are that these have not been isolated properly from the hull and there is a constant current between the aluminum hull and the steel engines, making the hull loose mass. If i was the customer i'd know whom to blame :-/. The booster will probably just corrode chemically in the seawater. Especially filigree metal parts and ducts, screws and things are in danger of building up a rust layer, even from atmospheric dust particles, though two days are a short time. Most fibre plastics, if they aren't specially coated, are damaged if they have microscopic cracks where seawater can enter inside of the lamination. The booster lay several days in the water, so it is probably not suitable for a fourth flight any more. -
Arguably Scrub that. Yes, it is the best game ever.
-
It seems to me that the main problem here was a didactic one. Being thrown into char arrays and pointers before clearing the syntax and some basic stuff to build on causes frustration. A good book and some private studies can help out i think :-)
-
And Python is written in C :-) No problem, everything has its advantages and disadvantages ;-)
-
I tried to explain how stuff works because i find it important to look behind the scenes :-) In the end, you use strcmp() to compare two strings. That does the heavy lifting for you. C does not know strings as a data type. Only int or float. Chars are a special form of int, with the length of 1 byte. The header <string.h> contains functions to work on such arrays. That isn't really a disadvantage, it is efficient. In terms of speed it would not really matter. A computers heartbeat is billions/second and it uses pipelining, vectoring and parallelism. Whether you sort a 1 million elements long c array in a thousandth of a second or a hundredth isn't that important when waiting for user input. After all, chars are ints. :-)
-
The single quotation is for single chars only. A char is nothing but an integer data type, a byte in 2s complement, with a range of -128 to 127. The double quotation marks are for the initialization of char arrays only, or for constant char arrays (waiting here for correction because i have done only c++ lately and may have forgotten something about the c fundamentals). You can compare single chars just like other basic data types because they are int values. <, >, ==, != operators are the same as those for short, int, long int or long long int. But these operators do not work for arrays of chars in C. For these, you need routines that start at the first position (which is a char) and walk all the way along the array, take each single char (via either a pointer or the notation array[position]) and compare it with the char at the same position of the other array. So, if signal is a variable 3 char array, and "dot" (watch double quotations) is the constant array you want to compare it with, you set out on a loop and compare signal[0] with 'd', signal[1] with 'o', .... and so on. This is what the strstr() or strcmp() functions do (*). They work with pointers because pointers are extremely efficient to handle (pointer arithmetic), and once you've understood them you will do everything with pointers. You will use a pointer to go the toilet ! Understanding arrays in C and pointers is the basis, and probably the biggest step in programming you'll ever do. Apart from multithreading maybe, and template programming in C++. :-) (*) They might use much more efficient methods, like logic operations on the two memory regions, but that doesn't interest us here.
-
My bad. I always have -Wall (Warnings all) on when compiling, so the compiler helps me catch such mishaps. Then it does complain :-)
-
C arrays are no pointers, but they decay into pointers when passed as arguments. A slight but important difference :-), namely that from inside a function you can change data outside instead of working on a copy on the stack. Be that as it may, it looks good to me from afar, at least syntactically. I can't compile it because i have no arduino and lack the library. And you are correct, the compiler will complain that there is no return in a function that returns a value. Declare the function void or return a char. I understand that the main function is somewhere else.
-
Random Science Facts Thread!
Green Baron replied to Grand Ship Builder's topic in Science & Spaceflight
Predictions from general relativity again proven to be correct, this time with four times higher accuracy than before. https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.121.231102 Proven by repurposed satellites that were accidentally set out it a wrong orbit. Well then, so be it :-) -
lol :-) As a hobbyist i am faster with c than python, at least with problems like these. It is only the first steps that you are missing and that make you frustrated now: Expressions, control flow, variable scope, the call stack, the heap, pointers and memory allocation. Do not give up ! You can omit the memory stuff for your problem if you simply declare your char arrays long enough. This isn't production quality but at least lets you be successful until you're through with the chapter on the heap and what to do with it :-) C is punkrock !
-
Another thing that met my eye: if you work with arrays, you must also do the memory dance :-) Before you copy characters into the variable "Text" you must provide enough space in there via malloc(), and when you're done with it, you must free() it again. Be aware that you know about the stack and the heap and the scope of variables before doing so inside functions etc.
-
Oh it is ok to learn C from the start imo ! C is so beautifully straight forward ! And your problem perfectly fits into a basic course, maybe towards the middle. It is just, you need a good book. Are you German, as i understand from one of the variable names ? :-) Grab Jürgen Wolf: C von A bis Z, newest edition on C11. There is no better basic course, not even in English !
-
I am sorry, but you do not need an argument for a c function, but you do need a return type or void, that's what i wrote above. And C++ and C are very different. The problem in the marked line is that C cannot add strings (arrays before all) with the + operator and assign a string (a char array) with an = assignment. This should not even compile (*), or are you using C syntax and a C++ compiler ? Do not do that. It is a miracle to me that your teacher did not see that in a second ... (*)Another problem is that that you use char-syntax('') to define a string, that is a syntax error as well. In a switch statement you can only use an expression that evaluates to a simple datatype, if i am not lying. No arrays are allowed. That must be done with an array comparison, e.g. by strstr(). and your function must return a char as it is declared in the header. Solution: To concatenate and assign strings in C, include string.h and use the strcat() or strncat() (or strcat_s() or strncat_s()) function. If you're on a Linux OS you can get a full explanation by typing "man 3 strcat" in a terminal window. To assign strings you can use strcpy() or strncpy().
-
Debian Buster, Raspbian and Kali Linux.
-
I was just about to suggest a dictionary like data structure for looking up codes against characters but it might be a better idea to dive into a good c book to avoid frustration :-) Things are worse. C distinguishes between declarations and definitions and these concepts must be clear. A declaration for a function goes like returndatatype functionname( argumentlist ) where argumentlist is composed of datatypes and variable names, but can be omitted. The definition includes the body of the function. This concept is extremely important when it comes to more complex programs (header files, forward declarations, etc.) The same holds for variables, though "normally" a variable declaration comes along together with the definition, like int number = 0, if there are no important reasons to split declaration and definition. -------- So, you would have to say in your example: void Function( char argument ) { ... } in your case if your function has no return value. If your function returns something you must write the datatype of the return value instead of void.
-
Hi ! Yep, KSP runs smoothly on Linux :-)
-
Well, from time ti time we must take a breath and slap our backs in view of all the misery ... ... so we can carry on complaining, for example about the lazy cat coiled up on the keyboard.
-
Meanwhile in Russia: fighting climate change... with mammoths
Green Baron replied to DDE's topic in Science & Spaceflight
Ah, well, but that's not what i meant with the K. thing upthread. These mounds are made from the shells of molluscs, invertebrates, mussels and so, piled up over a long time from the people who lived there. With some flecked in stone and eventually bone tools and pottery. Anything organic is of course long gone ... Anyway, i strayed from the OP, over and again. Nice work for a psychologist ? I am crazy