« first day (1868 days earlier)      last day (2978 days later) » 

4:00 PM
Since the probability of success is not influenced by the number of times you've tried a task, this is a "memoryless" scenario.
 
correct
except that I can't try a given task more than once
 
Okay, that might change it...
 
I'm looking for success on any one of the tasks
not every task
 
Since the order in which you should attempt the tasks does not depend on which tasks you've already tried, there's probably a "straightforward" recursive algorithm to solve this.
 
I can just sort by T/P
which I know works for everything besides the last task
 
4:05 PM
@PhiNotPi Also true
 
for example if T1 = [10, 1/2] and T2 = [5, 1/5], then Expected(T1) = 20, and Expected(T2) = 25
 
So anyway what do you guys think? Will this design work?
 
@SuperJedi224 For what?
 
if I run T1 first, then the actual expected runtime is 1/2*10 + 1/2*(10+5)
 
I'm not sure if I understand what the use of Expected(T1) is, given that you can only run the task once.
 
4:07 PM
well, a task is "better" if it has a better expected runtime
 
@zyabin101theHated I'm trying to decide how to decorate my house in the survival series I've been working on
 
Um... I'm pretty sure I need this problem re-explained to me.
 
I know I can't run it multiple times, but each minute I spend running it is more valuable than a minute running any other task
You have a list of tasks, and you only need 1 of them to succeed
each task has a fixed runtime, and a probability of succeeding
you need to order the tasks such that the expected success time is as small as possible
 
Dev: Logging into the page is taking hours upon days of my time.
Me: Okay. You wanna nuke the Login page?
Dev: No, I just want to be able to debug without logging in.
Me: Okay. You know how to hard code a string?
Dev: I don't want to do that.
 
@SuperJedi224 spider-proof that
 
4:10 PM
I offered to help the guy set up a script that will log him in automatically. He's not interested in that either lol.
 
@PhiNotPi do you understand?
 
I think so.
 
Anonymous
So you have a sequence of unrelated bernoulli trials that take X time to complete (where X is a variable depending on the task)
 
Anonymous
And you want to order them so that you get a success as fast as possible
 
4:11 PM
correct
therefore, you should order them by runtime/success_rate
 
Maybe... the way to look at it is "combining" two tasks into a larger task.
 
Anonymous
Consider this scenario: [[1s, .5], [1s, .5], [2s, .7]]
 
Anonymous
It takes the same amount of time to run the first 2 tasks as it does the third task
 
Anonymous
But running the first two tasks gives you a higher chance of success
 
2/.7 is appx 2.85, which 1/.5 is appx 2
therefore, sorting by runtime/success_rate works
 
Anonymous
4:14 PM
Yep
 
(fallacious proof, but I'm still pretty positive its true)
 
Me: Okay. You know how to write a config file parser?
Dev: Corn, corn, corn, cooorn...
Me: Wat. *leaves*
 
Anonymous
It works for that case
 
Anonymous
It also works for [[1s, .5], [1s, .5], [2s, .8]], where you would want to run the third task first
 
Anonymous
I'm sure there's a counterexample, but I can't come up with one
 
Anonymous
4:16 PM
Oh yeah the sure-thing one
 
you want to order each second such that the value of the second is as high as possible
 
You have t1, t2, p1, p2, then these two tasks "combine" to form p3 = p1 - p1*p2 + p2, t3 = ((1+p1)*t1 + t2)/(1+p1)
 
Anonymous
[[1s, .5], [1s, .5], [2s, 1]]
 
Anonymous
They all have the same T/P (2)
 
Anonymous
But you would want to do the third task first, because it's a sure thing
 
Anonymous
4:17 PM
So you should use probability as a tiebreaker
 
oooh, I didn't think about 1
that's an outlier
even if it was 2s, .9999999, you should still run it last
 
Anonymous
Also [[1s, .6], [1s, .6], [2s, 1]] gives you the wrong order
 
Anonymous
Though actually it may not be incorrect per se to try the shorter ones first
 
absolutely, the 1 breaks things
 
Anonymous
40% of the time, running one of the 1s ones before the 2s one will result in it taking longer than it needs to
 
4:20 PM
well, what's the expected time of [[1s, .5], [1s, .5], [2s, 1]] (in that order)?
 
Anonymous
I think maybe ordering it by T/(1-P) descending would give you better results
 
.5 + 2*.25 + 4*.25
 
Anonymous
@NathanMerrill It'd be 50% 1s, 25% 2s, 25% 4s
 
its exactly 2
interesting, so 1 isn't an outlier
ok, next up: [[1s, .6], [1s, .6], [2s, 1]]
.6 + 2*.4*.6 + .4*.4*2
which is 1.4
 
Anonymous
In that order you'd have a mean of 2 seconds, but if you ran the sure thing first, you'd have constant 2 seconds
 
4:22 PM
therefore, my sorting algorithm still works
 
0
A: Sandbox for Proposed Challenges

mbomb007Prove That a Number is Algebraic Inspired by this answer. Please read it. Given a real, algebraic constant x, convert the number to zero by using the following operations: Add or Subtract an integer. Multiply or Divide by a non-zero integer. Multiply by the original constant x. Input is a s...

 
Anonymous
Which depending on your goals, might be better
 
I'm pretty positive that sorting by t/p is what I want
 
Anonymous
It really depends on if you're ok with having an X% chance of doing better than the sure-thing, with the caveat that there's a chance you'll do considerably worse
 
yes, I want to minimize the expected runtime at the cost of worst runtime
now then, what if the last task I run always has a probability of 1?
does that change the order?
 
Anonymous
4:25 PM
For example, with [[1s, .6], [1s, .6], [2s, 1]], you have a 16% chance of doing worse than the guaranteed time
 
Anonymous
@NathanMerrill No; that just guarantees that you will eventually be successful
 
Anonymous
(assuming that you have already sorted it and the sorting places the sure thing last)
 
Anonymous
In fact it doesn't even have to be last; an ordering with a sure-thing in the middle is functionally identical to the same ordering, minus all the tasks that come after the sure-thing
 
Anonymous
Because you will never attempt the tasks after the sure-thing
 
Anonymous
So [..., [X, 1], ...] is equivalent to [..., [X, 1]]
 
4:27 PM
right, but we're changing the probability based on its position
for example, lets say I made the first task always have a probability of 1
I should place the task with the least amount of time
regardless of what its t/p value is
 
Anonymous
You should order the tasks to minimize expected value (so ascending by T/P)
 
correct
 
Anonymous
And you can disregard any tasks in a sorted list that come after a probability-1 task, since they will never be attempted
 
Anonymous
In the case of a tie, I'm not sure whether you should choose lower time or higher probability
 
but I'm changing probabilities
say I order by t/p
I'm not caring about ties
lets say [10, .5] and [5, .2]
(which is, incidentally, in the right order)
now, I change the last probability to [5,1]
is it still in the correct order?
(in this case, it is, but I can't prove that it always is)
 
Anonymous
4:33 PM
I'm an idiot; disregard
 
Anonymous
They aren't still in the correct order with the changed probability
 
Anonymous
10/.5 = 20, 5/1 = 5
 
well, if I move the [5,.2] to the first position, then it loses the 1 probability
 
Anonymous
Ohhh I see now
 
so my options are either [10,.5] and [5,1] or [5,.2] and [10,1]
 
4:36 PM
If T is the total time of the current list, E(T) is expected time, and P is the current probability of success, and tx, px are the time and probability of a single task x, then what happens when we append x onto the list? T_new is T+tx, P_new is P + px - Ppx*, and E(T)_new is (P*E(X) + (1-P)*(T+tx)).
 
Anonymous
You'd be seeking an ordering that minimizes sum[i=1,n] { t_i*(prod[j=1,i-1] { 1 - p_j })}
 
Anonymous
Looks like linear programming is the answer here
 
Anonymous
Better question: Why haven't you sandboxed this yet?
 
because I'm debugging some code and I can't figure out why its failing a test
I'm not the creator of the problem
@PhiNotPi that seems correct, as long as you are always appending
 
So... the task that we put last always has a success rate of 1, but swapping its place with some other task causes it to have its original probability, with the new last task having 100% success?
 
4:45 PM
correct
 
Then that doesn't affect the correct ordering at all.
The success/failure rate of the last task does not influence the expected runtime at all.
 
Heyho
 
hi
 
does anyone know how to tripple indent lists here on SE?
those bulletpoint lists
 
1
Q: Add the "Days Visited" metric to SEDE

DowngoatI was writing a query on SEDE, when I noticed there was no "Days Visited" value. I have circled the user metrics, alas there is no Days Visited While there is a CreationDate, this can't be used as accuretly in queries as me (and other people) create accounts on sites but then rarely visit the...

 
4:49 PM
if i know what youre talking about
i think it's just an asterisk followed by a space?
or are you talking about indented bullets?
 
@NathanMerrill For example, if you look at this from a programming perspective, the pseudocode will look like this...
 
@flawr you have to put 5 spaces I think
 
sleep(13)
if(rand < 0.3){return}
sleep(4)
if(rand < 0.6){return}
sleep(2)
if(rand < 0.2){return}
return
If I decide to change it to this...
sleep(13)
if(rand < 0.3){return}
sleep(4)
if(rand < 0.6){return}
sleep(2)
if(rand < 1){return}
return
nothing changes.
Because the success or failure of the last rand doesn't change the fact that we'd be ending at that point anyways.
 
oooh, I see your point now
 
Anonymous
The only thing it changes is whether or not it's an overall success
 
4:56 PM
is the lexicographical order of numbers the same as the actual order of numbers
nooo, its not
11 > 100
bah, I really hope that's not the issue
 
@Vihan <3 Thank you <3
 
I have done a terrible thing
(](][([([(}}})]]][}}}}}}}})])]]]]}}}{}}})])])}}}{{}}}{}}}}}}}}}}}(]((]]]}}}{{}}}‌​}}}}}}}}{{}}}}}}}}}}}(](]}}}{}}}}}}}}(][]}}}(][([([(}}}(]}}}{}}}}}}}}}}}(]][[(}}}‌​{}}}}}}}}}}}(][([([(}}}{{(}}}
 
@CᴏɴᴏʀO'Bʀɪᴇɴ oh my gosh, what is that
 
"Hello, World!"
 
@CᴏɴᴏʀO'Bʀɪᴇɴ dear god what
 
5:00 PM
It's a new language I made
 
@CᴏɴᴏʀO'Bʀɪᴇɴ what messed up language is this?
 
It's called "Pris"
 
it looks terrible
i want to try it
 
Just another brainfuck / jsfuck lookalike....
sigh
 
It's actually not, thanks.
 
5:01 PM
Vaguely like Parenthesis Hell
 
rood
 
@epicTCK cough
smug
rood
 
it may not work like jsfuck but it looks like it
 
( Focus register mod (+1, +2, +3...)
) Unfocus register mod (^)
{ focus = # % 2
} Command register
] doubles and increments current register mod
[ doubles and decrements current register mod
 
what was wrong with JSFuck?
 
5:02 PM
Nothing imo
 
Idea: create a language that is a compression of Parenthesis Hell.
 
-.-
my problem was comparing floats
 
such brackets MUST BE LISP
 
(()()(()()(()()()()((()()(()(()((()((()()()((()((()()()((()((((()()(()(
)()()()()(((()(((()((()((((()(((()()(()()((()((()()()((()()(()()()()(()
()()()(()()()()(()(())))))))))))))))))))))))))))))))))))))))))))))))))
^ 26.5 bytes for Hello World
 
26.5?
 
5:04 PM
can I send I message that's 2000 characters long in Chat?
 
If you decide each parenthesis is a bit.
 
1 for ( and 0 for ) or the like
 
@Vihan Encode the message in Zalgo, so it all fits in a single character.
 
@PhiNotPi ah okay
how would I do that?
 
I don't actually know.
 
5:07 PM
@epicTCK Why not jsfuck?
 
We could make "Zalgo art" where the arrangement of squiggles (all extending from a single line of text) draws an image.
 
Anonymous
@Vihan Nope, 500 is the limit
 
:(
 
So you just need to use bubblegum and stay under 500
 
Anonymous
I have a problem
 
Anonymous
5:10 PM
There's this loud floofy thing that keeps trying to climb on my keyboard
 
Anonymous
@Vihan ಠ_ಠ
 
You obviously need a box
 
Anonymous
@TimmyD I have a box. A one box. Err, the other way around. It's not interested.
 
Anonymous
This furball is terrible at writing code
 
It can write perfect Seriously
 
Anonymous
@TimmyD I clicked that link and my browser cried
 
7
Q: The evolution of neon kittens

GreenGiven the existence of neon kittens with: the internal properties and mentality of normal kittens bioluminescent fur. What evolutionary process outside of intentional human breeding/gene manipulation would lead to cats with glowing skin or glowing fur? If bioluminescence can't be achieved th...

@TimmyD Why would you want that????
 
@EasterlyIrk Mego was complaining of cat-on-keyboard syndrome. I offered a potential solution.
 
Solution: Get cat her/his own keyboad.
 
@EasterlyIrk Did you see the comic? :3
 
5:29 PM
Yes.
What is the pink dot for?
 
Which one?
oh
It's GoL
Pink was random
 
okay.
brb breakfast
 
@EasterlyIrk breakfast? what time is it for you?
 
TIME CHECK TIME
 
5:37 PM
PS C:\Tools\Scripts\golfing> get-date
Friday, March 11, 2016 11:36:33 AM
 
12:37PM. EST is the best ST.
 
11:38 CST here
 
12:39 am here
 
aren't you up a little late? :/
 
5:41 PM
Woo, I'm down to 1539 for the Dyalog challenge. I fully expect 1500 to be doable at this point.
 
Anonymous
11:44 am and I'm late because I'm playing Path of Exile
 
oooh ascendancy came out
 
Anonymous
Yep
 
maybe I should get back into PoE
 
Anonymous
5:47 PM
And now time to get lunch before tackling the second trial
 
Hey guys!! i know how I can play at `11:00 EST !! I will convince my parents they meant 11:00 GMT + 8 time when they set my bedtime.... mwahahaha
 
Anonymous
I just started playing a few days ago
 
I read about ascension classes
are there other major changes?
 
Anonymous
The bug with the perandus chests is pissing me off though
 
Anonymous
Perandus league is pretty neat
 
Anonymous
5:48 PM
Kill hard enemies, find and open the glowing chest, hope you don't get hit with the bug where the chest stays locked even after killing all the enemies, get nice loot
 
Anonymous
And coins to buy more stuff from an NPC
 
Anonymous
I'm a newb and only in act 2, so I'm not the best to ask about it
 
I was in act 3 when I stopped
 
Anonymous
It's good, mindless fun so far
 
I'm excited for the puzzles
 
Anonymous
5:50 PM
They're not really that puzzling
 
Anonymous
At least, the first trial wasn't
 
Anonymous
Time your walking so you don't get killed by spikes, and fight a bunch of monsters
 
Anonymous
And I literally just teleported out of the second one to go get some lunch
 
@CᴏɴᴏʀO'Bʀɪᴇɴ I'm regularly up late
 
no we're talking about Path of Exile
 
Path of Exile is an online Action RPG set in the dark fantasy world of Wraeclast. It is designed around a strong online item economy, deep character customisation, competitive PvP and ladder races. The game is completely free and will never be **pay to win**.
I like it already
 
20:58 MSK here.
 
Markdown isn't making that bold... :[
**testing **
ug.
 
0
Q: Hungarian alphabetical order

vszFor those who wish a lot more challenge then the old Spanish alphabetical order, let's take a look at how the Hungarian alphabet is ordered. a, á, b, c, cs, d, dz, dzs, e, é, f, g, gy, h, i, í, j, k, l, ly, m, n, ny, o, ó, ö, ő, p, q, r, s, sz, t, ty, u, ú, ü, ű, v, w, x, y, z, zs actually,...

 
6:02 PM
Going to a C programming competition today
what do you think theyll ask and what should I know?
 
Anonymous
@epicTCK No spaces
 
Anonymous
@SethKitchen Beware of buffer overflows
 
thanks
@mego is there anything deeply violent or any nudity in path of exile? It looks like a great game from what I can see, just wondering what my parents will say....
 
@Mego How do you protect from buffer overflow
just make sure to clear the buffer everytime you use scanf?
 
Anonymous
@epicTCK It's a very dark game. I would not recommend you playing it if you're young and/or you think your parents might object.
 
6:06 PM
@Sherlock9 cool!
 
Anonymous
Common themes are: living stuff trying to make you dead, undead stuff trying to make you dead, you making living stuff dead, you making undead stuff re-dead, you making dead stuff undead (if you go the necromancer route), giant spiders, sirens, and all sorts of other unpleasant stuff. And that's just act 1.
 
still sounds cool...
 
Anonymous
@SethKitchen There are whole books written on that topic. Basically, don't ever try to put something into an array unless you can guarantee that you're putting less things in than the array length.
 
Anonymous
Use the sized versions of functions (snprintf), make sure to size your strings (char buf[N]; scanf("%N-1s", buf);), and don't go past the end of an array.
 
Essentially, exercise caution because your buffer may not be as buff as you think :P
 
6:11 PM
er
 
:) thanks guys!
 
Anonymous
The biggest pitfall in C is expecting the language to give a damn about what you're trying to do
 
@SethKitchen why is.,. your pic to the left of your name?
 
@Optimizer it isn't on my screen. idk maybe i'm just cool
 
or maybe its caching
 
6:13 PM
@Mego yeah, I'm a c# main so this might be rough
 
Anonymous
Oh also remember that strings have null terminators, so a string of length 5 (like "hello") needs to go in a 6-length array (char foo[6];)
 
Anonymous
"hello" is really {'h', 'e', 'l', 'l', 'o', 0}
 
Anonymous
Same thing
 
6:14 PM
:)
 
Anonymous
Chars are ints too
 
are they ASCII in C
 
Anonymous
Well, char is an integral type
 
Anonymous
So 65 == 'A'
 
how do I prepare for a string input?
 
6:14 PM
@Mego yeah yeah.. and penguins are humans too!
 
Anonymous
@SethKitchen char buf[N+1]; scanf("%Ns", buf);
 
are they ASCII in C
 
Anonymous
Where N is the length of the string you're expecting (not counting the null terminator)
 
Well, penguin is an integral type
 
Anonymous
Oh and memory leaks are a problem too
 
6:16 PM
@mego but how do I make sure their input is contained?
@mego like i don
t know how big it is :0
 
so Tyler == EmperorPenguin
 
Anonymous
Then you pick a value that you think will be big enough
 
what does % do and what does s do
oh ok
 
Anonymous
%s means string
 
What's the ruling on having lines of code before a lambda definition? The lines only have to be run once.
import locale;locale.setlocale(0,'hu')
f=lambda x:sorted(x,key=locale.strxfrm)
 
Anonymous
6:16 PM
%ns means an n-length string
 
char buf[999999999999999999]
 
Would that be okay?
 
Anonymous
@MorganThrapp Yep
 
Cool, I thought so.
 
Anonymous
@SethKitchen God no, you can't do that on any reasonable machine
 
6:17 PM
@SethKitchen Ints in C count up to 32767.
 
Anonymous
Stuff like that gets allocated on the stack, which has a maximum size
 
So a buffer can only contain 32766 characters.
 
Anonymous
At most you'd do something like char foo[4096];
 
so char buf[32766] ?
 
Anonymous
6:17 PM
Anything bigger and you'd want dynamic memory
 
Anonymous
Which is malloc and free
 
Anonymous
Don't ever malloc something without freeing it, don't ever malloc something twice, and don't ever free something twice
 
@mego can you do an example of malloc with a string input
 
Anonymous
So if you needed string input that could be up to 50000 characters long:
 
Anonymous
6:19 PM
char* buf = (char*) malloc(50001*sizeof(char));
scanf("%50000s", buf);
// do stuff
free(buf);
buf = NULL;
 
@mego thanks bae
 
@SethKitchen lots of premeditation and breathing exercise
 
Anonymous
The argument to malloc is the size of the memory you want, in bytes
 
lol :)
 
Anonymous
And since char isn't guaranteed to be 1 byte, you do N*sizeof(char)
 
6:20 PM
@SethKitchen Buffers have a terminat-- wait, it's a string having the terminating character.
 
My honest advice to anyone who intends to write a working program in C: use another language. You save in headaches what you lose in efficiency and memory usage
7
 
Anonymous
@Sherlock9 Unfortunately you don't always get that choice
 
But then, I'm not being very helpful, am I?
 
@Sherlock9 oh i totally agree, but yeah they arent giving a choice
 
Where would I ask if my question was related to when something would be advantageous to use in code?
 
6:22 PM
@flawr whoa
 
@CoolestVeto Code Review
 
imma start a Q&A forum called Heap Underflow
 
@SethKitchen That's review for pre-existing code. I need to ask a question about future applications.
 
@epicTCK but thats not an error :)
 
That's fair. But I'm not one to join events where I won't enjoy myself, like programming contests in C. I don't get schadenfreude from watching frustrated programmers.
 
@CoolestVeto I'd say close enough and upvote you :)
 
Anonymous
@CoolestVeto Programmers?
 
@Sherlock9 It's for an internship at Garmin tho :)
 
@SethKitchen Nah. :P I'm pretty sure there's a site for it.
 
@CoolestVeto Probably Programmers.
 
6:24 PM
@Mego Speak of the devil. Thanks.
 
@SethKitchen it's called crashing, you no longer have anything on the heap because your program isn't running
 
@SethKitchen In that case, I'll stop messing with the conversation and wish you good luck! :D
 
@epicTCK I always thought overflow and underflow were bad terminologies. code doesn't flow
@epicTCK it's not a liquid
@Sherlock9 Thanks bae <3
 
@SethKitchen and its a liquid github.com/Shopify/liquid
 
@epicTCK Liquids are supposed to mix. If I poor water on my code, it will break it :(
 
6:33 PM
that's because code is nonpolar, just like oil. Not all liquids mix
 
0
Q: In what situations would passing objects through static methods be advantageous?

VoteToCloseIs there any situations in which it is advantageous to use a static method and pass the reference to an object as a parameter rather than calling the method on an object? A clarification on what I mean may be found in the following class: public class SomeClass { private double someValue; ...

 
That might have been better for SO but we'll see
 
It's more abstract than SO might like, though.
 
What's wrong with this picture:
(at a certain time)
 
Anonymous
6:43 PM
@epicTCK You have to reverse the polarity
 
...OF THE NEUTRON FLOW!
 
@CᴏɴᴏʀO'Bʀɪᴇɴ That's not the distribution of population; that's a theoretical stance if color was equal with only two extremes.
 
@CoolestVeto That's given by the context. I was referring to the chart.
 
6:46 PM
Imagine if we created an object oriented zoo. Subspecies extends species extends genus extends family extends order extends class extends phylum extends kingdom
for every animal!
u'd have like 10000000000000000 objects
 
@CᴏɴᴏʀO'Bʀɪᴇɴ What's wrong with it? :P
 
Eight million seven hundred thousand (give or take 1.3 million) is the latest estimated total number of species on Earth and the most precise calculation ever offered, according to a new study co-authored by a researcher with the United Nations Environment Programme (UNEP).
 
@SethKitchen classes* not objects. ;P You'd probably have a lot more objects.
 
They each have their own speak function
 
@CoolestVeto The tops of the columns in the graph are not on the curve, but rather, below it, thus showing two different data sets.
 
6:50 PM
@CoolestVeto how do you have a different name on here than on programmers
 
@SethKitchen Witchcraft and buffoonery.
 
I like how it is almost the same picture tho
 
It's also an anagram. ;P
 
No way!
WTF HOW?!@!@!
SO COOL!
 
6:52 PM
Your local Petco is hiring
they hire programmers?
 
@NathanMerrill Literally laughed out loud at that one. :P
 
good :)
 
Anonymous
@SethKitchen You can do it by going to your parent site for chat (for you, it's math), changing your display name there, and choosing NOT to sync it across all network sites
 
@El'endiaStarman Lol at not answering the door bc you are naked
 
Anonymous
Essentially you can have a different username for every site
 
6:55 PM
@mego oh that's cool!
 

« first day (1868 days earlier)      last day (2978 days later) »