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

Deathwing

<Bronze Donator>
16,717
7,731
Maybe he is asking why you need to return a pointer from a function instead of being able to return the array? I assume C has that limitation since C++ has it at least.
This is the link:

Difference between pointer and array in C? - GeeksforGeeks

It's phrased really poorly, like someone saw some shared characteristics between arrays and pointers, and there definitely are, but they had to shoehorn it into an "interview question".

You're mostly just complaining about Java having a ton of implementations of their basic Collection interfaces... Like mostly you'll just define your List as an ArrayList but sometimes you need something different. Granted Queues and Dequeues are different interfaces but they ascend to the same Queue interface. But it is nice knowing that you have a HashMap but sometimes you do actually need a sorted Map and Java already gives you a TreeMap for that occurrence. Just because Java gives you a ton of implementations doesn't make it bad it just gives you generic stuff (ArrayList, HashMap, LinkedList) but it can also give you more specific and granular implementations if required by your spec.

Vectors are thread-safe where ArrayLists are not thread-safe. Usually you don't want to pay that cost so you will use an ArrayList 999/1000 but sometimes Vectors fit their niche. Though since Java added the java.util.concurrent package in (I think?) 5 it is pretty much wholly deprecated.
I've gone from C++ to Java to C to Python, traversing my job history. I've found the simplicity of Python's implementation, even outside of containers, to be much more beneficial than knowing that one time it would be better to know to use a sorted Map or vector instead of ArrayList.

Not to say that making such choices don't have their place. I'm just saying I much prefer the type of programming I can do in Python due to that simplicity. Everything's a dict, I know how they function, no need to worry about details of the variations.
 

Tenks

Bronze Knight of the Realm
14,163
607
You can go through your Java career probably never defining a collection outside of ArrayList and HashMap. I can count the number of times I've used a Queue on one hand and the number of times I've used a Dequeue results in a NPE.

Groovy is still probably the best measuring stick to determine what Java developers do on a day-to-day basis since they've abstracted away a bunch of the boiler plate. They have only two what I consider "convenience" ways to collections and that is a List and a Map

The vast, vast majority of the time you'll just be defining an ArrayList or a HashMap. But it is nice to know if you have a niche use-case for something a bit more exotic like a Queue or a Stack or an ordered Map those exist within the JDK. I'm sure I'm not alone in pretty much never defining anything but those collections since the Groovy language is basically just adding convenience to Java and that is the only two collections they offer convenience.
 

a_skeleton_06

<Banned>
1,923
2,411
Need some advice here; I took a super boring corporate Sys Admin job that gives me about 7 hours a day with nothing to do. I'm still building my skill sets up, so I'm going to try and utilize this free time to take a UCLA extension course in either Cisco or Linux, since I'm pretty well set in Windows environment. I'll eventually do both but what do you guys think is the better course immediately? After this gig, I'm going to drop out of corporate life, it's too fucking boring and red-tapey. So I'm thinking the networking skills might go further in scaling back down into a smaller shop setting. Thoughts?
 

moontayle

Golden Squire
4,302
165
If you want to be a Linux SysAdmin choose the Linux training. If you want to be a network engineer then choose the Cisco training. If you're asking which has the higher ceiling, that one I can't answer really. Last two places I worked before this job paid well for both sides. At least, as far as a Systems job went.
 

Lendarios

Trump's Staff
<Gold Donor>
19,360
-17,424
In a small firm, prepare to do everything. From installing new PC to installing servers, setting up networks. etc.
 

a_skeleton_06

<Banned>
1,923
2,411
Yeah, that's what I'm used to. Both of my previous jobs were at small-mid size companies except in both places I was the Windows guy and my manager was the Linux and Layer2/3 dude. So I didn't really do a whole lot besides the occasional vlan move or nagios change, etc. I get the impression that boning up my networking skills first will provide the most immediate dividends when I go back to a company that size but who knows, my experience is pretty limited, I've only worked in 3 different places over the last 7 years.
 

Noodleface

A Mod Real Quick
38,244
15,029
Having two separate code bases but wanting the codes to operate identical is straight fucked up. I've never felt so overworked.

At least I released version 1.00 today.
 

Tuco

I got Tuco'd!
<Gold Donor>
46,816
78,437
I had to do that for a short period of time when porting a large codebase from java to c++. One critical thing I did was create a unit testing infrastructure in both that operated off of data files (json) to guarantee parity between the two codebases. Was a real pain and when I ditched the java side the unit testing had to be completely reworked to get rid of the laborious dependency on data files.
 

moontayle

Golden Squire
4,302
165
Kind of going through the same thing. Doing my refactor of production code in a new project but things keep coming up which requires adjustments of the production code. Then I have to make sure these fixes are part of the new project. And the more I delve into the production code the more things I find that need fixing but just haven't broken yet.

I finally have an alpha build running though, so here's to progress.
 

Tuco

I got Tuco'd!
<Gold Donor>
46,816
78,437
I have a memory leak problem in a C#/Unity application. FML.

I haven't looked into it at all but anytime I get a memory leak problem half the search results are C# fanatics arguing with everyone else about whether memory leaks are possible in C#.
 

Deathwing

<Bronze Donator>
16,717
7,731
I didn't think memory leaks were possible in a managed language. How did you determine you have a leak?
 

Tuco

I got Tuco'd!
<Gold Donor>
46,816
78,437
I didn't think memory leaks were possible in a managed language. How did you determine you have a leak?
I'm looking into it now, it'd be premature to call it a leak but I'm going to anyway. All I really know is that it's running out of memory.

The reason I'm so uppity is because anytime I have memory problems in C# it's a pain in my dick to get it to work the way I want it. I had a task a few years ago to load up a maximal amount of memory on a constrained system. I remember telling C#'s garbage collector what memory to deallocate was annoying.

Keep in mind I'm a C++ developer, so automatic garbage collection of memory allocated on the heap is witchcraft to me.
 

Tenks

Bronze Knight of the Realm
14,163
607
I'm not familiar with C#'s GC strategy but with Java generally when you slowly leak out memory it is because it can never properly destroy items of the "Eden" space (newly allocated) so they get shoved into the Survivor/Tensured pools which only get cleared out on full GC's which rarely happen. Usually I have to tweak some settings on the JVM to make it get rid of shit in the Eden properly.
 

Vinen

God is dead
2,789
495
Doesn't C# allow you to define sections as unmanaged?
Best you can do is mark code as unsafe which allows access to pointers.

For 99.99999999999999999999999999999999999999% of applications there is zero reason to use this functionality.

The case where I've used it is to interact with /shiver COM.
 

Lendarios

Trump's Staff
<Gold Donor>
19,360
-17,424
I'm looking into it now, it'd be premature to call it a leak but I'm going to anyway. All I really know is that it's running out of memory.

The reason I'm so uppity is because anytime I have memory problems in C# it's a pain in my dick to get it to work the way I want it. I had a task a few years ago to load up a maximal amount of memory on a constrained system. I remember telling C#'s garbage collector what memory to deallocate was annoying.

Keep in mind I'm a C++ developer, so automatic garbage collection of memory allocated on the heap is witchcraft to me.
you probably have a string or an object that need to be streamed, or buffered. for example, if you have a 100 MB string, .net will try to allocate a continuous memory chunk for it, and it will fail, causing your application to be out of memory.
Look into your string , arrays and file loading, make sure you use streams and check the size of the variables.

for example having a List<int> of 1,000,000 elements will never go out of memory, having a int[] of 1,000,000 might.
 

Tenks

Bronze Knight of the Realm
14,163
607
C# automatically spills collections over onto disk if they're going to OOM the container? Thats pretty nifty.