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

Cad

scientia potentia est
<Bronze Donator>
24,498
45,439
It appears I was incorrect and String doesn't implement clone
I could have sworn when doing some Swing apps for my internship I ran into some weirdness where changing the string in one spot changed it in the other as well but I can't seem to reproduce it in any fashion
Could have been Stringbuffer or some other extension of String. Stringbuffer acts a lot more like a Collection in the reference and = weirdness.
 

Tenks

Bronze Knight of the Realm
14,163
606
Possibly. But I haven't used StringBuffer ever since they compiler makes String concatenation basically StringBuffer under the seams. Maybe I did something where catting strings together and confused the compiler, dunno. I remember the bug driving me mad though and eventually I had to just do new String(otherString) when assigning it to make the thing work.
 

Cad

scientia potentia est
<Bronze Donator>
24,498
45,439
Possibly. But I haven't used StringBuffer ever since they compiler makes String concatenation basically StringBuffer under the seams. Maybe I did something where catting strings together and confused the compiler, dunno. I remember the bug driving me mad though and eventually I had to just do new String(otherString) when assigning it to make the thing work.
Well strings are immutable so you always have to make a new one if you want to change the value.

So like String s = "a"; String y = "b";

You then can never change the value of s. It's a constant.
 

Tuco

I got Tuco'd!
<Gold Donor>
45,486
73,570
How does java handle not having to copy very large strings frequently? Or is it just bad practice to have very large strings being handled directly?
 

Deathwing

<Bronze Donator>
16,429
7,440
C has a history of buffer overruns and standard library functions determining string size incorrectly, that sort of stuff. I can see immutable strings as a reaction to that.
 

Tuco

I got Tuco'd!
<Gold Donor>
45,486
73,570
I've spent much of my day fucking around with c strings so I can understand why they wanted to do something better.
 

Tripamang

Naxxramas 1.0 Raider
5,223
31,849
I don't know exactly how java does it but in C++ copying classes with arrays/strings/pointers is a careful process, especially when that pointer is to another fully formed class with its own pointers. Sometimes being forced to make a copy constructor at a high-level class requires making a copy constructor for a handful of child classes.
Maybe we're using different functionality in C++ but the code below does a deep object copy replicating the vectors (but only copying the pointer location, not it's value). I was kind of curious what kind of vectors etc you were using that you had to create a copy constructor. It's really rare that I ever have to make a copy constructor.

 

Tuco

I got Tuco'd!
<Gold Donor>
45,486
73,570
Aren't vectors nice?

Like you say, the default copy constructor for ParentCopyTest only copies the pointer location, so if you did something like this:
The result would be:
If you wanted to do a deep copy of pData for whatever reason you'd need to use a copy constructor or something else. Likely having a void * as a class member would make someone be very careful about copying the class.

If you didn't use a vector and instead used:
You'd need a copy constructor for CopyTestArray.

ex:
results in:
One[0]:[3]
Two[0]:[3]
One[0]:[5]
Two[0]:[5]

But if you used a statically sized array ex:
You'd get the same behavior as the vectors in this case:
One[0]:[3]
Two[0]:[3]
One[0]:[5]
Two[0]:[3]
 
349
1
Everything made a lot more sense once my books came in. I went ahead and dropped discrete math so I could concentrate on the other 3 classes more. Not that it was hard it was just the least interesting to me. So far my OOP and datastructure classes have been going smooth. Assembly is a pain in the ass though. Not that it is difficult but writing nested if statements inside nested if statements inside nested if states... ect ect is just frustrating. I am having to comment the hell out of my code just so I don't get lost.

The current assignment is to take 3 inputs from a user, their gender, age, and body fat%. So obviously there are 2 genders. There are 3 age categories and each age categorey has a low, normal, high, and very high body% category. Depending on which category they fall under, different LEDs have to light up on our Arduino board. To make things more lame the male and females low, normal, high, and very high categories have different values. So basically my code is a ton of this shit.

cdi r20, 22
brsh nextCategory
//if they are below 22 then excute this else jump to nextCategory
// code
// more code

nextCategory:
//compare again with the next category
cdi r20, 33
brsh anotherFookinCategory
// if they are below 33 then excute this

Anyways you get the point. but having to branch for genders, different age groups, then diff categorys lol. Anyways I finished and I am sure there is an easier way to do it but we were only allowed to use the BRSH command. I think in the end, I had over 30 of these damn blocks. I am definately gaining a greater appreciation for high level languages!

I also went to a job fair the other day and talked to various computer science recruiters. One thing that really peaked my interested was network security and various cyber security jobs. There is an Army base I was actually stationed at a long ass time ago near my house. They do PenTesting there and counter hacking (I forget the word they used for it.) I asked for some advice and they told me a few things which I wanted to share and maybe gets some input.

Learn Kali Linux and its capabilities
specifically metasploit
get securty + and ethical hacker certs
and learn to do pentesting
without actually saying it specifically, it's almost like they were hinting for me to learn to find exploits and vulnerabilities in various systems.

I am using OpenSuSe atm because that is the OS we use at school. I will probably mess around with Kali this weekend. I guess I could setup an old PC and mess around with it using the the various tools he mentioned. I am also looking at ordering a security + book or something to start studying but the CompTIA website recommends you get your A+ cert first so it's something I'll consider. My biggest concern is doing something illegal accidently. At what point is something illegal such as pentesting. I mean if you find a vulnurability but not use it, are you actually breaking the law? Is it like picking a lock but not opening it or is all this shit straight up illegal on a foreign system.

Any thoughts? Sorry for the TLDR i just had a lot to say
smile.png
Also if any of you are pentesters or something similiar I'd love to hear what you actually think about the job.
 

Noodleface

A Mod Real Quick
37,961
14,508
There was a guy recently that posted something on reddit. He worked for some security place and found a hole in one of the colleges system. He did some pentesting and found he could get in and access a lot of private data. He emailed the school detailing the vulnerability and how to fix it; next thing he knew the FBI was raiding his house.
 

Voyce

Shit Lord Supreme
<Donor>
7,186
23,507
All I have to say about Kolibri is that it messed with my ROM and I had to reset my CMOS to get my NIC working in Windows again after live booting.

If anyone has any questions about coding in COBOL or JCL, or working in the Mainframe environment, I am your guy.
 

Tuco

I got Tuco'd!
<Gold Donor>
45,486
73,570
I've got nothing to add on security. I find security and trying to exploit security generally uninteresting though it is of course extremely challenging. Good luck with assembly, lol. It's nice to spend a semester doing to understand how low level instructions work and to get an appreciation for higher level languages, but IMO that experience is overrated.
 

Tuco

I got Tuco'd!
<Gold Donor>
45,486
73,570
Unless you use assembly at work! Like me
frown.png
Yeah but do you feel like your embedded programming / assembly /microprocessor class in college laid out the ground work for your professional ability at assembly? Or did it just make some terms familiar and you had to relearn everything when you got the job?
 

Noodleface

A Mod Real Quick
37,961
14,508
Yeah I don't even remember anything we learned in school with assembly. A lot of it is bullshit like flashing LEDs in succession so fast that they all appear lit up at once - I won't ever use that. Mostly it gave me a good understanding of what all the functions do.
 

Tenks

Bronze Knight of the Realm
14,163
606
I learned 99% of what I do at my job at my internship I had in college compared to the course work
 

Noodleface

A Mod Real Quick
37,961
14,508
I'm not a good judge because I'm the one dude that spends all day writing C and assembly, just like I learned in college.
 

Tenks

Bronze Knight of the Realm
14,163
606
Yeah I'm a Java developer using 3rd party frameworks left and right trying to write as little code as humanly possible to achieve the objective. They didn't teach me anything about Maven, Spring, JUnit, Maven Plug-Ins, Hadoop, NoSQL/HBase or really anything useful. Even the classwork on OOP/D was so trivial that trying to apply it to real world enterprise software is worthless. Turns out I've never written a Triangle class that implements the Shape interface at work. They also don't tell you unless you're writing an API the vast majority of your inheritance model will be Has-A not Is-A and even then you generally write stuff and extend abstract classes not actually make rigid interfaces for your internal OO design.
 

Noodleface

A Mod Real Quick
37,961
14,508
Jeez, I thought only my school taught OOP with that stupid shape interface.

Although, our major project that semester was writing a text-based game that was "infinitely" (Infinite as far as the upper bounds were of whatever data type) expandable. It was actually a really cool project. Used inheritance to make rooms, objects, items, players, etc.