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
triple sulk
Sep 17, 2014



Adbot
ADBOT LOVES YOU

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Bloody posted:

Didn't they ask you to email them the answer when you got home? What the gently caress is that. Maybe they don't know and are looking for help.

:shrug:

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

i think it was more just a casual joke like 'whatever obv we dont care hecan email the answer lol' and they dont really expect you to do it. but you probably should anyhow maybe

Bloody
Mar 3, 2013

Find the answer on stack sex change and email them the link

Valeyard
Mar 30, 2012


Grimey Drawer
a terrible programmer question, why does the regex,

code:
(-([a-zA-Z]+) )*
only match the latest (last) argument in a string like:

"-test -test1 -test2 test-3"

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Valeyard posted:

a terrible programmer question, why does the regex,

code:
(-([a-zA-Z]+) )*
only match the latest (last) argument in a string like:

"-test -test1 -test2 test-3"

pretty sure that regex over the given input matches the "-test -test1 -test2 " part. the capturing group inside the regex, of course, will be filled in with whatever the value was the last time it matched - i.e. "test2".

what you actually want to be doing is write a regex that matches a single parameter and match it against the string multiple times use a library to parse command-line arguments instead of rolling your own bespoke system that doesn't handle things the way everyone expects

Brain Candy
May 18, 2006

i'm trying to play around with redmine plugins and wtc

plugins are github repositories with no branches
everything is version 0.1
when you have incompatible dependencies using rake, are you really supposed to 'just comment some of them out'

if somebody knows something that is more jenkins speed (still fragile, but i install plugins by clicking on things) that would be super

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

Brave GNU World posted:

[0, 1, 10, ..., 19, 2, 20, ...]

we'll fix it in the point release

hobbesmaster
Jan 28, 2008

Brain Candy posted:

i'm trying to play around with redmine plugins and wtc

plugins are github repositories with no branches
everything is version 0.1
when you have incompatible dependencies using rake, are you really supposed to 'just comment some of them out'

if somebody knows something that is more jenkins speed (still fragile, but i install plugins by clicking on things) that would be super

this is why I always wonder why people like ruby on rails

Valeyard
Mar 30, 2012


Grimey Drawer

Jabor posted:

pretty sure that regex over the given input matches the "-test -test1 -test2 " part. the capturing group inside the regex, of course, will be filled in with whatever the value was the last time it matched - i.e. "test2".

ah, yes. for some reason i was expecting the group to be matched several times, but that makes sense

Jabor posted:

what you actually want to be doing is write a regex that matches a single parameter and match it against the string multiple times use a library to parse command-line arguments instead of rolling your own bespoke system that doesn't handle things the way everyone expects

i guess i could just split up the string at whitespace, check each token to see if it matches , and then join the non matches, cheers

triple sulk
Sep 17, 2014



hobbesmaster posted:

this is why I always wonder why people like ruby on rails

It's really been falling out of favor and will probably end up becoming the legacy poo poo no one wants to deal with when companies/clients are still somehow on rails 2/3

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i work at a place that has code dating back to rails 1.0. no one here is like, gently caress ruby, but every new major undertaking is a service of some kind and every one of those services is not in ruby or rails.

Notorious b.s.d.
Jan 25, 2003

by Reene

MALE SHOEGAZE posted:

i work at a place that has code dating back to rails 1.0. no one here is like, gently caress ruby, but every new major undertaking is a service of some kind and every one of those services is not in ruby or rails.

uhh yeah so that is a total "gently caress ruby" situation

they are so deep in "gently caress ruby" it doesn't even have to be spoken aloud. an infinite echo of "gently caress ruby" is the background radiation from the creation of the firm. "gently caress ruby" is the medium in which all other thoughts are expressed

in other words, you may be working with grownups.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
so ok say I have a really loving long array of things. now I want to print these things out once and only once, but I want to do it "randomly" , by which I mean I don't care if it's actually random but I want them to print out sort of evenly, not all in a row or clustered or whatever.

my current idea is to take a number relatively prime to the length and around 20% of the length and loop through the array using the prime index to increment the loop counter, wrapping on overflow of the array length.

this works fine in my simulations but I don't know how to prove it will eventually print every element exactly once.

any ideas?

this may be more of a bad mathematican thread idk. I am also open to other solutions.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

MALE SHOEGAZE posted:

i think it was more just a casual joke like 'whatever obv we dont care hecan email the answer lol' and they dont really expect you to do it. but you probably should anyhow maybe

i thought it was, until they said "email us the answer and we'll let you know what we decide", so I did, and they got back to me 10 minutes later

MeruFM
Jul 27, 2010

Valeyard posted:

ah, yes. for some reason i was expecting the group to be matched several times, but that makes sense


i guess i could just split up the string at whitespace, check each token to see if it matches , and then join the non matches, cheers

you really should just use a library
you're hurting your future self working on the same problem by saying you can do this because you've done it before

Brain Candy
May 18, 2006

rotor posted:

so ok say I have a really loving long array of things. now I want to print these things out once and only once, but I want to do it "randomly" , by which I mean I don't care if it's actually random but I want them to print out sort of evenly, not all in a row or clustered or whatever.

my current idea is to take a number relatively prime to the length and around 20% of the length and loop through the array using the prime index to increment the loop counter, wrapping on overflow of the array length.

this works fine in my simulations but I don't know how to prove it will eventually print every element exactly once.

any ideas?

this may be more of a bad mathematican thread idk. I am also open to other solutions.

shuffle things

use poisson distribution number of things for lines until you run out of things

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
the array is so long that sorting it will incur a significant performance penalty that I would rather not pay

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

rotor posted:

the array is so long that sorting it will incur a significant performance penalty that I would rather not pay

or shuffling it

MononcQc
May 29, 2007

Are we talking "won't fit in memory" long, or billions of elements long or smaller?

Menacer
Nov 25, 2000
Failed Sega Accessory Ahoy!

rotor posted:

so ok say I have a really loving long array of things. now I want to print these things out once and only once, but I want to do it "randomly" , by which I mean I don't care if it's actually random but I want them to print out sort of evenly, not all in a row or clustered or whatever.

my current idea is to take a number relatively prime to the length and around 20% of the length and loop through the array using the prime index to increment the loop counter, wrapping on overflow of the array length.

this works fine in my simulations but I don't know how to prove it will eventually print every element exactly once.

any ideas?

this may be more of a bad mathematican thread idk. I am also open to other solutions.
i may be wrong, but I believe this is a simple form of a linear congruential generator. With a==1, c=={your co-prime number}, and m=={your large array}. in this case, you meet the guarantee to have a maximum period (meaning you will generate all numbers between 0 through m-1 before repeating) so long as c is co-prime with m.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

rotor posted:

my current idea is to take a number relatively prime to the length and around 20% of the length and loop through the array using the prime index to increment the loop counter, wrapping on overflow of the array length.

this works fine in my simulations but I don't know how to prove it will eventually print every element exactly once.

it's fine. if you have p coprime n then i*p mod n for i in [0,n) will generate every value in [0,n) exactly once. this is because the finite groups <Z mod n, +> are cyclic with any integer p coprime n as a generator of that group, which should give you enough to google on if you want to see the actual proof

Brain Candy
May 18, 2006

rotor posted:

or shuffling it

Fisher-Yates is O(n) so

if you mean you want print while the thing is running, it has a bit where it exchanges stuff but instead you could print to whatever and increment a newline counter

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
not sure yet, so assume the former I guess

definitely some billions

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Menacer posted:

i may be wrong, but I believe this is a simple form of a linear congruential generator. With a==1, c=={your co-prime number}, and m=={your large array}. in this case, you meet the guarantee to have a maximum period (meaning you will generate all numbers between 0 through m-1 before repeating) so long as c is co-prime with m.


ShoulderDaemon posted:

it's fine. if you have p coprime n then i*p mod n for i in [0,n) will generate every value in [0,n) exactly once. this is because the finite groups <Z mod n, +> are cyclic with any integer p coprime n as a generator of that group, which should give you enough to google on if you want to see the actual proof

woot thx guys, my intuition said it was right but I couldn't find the way to a proof

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
also: menacer spotted

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
yeah i was thinking just fisher yates.

otherwise i think you need to know something about the ordering of the array.

Zaxxon
Feb 14, 2004

Wir Tanzen Mekanik

rotor posted:

so ok say I have a really loving long array of things. now I want to print these things out once and only once, but I want to do it "randomly" , by which I mean I don't care if it's actually random but I want them to print out sort of evenly, not all in a row or clustered or whatever.

my current idea is to take a number relatively prime to the length and around 20% of the length and loop through the array using the prime index to increment the loop counter, wrapping on overflow of the array length.

this works fine in my simulations but I don't know how to prove it will eventually print every element exactly once.

any ideas?

this may be more of a bad mathematican thread idk. I am also open to other solutions.

it will work, look up finite cyclic groups

gonadic io
Feb 16, 2011

>>=

Valeyard posted:

ah, yes. for some reason i was expecting the group to be matched several times, but that makes sense


i guess i could just split up the string at whitespace, check each token to see if it matches , and then join the non matches, cheers

Are you still using Haskell? For the love of god, don't use non-trivial regexes.

qntm
Jun 17, 2009

Joe Law posted:

my favorite dumb coding question that ive been asked is:

Given an array of size n containing integers 0 through (n - 1), sort the array in place in an efficient manner

like half my friends still cant answer it :(

this is more of a coding trick question than a coding question

brap
Aug 23, 2004

Grimey Drawer
is git only popular because it was written by ace programmer Linus torvalds

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
I think it's because of github

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

gonadic io posted:

Are you still using Haskell? For the love of god, don't use non-trivial regexes.

wait if you're using haskell and you want to roll your own thing like this why the heck aren't you using parsec instead of regexes

Space Whale
Nov 6, 2014
lmbo I got let go for being sick near christmas, so yay!

Apparently doing 2x my assigned tickets but not asking for more work fast enough looks bad. Also making someone with zero dev or management experience a PM and letting her make calls on effort is not a bad idea, nope.

I've never left a bad job so soon but I think they did me a favor at this point.

Edit: Yeah, after the initial shock and insult wore off, this is probably going to be worth it in the end. My god what a disaster.

Space Whale fucked around with this message at 15:31 on Dec 24, 2014

Space Whale
Nov 6, 2014

Joe Law posted:

my favorite dumb coding question that ive been asked is:

Given an array of size n containing integers 0 through (n - 1), sort the array in place in an efficient manner

like half my friends still cant answer it :(

for each datInt in array
{
array[datInt] = datInt; /// I'm lazy and running a fever so this might not work but just make a second array for 2n space complexity!
}

more like dICK
Feb 15, 2010

This is inevitable.

Space Whale posted:

lmbo I got let go for being sick near christmas, so yay!

Apparently doing 2x my assigned tickets but not asking for more work fast enough looks bad. Also making someone with zero dev or management experience a PM and letting her make calls on effort is not a bad idea, nope.

I've never left a bad job so soon but I think they did me a favor at this point.

Edit: Yeah, after the initial shock and insult wore off, this is probably going to be worth it in the end. My god what a disaster.

source your quotes

CPColin
Sep 9, 2003

Big ol' smile.

Bloody posted:

Find the answer on stack sex change and email them the link

One of my greatest failures as an Experts Exchange employee was when Stack Overflow came up with Stack Exchange and I was unable to convince the bosses to call a new product Expert Overflow to get revenge on them.

Bloody
Mar 3, 2013

I don't know the difference between snack overflow and stack sex change

Valeyard
Mar 30, 2012


Grimey Drawer

gonadic io posted:

Are you still using Haskell? For the love of god, don't use non-trivial regexes.

no no not haskell, this is a django web project so python. what i was trying to do is extend the command shortcuts used in search engines, its nothing critical

Adbot
ADBOT LOVES YOU

brap
Aug 23, 2004

Grimey Drawer

Bloody posted:

I don't know the difference between snack overflow and stack sex change

stack sex change is a collection of question-answer websites on a variety of subjects. snack overflow is the programming specific site.

  • Locked thread