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.
 
  • Locked thread
JawnV6
Jul 4, 2004

So hot ...
whoops

Adbot
ADBOT LOVES YOU

Bloody
Mar 3, 2013

nlog isnt logging anything

wtf nlog

Valeyard
Mar 30, 2012


Grimey Drawer
All I know about scala is typesafe activator or whatever

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

triple sulk posted:

dont use scala

Bloody
Mar 3, 2013

like i don't understand. it's configured to log, but its just not. i enabled exception-throwing and internal logging, and just... nothing. nada. no exceptions, no internal logging. just not doing anything. this isnt even the first time ive used nlog, its always just worked in the past. wtf nlog

MeruFM
Jul 27, 2010
years later you find a folder full of log files

Bloody
Mar 3, 2013

oh it was just not copying the config to the output so it had no config. lol wtf

Captain Foo
May 11, 2004

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

Bloody posted:

nlog isnt logging anything

wtf nlog

u need to add teh fiber module

TacoHavoc
Dec 31, 2007
It's taco-y and havoc-y...at the same time!
what's the thing where someone tries to solve a problem "a" using method "b" and is fixated on how to achieve b instead of a better method of solving a?

it's basically my life right now

JawnV6
Jul 4, 2004

So hot ...
XY problem

Clockwerk
Apr 6, 2005


TacoHavoc posted:

what's the thing where someone tries to solve a problem "a" using method "b" and is fixated on how to achieve b instead of a better method of solving a?

it's basically my life right now

product owner syndrome

Soricidus
Oct 21, 2010
freedom-hating statist shill

JawnV6 posted:

XY problem

misandrist

Bloody
Mar 3, 2013

I think I need an abstract class. I must have hosed up because I think I need an abstract class. gently caress

Jeffrey of YOSPOS
Dec 22, 2005

GET LOSE, YOU CAN'T COMPARE WITH MY POWERS
spoilers: it's an interface

Soricidus
Oct 21, 2010
freedom-hating statist shill
interfaces suck because they just declare names, whereas abstract classes let you reuse code!!!

Bloody
Mar 3, 2013

two classes that are identical in every way but one method

Clockwerk
Apr 6, 2005


It may be the right tool, but would probably still be better to invert and have your would-be sub classes consume an instance of your would-be abstract class

Bloody
Mar 3, 2013

Clockwerk posted:

It may be the right tool, but would probably still be better to invert and have your would-be sub classes consume an instance of your would-be abstract class

hmm yes agreed. they're already both mostly just wrapping a subclass, might as well push more poo poo down the pipe iykwim

Jeffrey of YOSPOS
Dec 22, 2005

GET LOSE, YOU CAN'T COMPARE WITH MY POWERS

Soricidus posted:

interfaces suck because they just declare names, whereas abstract classes let you reuse code!!!
yeah i mean like, the concept of an interface and presumed sane implementation, not the garbage java actually gives you!!! see also: haskell type classes

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
time for some terrible algorithms problem:

ok let's say I have a program with the purpose of sending random numbers to users every minute

the numbers can be 1-100, and we don't want an user to receive repeated numbers so a better idea is to shuffle a list [1, 2, ..., 100] for each user and send them, when it ends just cycle the same shuffled list.

but here's the catch: you can increase the number of possibilities in the middle of the process, from 1-100 to say 1-123

I don't want to reshuffle everything or risk getting a repeated number... but I also don't want to skewer the numbers by making 101-123 appear at the end of the first shuffle so...


the best solution that I could come up with is to establish an upper bound, say we'll never increase beyond 1000, and then shuffle the list from [1, 2, ..., 1000], and then before I send a number I just check if the number is less than the current highest possibility... but this still sounds like a bad solution and that I'm missing something super obvious here

I'm not used to shuffling poo poo ok

JewKiller 3000
Nov 28, 2006

by Lowtax

gonadic io posted:

If I had I would never have gone to therapy and that + the PhD would have probably literally killed me. So I'm pretty glad I left.

i'm not saying phd programs are the healthiest thing to be in, i left with a master's too. really i'm just wondering why someone who's interested in startups would want to work in finance, or why someone who wants to work in finance would ever join a startup

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Symbolic Butt posted:

time for some terrible algorithms problem:

ok let's say I have a program with the purpose of sending random numbers to users every minute

the numbers can be 1-100, and we don't want an user to receive repeated numbers so a better idea is to shuffle a list [1, 2, ..., 100] for each user and send them, when it ends just cycle the same shuffled list.

but here's the catch: you can increase the number of possibilities in the middle of the process, from 1-100 to say 1-123

I don't want to reshuffle everything or risk getting a repeated number... but I also don't want to skewer the numbers by making 101-123 appear at the end of the first shuffle so...


the best solution that I could come up with is to establish an upper bound, say we'll never increase beyond 1000, and then shuffle the list from [1, 2, ..., 1000], and then before I send a number I just check if the number is less than the current highest possibility... but this still sounds like a bad solution and that I'm missing something super obvious here

I'm not used to shuffling poo poo ok

is your list a linked list, an array, something else? Maybe shuffle your new subset that you're going to add, then insert them into the list at random intervals? That would be relatively efficient with a linked list, but a pain in the rear end with an array.

Clockwerk
Apr 6, 2005


here's another terrible way you could do it

give each user a list of numbers they have already received
give a random number from the currently defined range, if it hasn't already been given to the user, do so now and update the list
empty the list and start over if the list of used numbers is contained in the range, i guess, i dunno. this condition makes me want to not do a list and instead do a bool array of a given length so that you can check if it's been filled more quickly. it requires resizing each time their range changes, but that'll be faster than going through a list of ints

Clockwerk fucked around with this message at 21:43 on Jan 7, 2016

Soricidus
Oct 21, 2010
freedom-hating statist shill

Symbolic Butt posted:

we don't want an user to receive repeated numbers
[...]
when it ends just cycle the same shuffled list.

i take it you realise this is contradictory? things get simple if you can send repeated numbers but you just don't want them to be too close together, particularly if you can pick a fixed number for how close is "too close"

gonadic io
Feb 16, 2011

>>=

JewKiller 3000 posted:

i'm not saying phd programs are the healthiest thing to be in, i left with a master's too. really i'm just wondering why someone who's interested in startups would want to work in finance, or why someone who wants to work in finance would ever join a startup

i am not particularly interested in either
but i was looking to jump ship, the team (correctly) seemed competent, they were the first out of 5 interviews that offered, and they offered me £40k. seemed like a no brainer to me. and if the company doesn't make it then lots more doors are opened after that first job. also turns out that i like working here but that wasn't part of why i said yes obv

oh no blimp issue
Feb 23, 2011

i looked at some f# today and i like it

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY
e nm

coffeetable fucked around with this message at 23:04 on Jan 7, 2016

Clockwerk
Apr 6, 2005


what if the range is decreased?

Bloody
Mar 3, 2013

Symbolic Butt posted:

time for some terrible algorithms problem:

ok let's say I have a program with the purpose of sending random numbers to users every minute

the numbers can be 1-100, and we don't want an user to receive repeated numbers so a better idea is to shuffle a list [1, 2, ..., 100] for each user and send them, when it ends just cycle the same shuffled list.

but here's the catch: you can increase the number of possibilities in the middle of the process, from 1-100 to say 1-123

I don't want to reshuffle everything or risk getting a repeated number... but I also don't want to skewer the numbers by making 101-123 appear at the end of the first shuffle so...


the best solution that I could come up with is to establish an upper bound, say we'll never increase beyond 1000, and then shuffle the list from [1, 2, ..., 1000], and then before I send a number I just check if the number is less than the current highest possibility... but this still sounds like a bad solution and that I'm missing something super obvious here

I'm not used to shuffling poo poo ok

ah, the famous "shuffled playlist" problem. spotify still hasnt solved this

Bloody
Mar 3, 2013

code:
            var fresh = new List<int>{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
            var old = new List<int>();
            var value = fresh.SelectRandom(); // w/e
            fresh.Remove(value);
            old.Add(value);
            return value;
as things are added, add them to fresh. if fresh's capacity reaches zero, copy old to fresh and restart

Fergus Mac Roich
Nov 5, 2008

Soiled Meat
Terrible programmer here, part suggestion part question. The first solution that occurred to me was not shuffling the list, but rather randomly selecting an index i < n, swapping L[i] with L[n-1], and then popping the element. That way, the random order doesn't need to be determined in advance, and you can add more possibilities at any point in the process. Would that solve the problem?

Fergus Mac Roich fucked around with this message at 23:20 on Jan 7, 2016

Bloody
Mar 3, 2013

also an acceptable answer depending on how you add new elements

JawnV6
Jul 4, 2004

So hot ...
i didn't realize i had a song AND the mindless self indulgence cover of that song until whole-library-shuffle put them together

Jeffrey of YOSPOS
Dec 22, 2005

GET LOSE, YOU CAN'T COMPARE WITH MY POWERS

JewKiller 3000 posted:

i'm not saying phd programs are the healthiest thing to be in, i left with a master's too. really i'm just wondering why someone who's interested in startups would want to work in finance, or why someone who wants to work in finance would ever join a startup
They both have decent expected payouts, especially compared to large tech companies and graduate programs. Finance is a lot more consistent though - they give you cash instead of equity lottery tickets.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

i stalled on my nintendo project and played a bunch of doom instead and thought of something else to do. unfortunately i figured around the time i had to go to wikipedia to figure out what the gently caress a tangent is that i was never going to make this work on my own

so i have this guide http://www.permadi.com/tutorial/raycast/rayc7.html

which i am trying to convert to this CastRay function without success https://github.com/Luigi30/raycaster/blob/master/Raycaster/MainWindow.xaml.cs

i know this shouldn't be this hard but aaaaaaaaag i can't understand how these formulas work

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

JawnV6 posted:

i didn't realize i had a song AND the mindless self indulgence cover of that song until whole-library-shuffle put them together

lol, you listen to mindless self indulgence

Shaggar
Apr 26, 2006
abstract classes have valid uses when a rigid hierarchy makes sense

mekkanare
Sep 12, 2008
We have detected you are using ad blocking software.

Please add us to your whitelist to view this content.

Luigi Thirty posted:

i stalled on my nintendo project and played a bunch of doom instead and thought of something else to do. unfortunately i figured around the time i had to go to wikipedia to figure out what the gently caress a tangent is that i was never going to make this work on my own

so i have this guide http://www.permadi.com/tutorial/raycast/rayc7.html

which i am trying to convert to this CastRay function without success https://github.com/Luigi30/raycaster/blob/master/Raycaster/MainWindow.xaml.cs

i know this shouldn't be this hard but aaaaaaaaag i can't understand how these formulas work

In this article, the CastRay function is checking whether the shortest distance between the player and the wall is reached at the grid's X or Y first, and then rendering from there.
Then it uses the coordinates from the shortest distance ( X = 151, Y = 127 ) and converts it into the grid's location by taking the floor of X/64, and Y/64 resulting in (2, 1).
It checks for a wall there, but doesn't find one, so it extends the triangle by X + 36 units and Y + 64 units. It converts the new X, Y using the same formula as above, getting (2, 0).
It finds a wall for grid loc (2, 0) and returns the X,Y coordinates. It doesn't actually render the wall in this function from what I can tell.

I'm pretty sure the vertical part at the bottom is there because sometimes there will be a wall next to the player that won't be checked at certain viewing angles, so it could very well be an empty area until the camera pans enough for the CastRay function to tell that yes this player should see the wall on the screen and to render the correct side of the wall.
For example, if there was a wall at grid coordinate (2,2) if only the horizontal part is implemented, it will tell the render to draw the part of the wall at box C, while with the horizontal and vertical checks implemented, it will render the side at box B.

At least that's how it looks to me, I've never done this so I don't know if this helps.

mekkanare fucked around with this message at 02:54 on Jan 8, 2016

suffix
Jul 27, 2013

Wheeee!

Symbolic Butt posted:

time for some terrible algorithms problem:

ok let's say I have a program with the purpose of sending random numbers to users every minute

the numbers can be 1-100, and we don't want an user to receive repeated numbers so a better idea is to shuffle a list [1, 2, ..., 100] for each user and send them, when it ends just cycle the same shuffled list.

but here's the catch: you can increase the number of possibilities in the middle of the process, from 1-100 to say 1-123

I don't want to reshuffle everything or risk getting a repeated number... but I also don't want to skewer the numbers by making 101-123 appear at the end of the first shuffle so...


the best solution that I could come up with is to establish an upper bound, say we'll never increase beyond 1000, and then shuffle the list from [1, 2, ..., 1000], and then before I send a number I just check if the number is less than the current highest possibility... but this still sounds like a bad solution and that I'm missing something super obvious here

I'm not used to shuffling poo poo ok

to solve exactly as stated, i think you can just insert each new element a random place in the list, adjusting your current index as you go:
code:
def randomly_insert_elements_into_list(old_list, old_index, elements_to_add):
    new_list = old_list.copy()
    new_index = old_index
    for element in elements_to_add:
        insert_pos = random.randrange(0, len(new_list) + 1)
        new_list.insert(insert_pos, element)
        if insert_pos < new_index:
            new_index += 1
    return new_list, new_index
shuffling can be pretty counter-intuitive though and i'd want to test it empirically even if i'm 'sure' it works

Adbot
ADBOT LOVES YOU

craisins
May 17, 2004

A DRIIIIIIIIIIIIVE!

Sagacity posted:

Static site generators like Hugo and Jekyll are okay for that. Just let them generate your static site and host in on S3 for $0.05/month
jekyll's requirements are ruby, rubygems, node, and python. jesus christ.

  • Locked thread