Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Ihmemies
Oct 6, 2012

So I was studying CS in university in 2005-2012. Mainly I played wow and got nothing school related done after 2006. Well I studied to be an x-ray tech/nurse and now after 6 years of 1-1,5h one way commute (total 2-3h) I am ready to try CS again.

I am not very good at setting goals and studying completely independently, so that's why I'd like to go back to university and earn a degree for myself. I could then meet companies and people while studying and maybe get a job easier that way.

Are there any real risks with computer touching these days? I want a job with as short commute as possible, better salary and benefits. Healthy work/life balance and a career as far away from the healthcare hellscape.

X-rays are cool but I can't get a job with reasonable commute. I can work with software from my home so optimally my commute would be a few meters at maximum in future.

If AI takes over all the programming jobs I can go back to x-rays, or if the situation is dire, work at elderly care.

Adbot
ADBOT LOVES YOU

Ihmemies
Oct 6, 2012

The college time was completely wasted.

Anyways. I can go back and get a Master of Science from computer science, starting this fall. Like this but in another city: https://www.helsinki.fi/en/degree-programmes/computer-science-masters-programme I also need the lower degree of that but anyways Master's would be my goal.

University is free here so I just need to apply for it.

With a degree it may or may not be easier to get work. I don't really work because of the money, but because I need some structure in my life so I don't succumb to WoW again.

I fear basic python skills won't cut it when doom progresses in the world, but maybe more advanced skills will be in demand. I know I am late to this and HR will go like "wait your'e 40 years old with 0 years of experience?!?" but I very much hate my commute.

I also think x-ray tech job is extremely boring and repetitive in the long run and there are really no new challenging things to learn at my current work. So my current job is a dead end.

Ihmemies fucked around with this message at 05:14 on Jun 22, 2022

Ihmemies
Oct 6, 2012

I am super stuck. I think I'm supposed to figure out which string is missing a character other two strings have.

Ie. in {'bcdefg', 'abdefg', 'acdefg'} abdefg doesn't have c. How I can figure out from that set that the correct choice is abdefg? :v:

I have been at this for 2 days and my brains just don't work. Normally I just compare 1vs1 but ugh this

Ihmemies fucked around with this message at 23:50 on Nov 11, 2022

Ihmemies
Oct 6, 2012

Jabor posted:

acdefg is missing a b, which is present in the other two strings. Likewise, bcdefg is missing an a. Is there a more precise specification for what you're being asked to do?

Well it's AoC 2021 day 8 b. It has a 7-segment display: https://en.wikipedia.org/wiki/Seven-segment_display https://adventofcode.com/2021/day/8

So 0, 6 and 9 share the same amount of on states. I'm supposed to figure out how to differentiate 0 6 and 9 from each other. I managed to do it for 2/3/5 I think.

0 is missing a character which both 6 and 9 have. Six is missing one chracter which is in one. Nine is then left...

Ihmemies fucked around with this message at 23:58 on Nov 11, 2022

Ihmemies
Oct 6, 2012

Jabor posted:

You can just start with what you already know, instead of trying to figure it out just by looking at that 0-6-9 set.

Why not start with figuring out which one is 6, instead of trying to figure out 0 first?

My solution is not exactly great, so it's not easy to tell 0 and 9 from each other then. Maybe I should have kept book about which letter means which segment :v:

Ihmemies
Oct 6, 2012

Yes. I guess it is easier when you told me I can compare it to other numbers. Finally. What a piece of utter garbage my solution is. Luckily I don't need to submit the code anywhere, only the result. Well I'll submit the code here anyways so you can laugh at me: https://pastebin.com/2zd6vQSM

Thanks for the help!

Even with the uh.. spaghetti... runtime is "only" 3313.92020ms with 1000 iterations.

Ihmemies
Oct 6, 2012

drat. I thought chatgpt was a one trick pony, until I asked some coding questions. What's wrong with this code? How would you refactor this? Can you explain to me, what happens in this code?

It doesn't hit the goal always, but it's quite helpful. It gives me ideas which I didn't think about, and tells me about things I didn't know even existed.

Like, I have this piece and I'd like to shorten it somehow. How?
Python code:
if self.is_index_valid(self.__data[y], x+1):
	sur.append(self.__data[y][x+1])

if self.is_index_valid(self.__data[y], x-1):
	sur.append(self.__data[y][x-1])            

if self.is_index_valid(self.__data, y+1):
	sur.append(self.__data[y+1][x])

if self.is_index_valid(self.__data, y-1):
	sur.append(self.__data[y-1][x])
Chatgpt suggests using a list of tuples to replace those complicated ifs:

Python code:
for i, j in [(0,1), (0,-1), (1,0), (-1,0)]:
	if self.is_index_valid(self.__data, y+i) and self.is_index_valid(self.__data[y+i], x+j):                   
		sur.append(self.__data[y+i][x+j])
Or can you explain this code to me which friend gave to me (without an explanation):

code:
index_valid = lambda list, index: -1 < index < len(list)

Ihmemies
Oct 6, 2012

Is there some way to override semantic token styles with textmate scopes in vscode? Currently semantic tokens override textmate scopes. In case of rust, the granularity of semantic tokens is very boulder-sized, while textmate scopes provide pebble-sized granularity.

For example let and mut are both "keyword.other.rust" in semantic tokens, but "storage.modifier.mut.rust" and "storage.type.rust" in textmate scopes. Because the boulder-sized granularity of semantic token overrides the more granular themes, both end up looking the same:

This is very annoying.



I could disable semantic highlighting, but then I lose underlined variables etc. 2nd example: functions are ALSO "keyword.other.rust", while textmate has them as "keyword.other.fn.rust". Why the semantic highlighting definitions are pure garbage in rust?

Ihmemies fucked around with this message at 16:45 on Nov 30, 2023

Ihmemies
Oct 6, 2012

I am quite stuck. I have a collection of 20 000 numbers, they can be anything from 1 to 1000 000 000. I also have a bunch of other numbers and for each of them I need to find and "remove" the closest matching number from the list.

I can use binary search to find such numbers, but I really have no idea how to avoid using the same number twice and be fast enough. If the numbers were unique, I could just use a set. If I use a vector, vector.remove(index) is painfully slow.

Like where to even begin? What kind of data structure would even work, so I could efficiently search for closest matches and remove them or mark them as used..

Ihmemies
Oct 6, 2012

robostac posted:

If you are using c++ (guessing based on set / vector.remove) there is a multiset structure that is probably exactly what you want ( an ordered set that allows multiple of the same values).

Another option as it sounds like set was viable without duplicates is too add tuples of (value, index) to the set as that will make all the inputs unique and you can find the closest before and after (searchvalue, 0) and ignore the index part.

I was trying rust. Thanks for all the answers! Rust has only a set, no multiset, so set must contain only unique values. I ended up trying vecdeque, which seems to have quite fast removals. Figuring out how to create a binary tree out of the inputted data was a bit too complex today.

Anyways, I have a "funny" test case, where there are 200000 tickets and 200000 bids. Problem is, that 199999 tickets are price 1 and one ticket is price 2, and all bids are 1.

That means 199999 customers get a ticket, one customer doesn't get a ticket, and my binary search is way too slow because of the data is NEARLY identical. With random data it works quite fast, but the amount of binary search iterations is O(n) with that specific nearly homogenous test data.

Adbot
ADBOT LOVES YOU

Ihmemies
Oct 6, 2012

A very bad solution was to check if the number at binary search's result index is the same as the number in first index. Then pop one index from front.

Apparently with nearly homogenous numbers, the indexes tend to set to the middle, so all removals are super slow. With random numbers the removals spread out more evenly, and are thus faster on average.

Don't do what I did, but at least it works with these specific test cases.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply