-
Posts
3,340 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by razark
-
switch (in_char) { case 'A': send_dit(); send_dah(); send_space(); break; case 'B': send_dah(); send_dit(); send_dit(); send_dit(); send_space(); break; <and so on> } void send_dit() { <lamp on> <delay> <lamp off> <delay> } void send_dah() { <lamp on> <delay * 3> <lamp off> <delay> } void send_space() { <delay * 2> } Functional Readable Elegant Pick two out of three. (I should really go look up the code I used to do this. I'm going by rough memory and making it up as I go.)
-
Instead of translating the whole string, appending it, and then sending it, you're translating one character and sending it. You're still only dealing with dit, dah, or space. You can avoid messy string operations.
-
Thinking back, this is how I did it. Much simpler indeed.
-
When I took the class, we didn't use strings. They were just treated as an array of characters. That's stuck with me, and I keep forgetting string handling in C.
-
Don't forget you need to add spaces between the characters, or "Hello world" comes out as ".....-...-..--- .-----.-..-..-..", which is not readable. Nevermind, I notice you do have a space. Your program expects the function to return a single character. What you are returning, however, is a string. If I am recalling correctly, returning a string from a function is not a trivial exercise in C. You can pass the encoded string in by reference, and append to it in the function. Or declare it a global variable and append it in the function. You could also use a switch, instead of the ifs. int Encode(char in_char, char *buffer) { in_char = toupper(inchar); int flag = 0; switch (in_char) { case 'A': <append '.- ' to buffer> flag = 1; break; case 'B': <append '-... ' to buffer> flag = 1; break; case 'C': <append '-.-. ' to buffer> flag = 1; break; ... case 'Z': <append '--.. ' to buffer> flag = 1; } return flag; } But I don't remember the C syntax for doing the append, and my books are in a box somewhere. The flag allows you to check outside the function if it was able to get a valid match. If it did, it will return 1 (true), else 0 (false).
-
When a mommy kerbal and a daddy kerbal love each other very much, they make a function call to execute a block of code that creates a new kerbal instance, semi-randomly assigns it a name, gives it random stupidity and courage values, and randomly assigns it to be a pilot, scientist, engineer, or tourist.
- 46 replies
-
- 10
-
If you want to know how computers work, assembly is unmatched. It'll drive you insane, but you'll know exactly what's going on in the computer. If you want to learn how to program a computer, language isn't that big a deal. You can write a program in most languages. Some certain specific tasks might be easier or make more sense in one language than another, but it can be done in almost anything. Instead, the key is to learn how to look at a problem, break it down into steps, logically work through it, and compare different solutions. Once you understand why this sorting algorithm is better than that one, the syntax of implementing it is less important. Start learning how to do that, and then transfer your ideas into code, using whatever language you choose. If you want to get a marketable skill you can write on a resume, choice of language becomes more important.
-
I prefer C, and have used it quite often for personal projects. However, I find that more often I now turn to Python. I think @Kerbart above covered it pretty well. It really depends on what you want out of the experience.
-
Properly, a dash should be three times as long as a dot, the spacing between dots and dashes within a character should be the same as a dot, the space between characters should be as long as a dash, and spacing between words should be seven times the dot. Dot: 1 unit Dash: 3 units Intracharacter: 1 unit Intercharacter: 3 units Word break: 7 units For 5 words per minute, a dot is 0.24 seconds and a dash is 0.72 seconds.
-
Four minutes, three seconds from click to main menu.
-
Does it have to work with variable speeds, or can it receive at a set speed? The second is much simpler. That's more or less how I've done it, but it's been a long time since I wrote the code (modified from someone's morse reader I found online somewhere).
-
Apollo lunar missions? Yes. Skylab? Not quite as much. ISS, even less (and you can pay to get there as a tourist). I have heard rumors of some incidents. As I cannot speak to the veracity, I will not speculate further than pointing out that googling "nasa", "protocol", and "duct tape" brings up some interesting results.
-
People working in the space industry, any advice?
razark replied to Ultimate Steve's topic in The Lounge
I'm not in one of the exciting branches. I'm in the Information Resources Directorate (read that as IT department). But I've dealt with many different areas around the center, as well as the general culture. So, take that for what it's worth. Also, I'm slightly drunk and a bit cynical, so again, ttfwiw. My advice: -Work hard in school. The better you do, the better chance you'll have. This may seem obvious, but there will be times when you think "I can just skate through this, it's not that important." Keep your focus on your goal. -Look for opportunities. Internships are good. I've seen people that have done multiple ones. Not only does it give you a chance to apply your academic learning to real situations, it also exposes you to the real world in a way college NEVER will, as well as getting you familiar with the organization and culture. Further, it gives you a chance to meet people that might be useful later. That mentor? She could be in a position to recommend you for a job. That guy you met during the summer? He might get a job before you and remember you. Don't burn bridges, and that applies to professional and social interactions. -Be willing to go beyond your capabilities. Taking on a task that you can't do? Could be a good idea. Show a willingness to take on a challenge, as well as ask for help when you need it. But be careful of who belongs to the toes you step on. -BEWARE OF POLITICS! Don't get drawn into it. Stick your foot in the door, not your mouth. There's a lot a scrabbling for meager funds, and people can be territorial. -Be willing to change. The next few years of your life are going to be very eye-opening. You may be exposed to any number of ideas/fields/people that will completely change your outlook on life. As for your questions: - Do you enjoy what you do? Meh. I've seen it many times: No matter what it is, once you start doing it five out of seven days, it becomes a job. Sure, it might be better or more rewarding, but it becomes just what you do forty hours a week. The exciting parts and the bad parts fade into the "it's just another day" parts. - What do you do on a day to day basis, and how diverse is your job? On a good day, I solve problems. On bad days, I try to figure out how to get what needs to be done in the face of bad management decisions and vendor problems. On many days, I do other people's jobs or tell people that earn more money how to do their jobs. Most days are rather tedious repetition. - What would you recommend doing to get in to such a line of work? Depends on what you want to do. There people that fly on rockets, and there's people that empty wastebaskets. There's folks that figure out how to get people into space, there's people that figure out how to feed them, there's people that figure out what to do after they eat, and there's people that plant trees. Know what you want to do. If you have a specific goal in mind, work towards it. If it doesn't work out, there's a thousand other jobs that need done. And after all that, it comes down to chance. I apparently got my job because it came down to two candidates. Turns out my boss checked out a laptop for a trip, and my father's name was on the slip as having previously checked it out. -What do you wish you had done differently? Wow, that's a can of worms we really don't want to op... Oh, you mean professionally? Honestly, I don't know. I can't say what would specific events would have lead to something different. If we're going to examine that question, it would probably end up with me in a completely different field. - Is the work fulfilling? HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA!!!!!!!!!! *cough* I mean, umm... Yes. Yes it is. Honestly, some parts of it are, some parts of it aren't. On the whole, however, yes. I grew up in the area. Both my parents worked for the agency. All the neighbors on our block (except one family of college professors) worked for the agency. There was an astronaut that lived one block over. There's some feeling of being where I should be that comes with it, because that's what people do. (Those college professors? Their son works for the agency.) There's a comfort of knowing that I'm a small (tiny) cog in a machine that shaped defined my life. Individual results may vary. Plus you get to see a Saturn V pretty often. It may not be standing upright, but it's a real rocket, and man is it awesome to behold. -
I'm sure that I have no idea what you could be referring to.1 *whistles innocently* 1(I really have no clue what you mean by a long beta program, though...)
-
When you're stuck in a small area with a few folks for an extended time and completely cut off from anyone and anywhere else, being friendly with your crew can be very essential. It's not like one guy can step outside and take a walk for a few hours to cool off during a trans-lunar injection. Otherwise, NASA has to come up with rules on homicide in space, as well as protocol for dealing with the mess. Considering the low-residue food they used, I imagine Apollo capsules were not designed and equipped for an extreme excess of bodily fluids after the CMP perforates the the LMP with a lunar sample shovel.
-
I found two from my father. One from 1974 and one from 2014.
-
M.O.L.E. might be worth looking at.
-
Have you ever used a Launch escape system
razark replied to Kroslev Kerman's topic in KSP1 Discussion
Yeah, I know I recognize your name/avatar from there. I haven't been active on subsim for a while, though. -
Have you ever used a Launch escape system
razark replied to Kroslev Kerman's topic in KSP1 Discussion
Sounds familiar. -
I also tend to restart each version (or whenever I add a significant mod), and haven't spent much time at all beyond Kerbin SOI. My landers tend to be multistage. The first stage tends to be drop tanks, mounting legs, lights, and science bits enough for two or three biomes. I'll land, get all the science, reset what needs reset, hop to the next, etc. Once I'm done, the side tanks are jettisoned and the core performs the return trip. If I ever do any missions beyond Kerbin local, I'll probably re-evaluate my strategy.
-
Considering the history of Neil Armstrong's "incidents", I think we can come to one conclusion. On September 3, 1951: Making a low bombing run at 350 mph (560 km/h), Armstrong's F9F Panther was hit by anti-aircraft fire. While trying to regain control, he collided with a pole at a height of 20 feet (6 m), which sliced off 3 feet (1 m) of the Panther's right wing. Armstrong flew the plane back to friendly territory, but due to the loss of the aileron, ejection was his only safe option. He intended to eject over water and await rescue by Navy helicopters, but his parachute was blown back over land. A jeep driven by a roommate from flight school picked him up... On March 22, 1956, he was in a Boeing B-29 Superfortress, which was to air-drop a Douglas D-558-2 Skyrocket. As they climbed to 30,000 feet, the number-four engine stopped and the propeller began windmilling. The aircraft needed to hold an airspeed of 210 mph to launch its Skyrocket payload, and the B-29 could not land with the Skyrocket attached to its belly. At the instant of launch, the number four propeller disintegrated. Pieces of it damaged the number three engine and hit the number two engine. [The pilot] and Armstrong were forced to shut down the damaged number three engine, along with the number one engine, due to the torque it created. They made a slow, circling descent using only the number two engine, and landed safely. His first flight in a rocket-powered aircraft was on August 15, 1957, in the Bell X-1B, to an altitude of 11.4 miles. On landing, the poorly designed nose landing gear failed... Armstrong was involved in several incidents that went down in Edwards folklore or were chronicled in the memoirs of colleagues: During his sixth X-15 flight on April 20, 1962, he flew to a height of over 207,000 feet. He held up the aircraft nose for too long during its descent to demonstrate the MH-96's g-limiting performance, and the X-15 ballooned back up to around 140,000 feet. He flew past the landing field at Mach 3 at over 100,000 feet, and ended up 40 miles south of Edwards. After sufficient descent, he turned back toward the landing area, and landed, just missing Joshua trees at the south end. On April 24, 1962, Armstrong flew for the only time with Chuck Yeager. Their job, flying a T-33, was to evaluate Smith Ranch Dry Lake in Nevada for use as an emergency landing site for the X-15. In his autobiography, Yeager wrote that he knew the lake bed was unsuitable for landings after recent rains, but Armstrong insisted on flying out anyway. As they attempted a touch-and-go, the wheels became stuck and they had to wait for rescue. On May 21, 1962, Armstrong was involved in the "Nellis Affair". He was sent in an F-104 to inspect Delamar Dry Lake in southern Nevada, again for emergency landings. He misjudged his altitude, and did not realize that the landing gear had not fully extended. As he touched down, the landing gear began to retract; Armstrong applied full power to abort the landing, but the ventral fin and landing gear door struck the ground, damaging the radio and releasing hydraulic fluid. Without radio communication, Armstrong flew south to Nellis Air Force Base, past the control tower, and waggled his wings, the signal for a no-radio approach. The loss of hydraulic fluid caused the tailhook to release, and upon landing, he caught the arresting wire attached to an anchor chain, and dragged the chain along the runway. It took thirty minutes to clear the runway and rig another arresting cable. Armstrong telephoned Edwards and asked for someone to collect him. Milt Thompson was sent in an F-104B, the only two-seater available, but a plane Thompson had never flown. With great difficulty, Thompson made it to Nellis, where a strong crosswind caused a hard landing and the left main tire suffered a blowout. The runway was again closed to clear it, and Bill Dana was sent to Nellis in a T-33, but he almost landed long. The Nellis base operations office then decided that to avoid any further problems, it would be best to find the three NASA pilots ground transport back to Edwards. And at NASA: Gemini 8 launched on March 16, 1966, a rendezvous and docking with an unmanned Agena target vehicle. Out of contact with the ground, the docked spacecraft began to roll, and Armstrong attempted to correct this with the Orbit Attitude and Maneuvering System (OAMS) of the Gemini spacecraft. Following the earlier advice of Mission Control, they undocked, but found that the roll increased dramatically to the point where they were turning about once per second, indicating a problem with Gemini's attitude control. Armstrong engaged the Reentry Control System (RCS) and turned off the OAMS. On May 6, 1968, while Armstrong was piloting the Lunar Landing Research Vehicles (LLRV) 100 feet above the ground, hi's controls started to degrade and the LLRV began rolling. He ejected safely. Later analysis suggested that if he had ejected half a second later, his parachute would not have opened in time. His only injury was from biting his tongue. The LLRV was completely destroyed. July 20, 1969: Three minutes into the lunar descent burn, Armstrong noted that craters were passing about two seconds too early, which meant the LM Eagle would probably touch down several miles beyond the planned landing zone. As the Eagle's landing radar acquired the surface, several computer error alarms appeared. Even with their extensive training, neither Armstrong nor Aldrin was aware of what the 1202 and 1201 alarms meant. When Armstrong noticed they were heading toward a landing area which he believed was unsafe, he took over manual control of the LM, and attempted to find an area which seemed safer, taking longer than expected. Upon landing, Aldrin and Armstrong believed they had 40 seconds left on their fuel, including the 20 seconds' worth which had to be saved in the event of an abort. While preparing for the liftoff from the lunar surface, Armstrong and Aldrin discovered that, in their bulky spacesuits, they had broken the ignition switch for the ascent engine; using part of a pen, they pushed the circuit breaker in to activate the launch sequence. I mean, let's be honest here. What are the chances of all this happening to one single pilot? A pilot that went on to make the first landing on the moon? If you were to choose that man, would you pick someone who was involved in so many "accidents"? The obvious conclusion, therefore, is that Neil Armstrong was, without any doubt, using quicksave/reload!
- 29 replies
-
- 19
-
Armstrong had some dirt on Deke Slayton and threatened to turn it over to the Russians, along with proof that the Apollo Program was being faked in a remote area of the Florida Everglades, unless Slayton gave Armstrong the fame he deeply craved by making him the "first" man to "walk" on the "moon". It was basically blackmail that got him the command. Either that, or he was qualified and his crew came up at the right time in the rotation. Keep in mind, Apollo 11 was the first attempt to land on the moon, with no assurance that it would be successful. If they had to abort for any number of reasons, Pete Conrad would have been the first.
-
Yup. This is a pretty bad rap.
-
totm aug 2023 What funny/interesting thing happened in your life today?
razark replied to Ultimate Steve's topic in The Lounge
So, you're telling me that the most evil villain of my childhood, the scourge of the galaxy, the destroyer of worlds, right-hand man to the Emperor, destroyer of the Jedi did it because... he was angsty over his girlfriend? -
Have you ever used a Launch escape system
razark replied to Kroslev Kerman's topic in KSP1 Discussion
If I am recalling correctly, you've played Silent Hunter 3 or 4. Imagine spending the time to maneuver into a perfect attack position on a convoy, only to have a kid walk up, shout "Fire!", and ruin the whole attack.