IT/Software career thread: Invert binary trees for dollars.

Noodleface

A Mod Real Quick
38,245
15,030
Random question for the engineers (electrical or computer) - is there much value going for the PE license? I've never been asked for it, and I think computer engineers generally don't get them, but is it a leg up having one? Is it even worth going for?
 

Noodleface

A Mod Real Quick
38,245
15,030
What kind of firmware?

At work we can pull some stuff, but it's pretty non-trivial and not reliable - and that's with knowing exact address ranges that images are flashed to.

Is it on a removable chip?
 

Noodleface

A Mod Real Quick
38,245
15,030
Sometimes there might be debug connectors and stuff.

Reverse engineering firmware would also be pretty intense, you'd be working in a hex editor on a bin/rom file
 

Tenks

Bronze Knight of the Realm
14,163
607
congratulations! If you ever wonder what this object oriented nonsense is about, here's what your project would look like with classes and structs and some STL objects.

This is literally the only time I've ever seen cin/cout inside of a class. That seems so incredibly counter to what OOP stands to gain. The addMember method should just take a Person instead of also being in charge of the creation of the Person object. Generally if you have to describe your class's methods as "It does this and this" it is a good indicator it probably shouldn't do one of the items that the and is joining. In this case the method is actually addAndCreateMember.
 

moontayle

Golden Squire
4,302
165
Today I discovered the primary library I'm using in my project uses Epoch time to do any time related tasks, like setting intervals for function runs. This is a problem because the devices we use will reset to 1-1-1970 any time there's a need for a reboot or if the device is powered down. We use some tricks to frequently store the current time in 10m intervals and that's used to backdoor a Linux command to reset the time to something more recent (fun fact: Google does not let you monkey with setting time outright so "su -c date -s [data]" it is). We also frequently get the current time from our servers and reset it on the device if it's drifted more than 60s in either direction.

Here's the thing. This library will set up my interval functions once the service starts, but that might occur before the time is set. At which point the first interval run is set to 1-1-1970 at 12:10am. If at any time after that is set, the time changes, say to right now (12-14-2015 at 9:00am), the next time the function runs it'll compare time, see the difference, go "OH SHIT" and start playing catch up. Android devices typically use RealtimeWakeup to avoid this issue.

Currently trying to line up the order of events so that things don't get so hairy. This is a known issue with the library and a fix has been proposed within a pull request but who knows when that'll make its way into the overall library. Good times.
 

Cad

scientia potentia est
<Bronze Donator>
25,343
48,531
Random question for the engineers (electrical or computer) - is there much value going for the PE license? I've never been asked for it, and I think computer engineers generally don't get them, but is it a leg up having one? Is it even worth going for?
I've never even heard of a CS/EE person having a PE. I think thats mostly for civil engineers that have to certify projects to the govt. I don't think there would be any value in you getting it.
 

Tuco

I got Tuco'd!
<Gold Donor>
46,831
78,476
This is literally the only time I've ever seen cin/cout inside of a class. That seems so incredibly counter to what OOP stands to gain. The addMember method should just take a Person instead of also being in charge of the creation of the Person object. Generally if you have to describe your class's methods as "It does this and this" it is a good indicator it probably shouldn't do one of the items that the and is joining. In this case the method is actually addAndCreateMember.
I agree. I kept the cins in the class to make it more obvious to a_skeleton_03. There's a handful of bad practices in the code there that I kept in for that reason.
 

Tenks

Bronze Knight of the Realm
14,163
607
I agree. I kept the cins in the class to make it more obvious to a_skeleton_03. There's a handful of bad practices in the code there that I kept in for that reason.
Alright. My concern was as a practice of "This is that OOP thing" the code really is just showing off classes and structs. But in reality OOP should be about code reuse. Like if he had a new requirement to input a planet (A,B,C) and they each had different aging speeds (1.0, 1.5, 2.0) the Family class would need to be updated to be aware of being on a different planet but in reality it should be the main method's charge (or possibly a Person implementation but lets not get all Enterprise FizzBuzz here) to handle knowing the user input they're on planet B and all ages need to be multiplied by 1.5.
 

Tuco

I got Tuco'd!
<Gold Donor>
46,831
78,476
Congrats, a_skeleton_03! Did you actually learn any algorithms in that class?
Alright. My concern was as a practice of "This is that OOP thing" the code really is just showing off classes and structs. But in reality OOP should be about code reuse. Like if he had a new requirement to input a planet (A,B,C) and they each had different aging speeds (1.0, 1.5, 2.0) the Family class would need to be updated to be aware of being on a different planet but in reality it should be the main method's charge (or possibly a Person implementation but lets not get all Enterprise FizzBuzz here) to handle knowing the user input they're on planet B and all ages need to be multiplied by 1.5.
a_skeleton_03, if you ever wonder what obfuscation due to premature design assumptions is, it's designing your system to handle families on multiple planets.


I actually thought about putting in a way to check which members were in a given state rather than just TX, but again I kept it just a few steps away from a_skeleton_03's example.
 

a_skeleton_03

<Banned>
29,948
29,763
Yeah I wanted to create a generic function that would check any state that I pass to it.

Did I learn any algorithms? No don't think so. I just learned how to talk a little bit in C++. Maybe that's the same thing?
 

Tuco

I got Tuco'd!
<Gold Donor>
46,831
78,476
No, not really. I mean, iterating over your family members and getting their average is an algorithm, just a really simplistic one.

The class still seems weird to me. C++ is a poor choice for introducing people to most algorithms because all the very important c/c++ details can trip them up. At least in their final implementation c/c++ is generally the most efficient language (computation time-wise). Most people in my field (robotics) use C/C++ for production code and matlab for prototyping.
 

Tenks

Bronze Knight of the Realm
14,163
607
a_skeleton_03, if you ever wonder what obfuscation due to premature design assumptions is, it's designing your system to handle families on multiple planets.
Don't be obtuse. Your example is a poor example of actual OOP principals. My example was just showing why your code would be poorly designed for real world implementation. If you wanted to say "This is how it would be easier and more realistic than using in-sync arrays" that is fine but you confused classes with OOP.
 

Deathwing

<Bronze Donator>
16,719
7,734
Why matlab for prototyping? Its syntax would make me want to skip prototyping altogether and go straight to C/C++.
 

Tuco

I got Tuco'd!
<Gold Donor>
46,831
78,476
Don't be obtuse. Your example is a poor example of actual OOP principals. My example was just showing why your code would be poorly designed for real world implementation. If you wanted to say "This is how it would be easier and more realistic than using in-sync arrays" that is fine but you confused classes with OOP.
Bro I gave you out when I said you were right. Then you step up and pick a software engineering fight. Get back to work and finish your unit tests!