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
bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

cinci zoo sniper posted:

what is the term for general class of problems that involve optimising arrangements

e.g.

1 day ticket costs 3, 3 day ticket costs 5, and 5 day ticket costs 9

foo travels to bar city on days 1, 2, 5, 7, 9, 15, 16, 25

if foo travels on an even-numbered day, the tickets are discounted by 50%

help foo spend the least on tickets

constraint satisfaction problem or csp

theyre all reducible to sat then whack em into the sat solver. or mixed integer program solver

Adbot
ADBOT LOVES YOU

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
continuation style passing

Xarn
Jun 26, 2015

cinci zoo sniper posted:

what is the term for general class of problems that involve optimising arrangements

e.g.

1 day ticket costs 3, 3 day ticket costs 5, and 5 day ticket costs 9

foo travels to bar city on days 1, 2, 5, 7, 9, 15, 16, 25

if foo travels on an even-numbered day, the tickets are discounted by 50%

help foo spend the least on tickets

Do you mean combinatorial optimization?

cinci zoo sniper
Mar 15, 2013




bob dobbs is dead posted:

constraint satisfaction problem or csp

theyre all reducible to sat then whack em into the sat solver. or mixed integer program solver

cheers, ill take a look

cinci zoo sniper
Mar 15, 2013




Xarn posted:

Do you mean combinatorial optimization?

MrQueasy posted:

I think that's a variation on the Knapsack problem

these also are getting relevant hits, cheers

cinci zoo sniper
Mar 15, 2013




right so the problem that prompted me to ask that question is a bounded knapsack problem, meaning that i probably shouldn’t feel to bad about only partially solving it in 2 hours while being utterly oblivious to the concept

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
you always get the biggest goddamn weenies asking for dynamic program solns to csp or knapsack or subset sum poo poo

its just hosed cuz peeps do not ship those without serious thinking beforehands

Soricidus
Oct 21, 2010
freedom-hating statist shill

DELETE CASCADE posted:

continuation style passing

comma separated p-values

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

thanks for planning my vacation

cinci zoo sniper
Mar 15, 2013




Captain Foo posted:

thanks for planning my vacation

i knew you’d be hungover on day 12 anyways

hbag
Feb 13, 2021

been learning java and so far this just seems like python with more pointless poo poo
like, for example:
Java code:
double[] values = new double[ArrayLen];
why do i need to tell it TWICE that it's a double array

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
because its statically typed and they dont have hejlsberg or spj or like one of 10 other dudes so they cant implement the cool kids nice type system

hbag
Feb 13, 2021

Java code:
import java.util.ArrayList;

public class FishDemo {

	public static void main(String[] args) {
		
		// create fish
		Fish carp = new Fish("Common Carp",2);
		Fish sunfish = new Fish("Ocean Sunfish", 500);
		Fish bluefish = new Fish("Bluefish", 7.9);
		Fish pike = new Fish("Northern Pike", 1);

		// create pond
		ArrayList<Fish> pond = new ArrayList<Fish>();
		// populate pond
		pond.add(carp);
		pond.add(sunfish);
		pond.add(bluefish);
		pond.add(pike);
		
		System.out.println("Total weight: " + totalFishWeight(pond));
	}
	
	static double totalFishWeight( ArrayList<Fish> fish) {
		// calculate total weight
		double totalWeight = 0;
		
		for(int i=0;i<fish.size();i++) {
			totalWeight += fish.get(i).weight;
		}
		
		return totalWeight;
	}

}
fishies

cool av
Mar 2, 2013

lol if you trust the computer to get it the first time

Xarn
Jun 26, 2015

hbag posted:

been learning java and so far this just seems like python with more pointless poo poo
like, for example:
Java code:
double[] values = new double[ArrayLen];
why do i need to tell it TWICE that it's a double array

Because you are a dumbo who doesn't know about var

matti
Mar 31, 2019

think they are doing the right thing by not fronting to their professor

they do not care about the student's leet coding skillz

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


hbag posted:

Java code:
import java.util.ArrayList;

public class FishDemo {

	public static void main(String[] args) {
		
		// create fish
		Fish carp = new Fish("Common Carp",2);
		Fish sunfish = new Fish("Ocean Sunfish", 500);
		Fish bluefish = new Fish("Bluefish", 7.9);
		Fish pike = new Fish("Northern Pike", 1);

		// create pond
		ArrayList<Fish> pond = new ArrayList<Fish>();
		// populate pond
		pond.add(carp);
		pond.add(sunfish);
		pond.add(bluefish);
		pond.add(pike);
		
		System.out.println("Total weight: " + totalFishWeight(pond));
	}
	
	static double totalFishWeight( ArrayList<Fish> fish) {
		// calculate total weight
		double totalWeight = 0;
		
		for(int i=0;i<fish.size();i++) {
			totalWeight += fish.get(i).weight;
		}
		
		return totalWeight;
	}

}
fishies

send pike

pike sent

jesus WEP
Oct 17, 2004


Xarn posted:

Because you are a dumbo who doesn't know about var
given that it's a university course there's a deece chance they're stuck on some ancient version of java

hbag
Feb 13, 2021

jesus WEP posted:

given that it's a university course there's a deece chance they're stuck on some ancient version of java

we're on java SE-15

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


"to use the API to securely acces secrets in the store, you must first create an authorisation token for your session by creating a connection to the server with a username and password supplied as a string" lol what

Share Bear
Apr 27, 2004

the python formatter black defaults to wrapping at 88 characters for seemingly valid reasons but i cannot shake it being a dogwhistle of sorts

autopep8 does a worse job aesthetically imo

Share Bear
Apr 27, 2004

80 itself also being a cursed number cause

https://twitter.com/edent/status/1460332912079998982

Soricidus
Oct 21, 2010
freedom-hating statist shill

hbag posted:

we're on java SE-15

it has var then, that’s been there since 10

mystes
May 31, 2006

Powerful Two-Hander posted:

"to use the API to securely acces secrets in the store, you must first create an authorisation token for your session by creating a connection to the server with a username and password supplied as a string" lol what
I don't understand what the problem is here? Is it saying that the username and password are concatenated to a single string? Or you just don't like that they're being supplied as strings at all for some reason?

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


mystes posted:

I don't understand what the problem is here? Is it saying that the username and password are concatenated to a single string? Or you just don't like that they're being supplied as strings at all for some reason?

probably should have put some context. this was in the internal "solution to replace storing secrets in plaintext config" which pointed to using an API called from a library that has "step 1: login using secrets stored in config"

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Xarn posted:

Because you are a dumbo who doesn't know about var

also because you can do

Java code:
public class DogExtendsAnimal {
    public static class Animal{
    }
    
    public static class Dog extends Animal{
    }

    public static void main(String[] args) {
        Animal[] animals = new Dog[10];
    }
}

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
sorry for not using "class Butt", but i couldn't figure out a class hierarchy for it

CPColin
Sep 9, 2003

Big ol' smile.
Interface Joint, obviously.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
also note that instead of ArrayList<Fish> pond = new ArrayList<Fish>(); you can omit the type in the constructor call: ArrayList<Fish> pond = new ArrayList<>();

distortion park
Apr 25, 2011


Wheany posted:

also because you can do

Java code:
public class DogExtendsAnimal {
    public static class Animal{
    }
    
    public static class Dog extends Animal{
    }

    public static void main(String[] args) {
        Animal[] animals = new Dog[10];
    }
}

This is actually kinda hosed up because you might think you can put a cat into your animals array, but in this case you can't! A sad legacy of pre-generic times

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


*thinking extremely hard* what features to all animals have?



code:

public interface IAnimal
{
public Butt butt {get;}
}

done. everything else is an extension.

e: corrected linter errors because I literally cannot write code without intellisense to fix my fuckups

PIZZA.BAT
Nov 12, 2016


:cheers:


hbag posted:

been learning java and so far this just seems like python with more pointless poo poo
like, for example:
Java code:
double[] values = new double[ArrayLen];
why do i need to tell it TWICE that it's a double array

it allows you to cast objec-

Wheany posted:

also because you can do

Java code:
public class DogExtendsAnimal {
    public static class Animal{
    }
    
    public static class Dog extends Animal{
    }

    public static void main(String[] args) {
        Animal[] animals = new Dog[10];
    }
}

beaten

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


I need a good book on web API design but all my results are returning blogspam and REST 101. Anyone got any titles? tia

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Powerful Two-Hander posted:

*thinking extremely hard* what features to all animals have?



code:
public interface IAnimal
{
public Butt butt {get;}
}

:hmmyes:

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Armitag3 posted:

I need a good book on web API design but all my results are returning blogspam and REST 101. Anyone got any titles? tia

https://graphql.org

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.



A pox upon your loins

MrQueasy
Nov 15, 2005

Probiot-ICK
"Butt butt#get()" would be a good username if nonalphanumeric ascii was allowed.

The verbose-ness of Java's terrible broken type system is nowhere near as annoying as dealing with the lambda idiosyncracies. Being unable to throw non-runtime exceptions from most lambdas is really annoying when you run into it. It's worse when people are addicted to overusing Optional.

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

Powerful Two-Hander posted:

*thinking extremely hard* what features to all animals have?



code:
public interface IAnimal
{
public Butt butt {get;}
}
done. everything else is an extension.

https://en.wikipedia.org/wiki/Gastrovascular_cavity

Shaggar
Apr 26, 2006
i think you mean IButt Butt {get:} since butts may have multiple implementations

Adbot
ADBOT LOVES YOU

Shaggar
Apr 26, 2006
C# code:
public abstract class Orifice 
{
	public abstract bool AcceptsInput {get;}
	public abstract bool ProducesOutput {get;}
}

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