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
boofhead
Feb 18, 2021

Khorne posted:

Is there really a maximum weight? If not, the answer is far simpler.

If you're writing backend code it's not necessarily a web app environment.

They've talked about scaling the data but have they talked about who'd be making the requests, how varied the inputs are to the request, and how many users would be making the request? Have they mentioned performance expectations, too? Is the problem space constrained in some way, like does the user only have 20 potential items out of the entire dataset that you need to optimize for?

There is a maximum weight, and it depends on the user input. They specifically say "web application" in the code challenge. As far as I can tell, it's a form of multiple-choice knapsack problem - I might be wrong, but I really don't want to share too much information because I don't want to cheat and I know that if I share too much, people might start giving hints, which I'm not looking for.. I just want to calm down that imposter syndrome rush of "oh gently caress I don't know this level of maths"

e:

quote:

edit: You replied before I did. From that description, are players "active" for someone to pick from or do they have access to the entire dataset? Can players already be taken by other people or are you allowed to draft from the entire pool? etcetc

full data set, so ~20k, then hypothetically scaling by an extra 5-20m each month after that. I'm seeing it as giving someone an impossible problem and seeing how they think on their feet.. which is kind of a dick move for a junior dev position, but it means that I either nail this, or I dodge a bullet, as mentioned

But please don't give me more tips on how to approach it! I appreciate the thought, but I want to see how I handle it, just me and.. stack overflow. I just have never had a code challenge before so I didn't know what to expect

boofhead fucked around with this message at 18:53 on Apr 8, 2021

Adbot
ADBOT LOVES YOU

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

boofhead posted:

The phrasing is literally:


In bold, too. I have some ideas for how I could approach a "best guess" kind of solution and then hopefully compare to pre-generated lists at certain budgets to see how far off I am, but let's see how much time I have (or how long it'll take to generate those lists)

Thank you for your feedback, I was going a little crazy. I don't want any help with approaching the problem but it was nice to get confirmation that I'm not the world's dumbest dumb dumb. I'm definitely going to point to the NP-Completeness thing in my response, no way I'm copping a "aw, you didn't manage it? sorry, we're kinda looking for Rainman" for a junior dev role

Well if the goal is to select a team of 11, this problem might be more constrained than the general knapsack problem. Are there any other constraints?

Edit: I see you don't want help with the actual answer. But just keep in mind that when problems are constrained, they might not be as difficult. It may not be NP complete, depending on the specifics

HappyHippo fucked around with this message at 18:54 on Apr 8, 2021

boofhead
Feb 18, 2021

HappyHippo posted:

Well if the goal is to select a team of 11, this problem might be more constrained than the general knapsack problem. Are there any other constraints?

Edit: I see you don't want help with the actual answer. But just keep in mind that when problems are constrained, they might not be as difficult. It may not be NP complete, depending on the specifics

That's a fair point. I'm going to sleep on it and come back to it, it could be that the constraints reduce it to a more reasonable quantity, although I still don't see how it could scale to +5-20 million per month with any of the standard knapsack solutions. But I recognise that I'm probably being pretty annoying with not feeling comfortable sharing too many specifics, so I'll sit on it for a while. Thank you for your replies

e: vv will do-- I'm hoping I'll see something new after I sleep on it (and work on other stuff) for a bit

boofhead fucked around with this message at 19:19 on Apr 8, 2021

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


After you've submitted your answer, post the full problem here and we'll dissect it.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
Does the test say anything about preprocessing?

Casey Finnigan
Apr 30, 2009

Dumb ✔
So goddamn crazy ✔
e: this was a question about an issue with hackerrank, but it looks like it was on their end and it's resolved now. sorry for wasting the space :tipshat:

Casey Finnigan fucked around with this message at 01:02 on Apr 10, 2021

Skyarb
Sep 20, 2018

MMMPH MMMPPHH MPPPH GLUCK GLUCK OH SORRY I DIDNT SEE YOU THERE I WAS JUST CHOKING DOWN THIS BATTLEFIELD COCK DID YOU KNOW BATTLEFIELD IS THE BEST VIDEO GAME EVER NOW IF YOULL EXCUSE ME ILL GO BACK TO THIS BATTLECOCK
I have been programming on macbooks for years professionally. I love the unix style terminal and environment. I want to do some work on my windows PC but I want to emulate a mac environment somehow. Its doesn't need to be crazy like a dual boot or VM but I was wondering if there is a way I can emulate a terminal shell, instead of the garbage powershell that windows uses. I just want to be able to easily run things like node, npm, etc from my machine.

JawnV6
Jul 4, 2004

So hot ...

Skyarb posted:

I have been programming on macbooks for years professionally. I love the unix style terminal and environment. I want to do some work on my windows PC but I want to emulate a mac environment somehow. Its doesn't need to be crazy like a dual boot or VM but I was wondering if there is a way I can emulate a terminal shell, instead of the garbage powershell that windows uses. I just want to be able to easily run things like node, npm, etc from my machine.

Check out WSL - Windows Subsystem for Linux. Gives you a bash shell. It's better integrated than you'd think, perhaps not where you'd want.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Skyarb posted:

I have been programming on macbooks for years professionally. I love the unix style terminal and environment. I want to do some work on my windows PC but I want to emulate a mac environment somehow. Its doesn't need to be crazy like a dual boot or VM but I was wondering if there is a way I can emulate a terminal shell, instead of the garbage powershell that windows uses. I just want to be able to easily run things like node, npm, etc from my machine.

Windows subsystem Linux or whatever that thing is called

bigperm
Jul 10, 2001
some obscure reference
When you install git on windows, it installs git bash, but it isn't integrated like WSL.

Joke answer - eshell is built into emacs.

yippee cahier
Mar 28, 2005

Install Windows Terminal too, integrates with WSL’s bash and a regular command prompt. I do embedded Linux dev on an Ubuntu VM under WSL, using VcXsrv when I use a GUI tool. IDEs like vscode can also run natively on Windows and your project, toolchain, etc. live in the VM. You even get a network share that’s your VM’s filesystem, good enough for editing and copying files.

MrMoo
Sep 14, 2000

Cygwin is also still a thing, I’m not sure how much runs under MinGW any more.

I prefer encapsulating stuff away from Windows so that the whole thing doesn’t die together, ie just ssh from CMD, powershell, PuTTY into a VM.

Rabbit Hill
Mar 11, 2009

God knows what lives in me in place of me.
Grimey Drawer
I have a question about MS Access 2016 query design. Basically, I have two spreadsheets and I'm trying to find matches between them with a "text contains" (rather than the default "text equals") join. Here are screenshots --

Table 1 --


Table 2 --


I want to run a query to find matches between these tables using the ISBN numbers of books as the common variable, because I need to create a report that appends info from Table 2 onto Table 1. But as you can see, the "ISBNs" column in Table 1 sometimes contains multiple numbers, while the "ISBN" column in Table 2 contains only one number.

Here is my preliminary query design in two views:

Design view --


SQL view (sorry for the tiny text)--


How do I look for only partial matches between the "ISBNs" in Table 1 with the "ISBN" in Table 2?

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
There is a dedicated SQL thread somewhere in this forum. They probably won't even yell at you for using Access (much).

Googling suggests you should be able to use InStr, as in, INNER JOIN ... ON InStr(haystack, needle) > 0

Rabbit Hill
Mar 11, 2009

God knows what lives in me in place of me.
Grimey Drawer
OK, will repost there, thanks!

Hughmoris
Apr 21, 2007
Let's go to the abyss!
I've been trying to teach myself the basics of git and contributing to open source. I found some typos in a popular repo, submitted my first PR, and they merged it. I'm now listed as a contributer. :3:

I'm assuming I can put this on my resume now?

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

Hughmoris posted:

I've been trying to teach myself the basics of git and contributing to open source. I found some typos in a popular repo, submitted my first PR, and they merged it. I'm now listed as a contributer. :3:

I'm assuming I can put this on my resume now?

Feel no shame; the other applicants certainly won’t.

DoctorTristan fucked around with this message at 19:27 on Apr 14, 2021

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Hughmoris posted:

I've been trying to teach myself the basics of git and contributing to open source. I found some typos in a popular repo, submitted my first PR, and they merged it. I'm now listed as a contributer. :3:

I'm assuming I can put this on my resume now?

Hell yeah! I'm not shy about telling people my name's in the HTML spec because I pointed out an obvious error that wouldn't confuse anybody reading it. Projects should be generous with acknowledgment, and you should accept that acknowledgment wholeheartedly.

bigperm
Jul 10, 2001
some obscure reference
A very elaborate modded minecraft thing I was trying to do wasn't working, so I hunted around in the code and found that a number was 10x less than it should be. I added a zero and that got me into the Artic Code Vault.

spiritual bypass
Feb 19, 2008

Grimey Drawer

Hughmoris posted:

I've been trying to teach myself the basics of git and contributing to open source. I found some typos in a popular repo, submitted my first PR, and they merged it. I'm now listed as a contributer. :3:

I'm assuming I can put this on my resume now?

Hell yeah, this is how I became a contributor to VS Code

csammis
Aug 26, 2003

Mental Institution
I* was on the ISO C++ committee :smug:


* My company was, confusingly and briefly and for no evident reason, and they sent me and one other employee to a committee meeting in Seattle. Then we hosted another committee meeting for which I was one of the people organizing.

Cuntpunch
Oct 3, 2003

A monkey in a long line of kings

Hughmoris posted:

I've been trying to teach myself the basics of git and contributing to open source.
Step 1: Use open source libraries. You're probably already doing that.
Step 2: Realize there's a bug or unexpected behavior.
Step 3: File an issue report.
Step 4: Realize that we're all developers, code is code, and in most cases we can fix issues ourselves for magic internet street cred. Open a PR with a fix.
Step 5: Wait 6 months before realizing you've submitted a PR to a dormant repo.

DoctorTristan posted:

Feel no shame; the other applicants certainly won’t.

This, a thousand times this. Most people, if they've ever so much as watched a "Hello world in {someLang}" video on Youtube will list it as experience and leave it to the interviewers to drill down into figuring out the level of that experience. You don't have to go that far (please don't), but if a cursory glance at your github shows lots of contributions, most of the time that's good enough, and folks aren't going to CSI `git blame` to figure out the level of those contributions.

Hughmoris
Apr 21, 2007
Let's go to the abyss!
Thanks for the "contributing to open source" thoughts and stories. I'll admit, I am finding it fun being listed as a contributer to some popular repos by adding minor but meaningful changes to their
documentation. I'm not a good enough coder to iterate on the actual code but I can grammar check documents with the best of them.

My work (clinical informatics) is not very code-centric but this will be a fun talking point in future interviews.

*I might hide some of these relevant buzzwords in my LinkedIn profile to see if I get more attention from recruiters.

CarForumPoster
Jun 26, 2013

⚡POWER⚡

Hughmoris posted:

I've been trying to teach myself the basics of git and contributing to open source. I found some typos in a popular repo, submitted my first PR, and they merged it. I'm now listed as a contributer. :3:

I'm assuming I can put this on my resume now?

Yes but don’t overstate your contribution and be very upfront and clear if asked. If someone asks you what it is answer clearly and specifically that you fixed typos.
I had a candidate who changed some print statements around when I looked at his contribs. When I asked him to describe the contributions he made, knowing they were totally insignificant to the function of those repos, he tried to dodge it. When he wouldn’t answer clearly I moved on but it was a major reason for not proceeding to next steps as his answer struck me as dishonest. If he’d been totally upfront him having made those minor contribs would’ve been a feather in his cap.

Hughmoris
Apr 21, 2007
Let's go to the abyss!
Has anyone worked with Office Scripts yet? It appears to be Microsoft's future replacement for VBA. It's basically javascript scripting for the web-based versions of their Office products.

I really wish they would have used Python, since I don't know JS. I imagine the overlap between Python & Excel users is higher than Javascript & Excel. Also, the IDE they provide feels like it's 80 characters wide and you can't adjust it.

boofhead
Feb 18, 2021

ultrafilter posted:

After you've submitted your answer, post the full problem here and we'll dissect it.

For those who forgot, I'm the one asking about the multiple container knapsack problem code challenge.

So I sent in the code challenge last Thursday, presented it on Monday, they seemed pretty happy with it and just had a final call an hour ago where they offered me the position as junior fullstack developer. Which I'm really happy about, I was hoping my product manager and customer service experience would tip the scales (which definitely did help) but they were apparently more than happy with my code and general knowledge for its own sake. So I'm really happy about that.

The challenge was:

Given a dataset of 18k football players with various fields, build a website with a search tool to list them according to the search term (name/club/nationality), which is easy enough, and then create a "team builder" function which takes a budget from the user and finds the optimal team for that. (The additional questions were how I would then scale that to 5-20m+ players added every month). The criteria were:

From that dataset, take the player overall score and their cost, and build the best possible team (based on score), making sure you fill: 1 goalkeeper, 2 fullbacks, 3 halfbacks, and 5 forwards. Each player has only one position they can play for, so Messi can only be a forward, he can't be a goalkeeper.

I looked into various knapsack solutions, dynamic programming and linear programming and so forth, which was beyond me, and so my approach was just:

Build a team with empty players, then fill it with the cheapest players for each postion so that you always have, at minimum, a functioning team. Then iterate through the player set, ordered by ascending cost, and for each player, compare that player to the lowest scoring player for that position currently within the team, and replace them with the new player if:

- still within overall team budget
- new player has a higher score

It's not ideal, I'd love to learn about better approaches (because that doesn't seem absolutely "optimal" according to proper MCKP theory), but for the code challenge for a junior position they seemed pretty happy with my approach and code.

smackfu
Jun 7, 2004

Congrats on the offer!

Generally the problem isn’t coming up with a decent real world algorithm, the problem is coming up with an algorithm that is provably correct and can’t be abused by a particular dataset.

KillHour
Oct 28, 2007


Isn't that a hard (in the mathematical sense) problem anyways? You'll always end up with an approximation and in the real world, you're probably using whatever tools your database works best with to get there.

SurgicalOntologist
Jun 17, 2004

I've built several optimizers for fantasy sports lineups, that can be done as an integer optimization problem. Here's an example using the library PuLP (which has a lovely API based on adding tuples to the problem object but works well enough).

Python code:
# Create variables (players is a DataFrame)
players['lpvar'] = players.name.apply(pulp.LpVariable, args=(0, 1, pulp.LpInteger))

# Problem and objective function
problem = pulp.LpProblem('lineup', pulp.LpMaximize)
problem += players.lpvar @ players.points, 'max_points'

# Constraints
problem += players.lpvar.sum() == 6, 'n_players'
problem += players.lpvar @ players.salary <= 50000, 'max_salary'
problem += players.lpvar @ players.salary >= 45000, 'min_salary'

# Solve and output
problem.solve(pulp.GLPK())
print(players[players.lpvar.apply(methodcaller('value')) == 1])
Adding additional constraints based on positions is usually straightforward. I'm assuming they gave you some attribute to maximize?

Anyways they probably weren't looking for this and hell if I know how it works under the hood or how to optimize. Your approach is certainly more useful for understanding your skill level than "I know a library that does that!". Anyways, congrats on the offer!

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

That's a phenomenal response for someone going for a junior position, I can see why the code aspect was most impressive up them. Congratulations!

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


smackfu posted:

Generally the problem isn’t coming up with a decent real world algorithm, the problem is coming up with an algorithm that is provably correct and can’t be abused by a particular dataset.

The big issue with our current approach to complexity theory is that it only looks at how hard the hardest instances of a problem are. Those instances may not be at all representative of how hard the problem is when you're not dealing with adversarial input. There's a big research project in theoretical computer science right now trying to figure out how to characterize problems in some way that's more reflective of how hard they are in practice. There's a very recent book on the topic if anyone's really interested in the technical details, and even if you're not it might be worth reading the first chapter.

KillHour posted:

Isn't that a hard (in the mathematical sense) problem anyways? You'll always end up with an approximation and in the real world, you're probably using whatever tools your database works best with to get there.

It has an obvious formulation as an instance of the knapsack problem, but it's possible that there's something special about this specific variation that makes some kind of trick possible. I don't see it based on the description, but that doesn't mean it doesn't exist.

KillHour
Oct 28, 2007


ultrafilter posted:

It has an obvious formulation as an instance of the knapsack problem, but it's possible that there's something special about this specific variation that makes some kind of trick possible. I don't see it based on the description, but that doesn't mean it doesn't exist.

I guess my point was more that 99% of companies aren't going to need to write their own solution to the problem because they're going to use an off the shelf one and the 1% left are the ones writing their off the shelf solutions to sell to other companies. Those kinds of "solve this mathematically interesting but ultimately pointless algorithm" questions always bothered me for that reason.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
I would really struggle with that problem because of all the unanswerable sports-management questions about player evaluation and the best way to build a soccer team. Anyway, I assume the setup lets you make simplifying assumptions.

Your algorithm will probably usually reach a higher overall score if you consider players in order of decreasing score per unit cost.

smackfu
Jun 7, 2004

It’s a nice problem because it’s fairly easy to score solutions. So you could try multiple algorithms and see which performs best.

Empress Brosephine
Mar 31, 2012

by Jeffrey of YOSPOS
Is there a way to export all classes in a html document in VS Code? Anyone know?

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Empress Brosephine posted:

Is there a way to export all classes in a html document in VS Code? Anyone know?

How repeatable and robust do you need it to be? Is it a one-off task for a specific page, or does it have to work on arbitrary pages?

Empress Brosephine
Mar 31, 2012

by Jeffrey of YOSPOS
just a one off since I write all my css directly into the wordpress customizer and i'm lazy and don't want to keep alt tabbing back and forth lol

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
In that case, I'd do it using a regular expression. something like

code:
<[A-Za-z0-9]+[^>]*class=("(?P<class_list>[^"]+)"|'(?P<class_list>[^']+)')[^>]*>
untested, probably broken

I'd probably do it in Python. make a list of all the class_list groups, split by space, dump it in a text file or to the command-line or w/e. Use notepad++ to sort them and eliminate duplicates. All of that is a matter of preference though

xtal
Jan 9, 2011

by Fluffdaddy
What are you trying to do? That doesn't seem like something you should need to do.

Edit: removed my answer once I noticed you said vs code

Adbot
ADBOT LOVES YOU

Empress Brosephine
Mar 31, 2012

by Jeffrey of YOSPOS
ooo that's a good idea using Python to do it. Thanks!

Maybe I should learn one day what language VS extensiosn are programmed in and just make one for myself...all it needs to do is scan the .html for "class=" or "Class=" or whatever typing of it and then dump what follows until the next line break!

Thanks!

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