« first day (2245 days earlier)      last day (2930 days later) » 

11:05
cbg
cabbage Jon
11:17
Cabbage Joncle
11:28
cabbage
11:39
am i currently the only active person here?
No, you aren't
that's good to know
@SimeonAleksov cabbage
How you doing
11:42
a little bored but good, thanks
you?
I'm good, doing some homework
Calculus mid term in 5 hours :)
wow
what is calculus used for?
@SimeonAleksov I hope you haven't been drinking. Alcohol and calculus don't mix. So don't drink and derive.
11:44
Haha D:
no i haven't been drinking
@PM2Ring Ever heard of Ballmer's peak?
@SimeonAleksov Calc 1?
I will probably fail it, I'm really bad at it.
Yes
you will do fine
good luck!
Calculus 1 got me into math
loved it so much
11:45
I passed Discrete Structures and Introduction to computer science with 100%, but this is..ugh
@TheOneWhoLikesToKnow Functions, integrals, differentials... en.wikipedia.org/wiki/Calculus
@RomanLuštrik No :)
some hard stuff
is it in a level
or gcse
@PM2Ring I ____knew____ it!
11:47
@TheOneWhoLikesToKnow it's not hard
it's natural
when you reach abstract math, that's where hard shit comes
@khajvah maths is starting to get scary
do you think its a good thing to run dml stuff from migration script?
in django for example?
@khajvah what is included in abstract maths.
@khajvah is it things like formulas
@TheOneWhoLikesToKnow group theory, ring theory are 2 of the things
number theory is part of it too I think
ok, my Vim has async linter now
does anyone here know how to print text from the print() command in different colours without the need to install anything in python?
12:01
Well, I'm blind, I can't read the text on my print ;D
For todays task on AOC
OFLELOYFCS
Oh, the first one is C :D
Is a question about whether or not a user's a HV better suited to a posed question in Meta, or is there a way to flag it? I couldn't see it directly on the user's profile, but there's a pattern of 'stuck, fairly well defined questions that are answered elsewhere', and getting others to write the code, imo.
@SimeonAleksov you did exactly the same mistake as me
What do you mean
I printed with #, and read it incorrectly twice
@TheOneWhoLikesToKnow Yes, but it's a little painful to make it portable, since Windows terminals work differently to Unix-derived ones.
12:07
and then I printed with ansi colours with reverse space, and I was like "OMG"
Well, I don't know how to do that :D
Did you visualize it?
windows, or linux, or macos?
Windows
Oh. :D
@PM2Ring what do you mean by unix-derived?
@TheOneWhoLikesToKnow Linux, OSX, etc.
So if you're on Linux or a Mac it's very easy.
This is awesome.
@AnttiHaapala 2 line prompt ew
@khajvah yes
and RHS missing from the pic :P
I am planning to buy a MacBook soon since my computer is failing, but never used MacOS before
12:10
@PM2Ring unfortunately im on windows
Should I go for it?
@SimeonAleksov why macbook?
Honestly, I don't know :)
As a mac user of 15 years, save your money, buy a much more powerful 'PC' for the same price and run Ubuntu on it
12:12
drink beer with the rest of the money
I don't want PC, I want laptop
beer>macbook
Mostly, I want mac because of it's battery life
and software
@SimeonAleksov mac has brilliant screen but thinkpads are more powerful for the same price
I mean a non-mac laptop when I say PC, not a desktop.
12:13
Oh :)
@TheOneWhoLikesToKnow There are libraries like colorama, but you can do it with a Python script that uses Windows DLL calls, as shown here: burgaud.com/bring-colors-to-the-windows-console-with-python I haven't tried that code myself, as I don't use Windows.
What software do you want on the mac, out of curiosity? I don't think i've missed anything moving to Ubuntu, really.
for the price of best macbook pro, you would get much much better thinkpad but its not that fancy
@PM2Ring all of those examples are in command prompt
How is battery life on Thinkpads?
12:15
@PM2Ring is it possible to do something similar in the python terminal?
@SimeonAleksov there are versions that have better batterly life than macbooks as far as I know
@SimeonAleksov it depends on the size I suppose, thinkpads have replaceable battery
but under Linux, it might get bad due to bad drivers
Ugh I don't know, MacBooks are sexy :D
macbook is fancy, if you want to look like a pro, get macbook
if you want to be a pro, you can get either
12:16
@SimeonAleksov have you seen x1 carbons?
or x1 yogas
@marxin you don't look like a pro with macbook
@SimeonAleksov Congrats for becoming mindless drone #4753468 :P
The yoga would be my choice of notebook atm tbh
cbg everyone
12:18
i have to go
rhubarb
@TheOneWhoLikesToKnow What do you mean by "python terminal"? That code should work correctly in the Python interactive interpreter when run in the Windows command prompt. If you're talking about IDLE, or some other Python environment, I have no idea whether it'd work or not.
rbrb
etc
@Withnail I like carbons more
What do you mean :D
12:18
@khajvah from what i see around most people say "oh yeah thinkpads are better" but they end up with buying macbook :D
Shall have a look, haven't come across those yet
@marxin the latest generation is a fail
maybe the previous ones were good but this one is just stupid
Said every older generation ever
The Yoga is nice
personally im working on osx because I got one from work
but I wouldnt buy one for myself
I would buy thinkpad
12:20
Is there difference between thinkpad and other laptops?
I cant say, its very good but comparing price / quality, its only fine
@SimeonAleksov yes, one is thinkpad
@khajvah +1
Ugh, I want a laptop which I could use for atleast 4 or more years, atleast until I finish uni
12:21
Dells have 3 year warranty
@SimeonAleksov I finished my uni with netbook tier laptop
well I haven't finished it yet but I will
But all my dells have been workhorse low-end ones with short battery
So no insight from me
I have HP at the moment, but it's only i3
mine is cheap acer with batter life of 30 minutes
only i3
£2,700 for top macbook pro is A JOKE
12:22
@khajvah xy problem
@khajvah 2 lines prompts are cool and practical ^
(especially when you are working with deep folder structures and long commanf names)
The laptop we need :D
Standard macbook is £1200 - you can get this with 32Gb RAM for that... pcspecialist.co.uk/notebooks/defianceII-14
12:24
@khajvah I use a 2 line prompt in my shell. All the path stuff goes on the 1st line and I just have a $ (or # if I'm root) on the following line.
I'd hate 2 line prompts
chromebooks are cool! and you can install linux on them =)
mine is one line, with git stuff on the right
@PM2Ring similar reasons then :)
Aren't chromebooks netbooks?
As in: need moar powa?
12:25
Okay, x1 yoga is cool
My hands shake under 4 cores...
@khajvah doublepost
goddamn
Just FYI:)
12:26
thank you though
I'm on mobile so I'm working with higher signal-to-noise
At least I try to
Okay, I have to ask, what is use of the red button? :D
@SimeonAleksov it's not a button. It's a highly sensitive organ of every nerd
It blinks if you have to do the needful
12:33
What about ThinkPad Helix?
Is it decent?
reading about "von Neumann stability analysis of PDEs" just melted my brain
cbg' noon
cabbage @AndyK
12:49
What should we do about questions that want help with AoC? stackoverflow.com/questions/41039854/advent-of-code-day-2
Meta? Although AoC has no real stake
It's unlike math olympiads etc on math.SE
@PM2Ring hammered
@PM2Ring after 100 first ones, it doesn't matter, there is plenty of code so that people can get 50 stars if they want without any coding skills
Coffee has no effect on me.
@BhargavRao Good thinking. :) Of course it's not against SO rules, more a matter of courtesy, as I don't think Eric Wastl would be happy to see AoC solutions on SO. OTOH, I guess it's not a big deal for old puzzles, but it would be if people started posting solutions on the day the puzzle was released.
12:57
@PM2Ring do you know about stability analysis of PDEs?
Many profs have flagged posts asking for deletion as they were supposed to be the final exam questions. I'm still not sure of the SO policy on that though.
note: there are questions over on code review that ask for improvements on AoC code...
@khajvah Not really. I'm more of a trial & error guy. :) If it doesn't converge I try a smaller step size, or a different integrator. Or give up. :)
ok :(
ex:
7
Q: Advent of Code - Day 01

enderlandAdvent of Code is a fun competition. Here is a link to the first day. Each day has two parts. --- Day 1: No Time for a Taxicab --- Santa's sleigh uses a very high-precision clock to guide its movements, and the clock's oscillator is regulated by stars. Unfortunately, the stars have b...

and there's others:
@BhargavRao, since you're hammering them on SO, it seems like they shouldn't be allowed on code review either
13:03
What about homework? Is homework allowed to be reviewed?
I mean after it's submitted and graded. :)
@heather Bhargav didn't hammer it because it's AoC, he hammered it because it's a dupe. Of course, hammering makes the question unanswerable... :)
@PM2Ring, oh, okay, I misunderstood that, sorry.
@SimeonAleksov you can pretty much make it look like normal code and not a homework
@PM2Ring Martijn hammered it as a dupe :D
@SimeonAleksov, I've seen a few like that, yes.
13:04
Not me.
Also note that enderland posted that question about the Day 1 puzzle on Day 3.
@BhargavRao Ah, right. :)
I've almost stopped hammering these days. Busy with the mod work during that time :(
@SimeonAleksov People can ask any on-topic questions they like. SO & other Stack Exchange sites don't care where the questions come from, but the question does have to conform to the expected quality standard. It's not SO's job to stop people from cheating on homework or competitions.
OTOH, as a matter of courtesy to puzzle site maintainers many SO regulars don't like to post worked solutions to Project Euler, etc. And on a related note, we know that handing people the answer to their homework assignment isn't really helping them in the long run, so many of us prefer to give hints & partial answers. And if we do give full working code we accompany it with explanations so that (hopefully) the OP will learn something.
I don't want to cheat on my homework. I meant for past homework that is already graded :)
I will check with the professor first though
Well, I am off to the faculty to study, bye.
Sorry - naturally I didn't actually want you to add my /tmp directory to your stack
13:13
@AnttiHaapala I got very, very lucky that my regexes and rotation algorithms both worked on the first try. Usually I'm plagued by incorrectly escaped characters and off-by-one errors.
@SimeonAleksov Yeah, sorry, you did mention that before. I just got carried away discussing the general policy / attitude of many SO regular answerers. :) Getting help / reviews on already-graded assignments is perfectly fine and an excellent idea, especially if your teachers don't give you enough feedback.
Ha, I was just thinking this morning "I should make a helper function to extract digit seqeunces from AoC input", and I see you've already got exactly that. I'm behind in the game it seems
@Kevin at first I filled a pixel at x, y with rect...
I was like "10, odd, that's low, ok lets do it anw"
then I rotated in wrong direction... sigh...
I would have submitted thirty seconds sooner if not for the typo in the sample input
I wonder how many "helpful" corrections the administrator got in the first half hour of the problem being up
I froze for like 2-3 minutes trying to find out why an indexerror was happening - wrong index variable, lol.
then... in part 2 I read the text wrong, twice... but luckily I only submitted incorrect one once... the second time there was still cooldown going on, so I decided to doublecheck
13:19
@AnttiHaapala Yeah, me too. Then I turned around the rotation and prayed that A%B for negative values of A still returned a positive number.
it does
and then afterwards I realized that I should've used numpy :(
Yeah, I would have been more confident in that if I wasn't sleep-deprived :-P
"Of course negative left hand arguments still give a positive result, I've used x%2 to check the parity of signed numbers plenty of times", a more well-rested Kevin would have reasoned
numpy.roll is quite a neat function. Sure beats stitching together halves of lists yourself.
@Kevin Just remember that a % b always has the same sign as b.
Is that true for mod operators in general, or just for Python's mod specifically? I know some languages work differently.
@Kevin That's the convention that Python (and other sensible languages) use. :)
IIRC, C allows whatever the hardware does.
But in any language, the equivalent of this Python code is true: q, r = divmod(n, b); n == q*b + r
13:28
So it's just that some languages have funny ideas about what divmod ought to return, then.
Basically. If integer division isn't floor division, then the remainder has to adjusted to make n == q*b + r true.
I just now remember reading a nice breakdown of the behavior here. It seems C is one of the naughty ones.
Ooh, C# is one of them... I hope I never used that at work. [meanwhile, in the background, planes are falling out of the sky]
anyone here tried hylang :D
Ok. I did remember correctly. :) Originally in C, the result of % with a negative modulus was implementation-defined (to avoid imposing inefficiency), but C99 standardized it.
Yeah, I figured that was the case.
@sideffect Nope. I keep meaning to learn some form of Lisp, but never get around to it.
People wishing to see me learn new things should contribute to my kickstarter, "cure Kevin's executive dysfunction". Proceeds will go towards a large burlap sack full of stimulants.
13:37
I understand the benefit of standardizing it. OTOH, it's a C tradition that simple arithmetic is implemented using the arithmetic ops of the underlying hardware. So if you know assembler you can be confident of exactly what your C arithmetic / logic code compiles to. OTOH, with modern optimizing compilers your code's going to get mangled anyway, unless you turn optimizations off. :)
There is a certain dark appeal to being able to compile a language in your head as you read it...
@AndyK Dangerously
Exactly. They used to say "C's so close to the metal that you can smell the registers"
cbg("all", re=True)
Crivens! It's a Nac Mac Python!
13:45
Sorry, on the wrong side of the border for that!
I've gone incognito, although the ginger beard may give me away
@IntrepidBrit lool
@IntrepidBrit all.map(cbg)
But how do I pass the "recbg" parameter poke?
Woah looks like Fonts Corrupted has a zalgo infestation
@IntrepidBrit all.map(cbg.bind(null, True))? :D
13:59
A proper implementation of all.map will be stateful and remember if you've cbged before in this process. Calling a second time should recbg.
oh god
stateful cabbage, the horror
I just got a mental image of "stately cabbage", which is cabbage dressed up in 1890s-era gentleman's garb
Getting the monocle to stay in place is a devil of a task
Oh my, if my puzzle input is unique and generated then someone wrote a script to rotate in reverse until rectangles formed in the top-left. :-D
Yeah, I was wondering how the admin generated those inputs.
14:04
It's mostly lines (rect ax1 or rect 1xb, only one rect 3x3 in there)
It's not too hard to make an algorithm that takes the goal state and outputs a series of instructions that generates that state, but the easiest way to do it would produce pretty homogeneous instructions.
You can make any pattern just with rotations and rect 1x1, but where's the fun in that?
I should really go and use PIL now to create an animation..
I was thinking of doing the same :-)
Japanese men tend to prefer cute women over capable and hardworking women.
I think this is a problem in the west, too... I've heard many stories of girls that intentionally underperform in science/mathematics because they don't want their peers to know they're book smart.
14:09
I don't think it's the same type of thing, but similar
@corvid why, do you feel held back too?
because I am ultra kawaii
It's a real shame... Everybody's acting in their own best interest, but in doing so, they leave a lot of potential value on the table
@corvid Yeah, sort of the general category of "behaving contrary to one's true nature because you think that's what others want"
14:25
morning cbg
cabbage Marcus
how goes it
feeling oddly disappointed in the latest AoCs
@SimeonAleksov that's always a good choice
@MarcusS I find it mildly amusing that on the 5th "It's all uphill". Then the 6th was that hilariously easy one, 7 wasn't bad, and 8 was easier I think. Especially if you know numpy, apparently ;)
I tried adapting my solu...oooooh. I was rotating right.
@WayneWerner great now i have to go look at numpy ;(
14:31
cabbage @MooingRawr
\o andy how goes it
8 hours ago, by Wayne Werner
user image
@WayneWerner Exactly!
just buried underwork
oh... that stinks.... you can do it tho
14:32
some guy in the indian subsidiary managed to get a ransomware
i really need to go play with pandas and numpy, mostly because I like pandas....
whole server locked
need to restore
and now shouting match about who's fault
how about, nuke the system into orbit, restore the system, then have a shout match
sounds better man
In a perfect world, establishing the guilty party is not an important part of the recovery process
14:34
@kevin we are not in other's mind, that's the isue
are you a sys admin andy? if you dont mind me asking
culture + personal experiences = lethal mix that hinge on efficiency
I'm a jack of some trade
I'm data analyst
whaddup snakes
@AndyK Great! Now you can introduce something like Saltstack to create Phoenix servers ;)
sup joe.....
14:36
but I have experiences in sys admin from a former life
now that long ago actually
nice, i was always wondering what it would be like to be a data analyst
not much Marcus
just common sense
Incidentally, my friend informs me that his workplace's data analyst quit because the environment was super toxic. If anyone wants to fulfill their dream of working within 50 miles of me, now's your chance...
and always worry that your data are shit
death march companies, I passed
14:38
^i dig the site name
and never ever jump to conclusion, ever. I'm always assuming I might be wrong
oh man, @WayneWerner, you don't need numpy for part 1 at least xD
@WayneWerner that's an idea
i think the biggest issue is parsing and formatting the data,
guys, going back to crunching numbers
14:43
My day 8, although I'm pretty sure most people did the same thing: github.com/MarcusStuhr/Advent-Of-Code-2016/blob/master/Day08/…
see you
have fun!
rbrb Alex
@MarcusS Agreed. I enjoy well-chosen names
14:46
cabbage
cabbage
So I have some code that runs multiple regexes on a line of text. Each line should match one of the regexes and fail to match the other two. I then perform something different depending on which match matches. I couldn't decide which of these approaches I should use:
if pattern_a.match(line):
    x,y = pattern_a.match(line).groups()
    #do things specific to pattern A
elif pattern_b.match(line):
    y,z = pattern_b.match(line).groups()
    #do things specific to pattern B
elif pattern_c.match(line):
    z,q = pattern_c.match(line).groups()
    #do things specific to pattern C
Or
match_a = pattern_a.match(line)
match_b = pattern_b.match(line)
match_c = pattern_c.match(line)
if match_a:
    x,y = match_a.groups()
    #...
elif match_b:
    y,z = match_a.groups()
    #...
elif match_c:
    z,q = match_a.groups()
    #...
Approach 1 has the drawback of always running one pattern twice, which is an obvious redundancy. But approach 2 has the drawback of always running all three patterns, even if it turns out that pattern_a is the one that matches.
If it were me, I'd go with the first approach
If pattern_a is much more likely to match than b or c, then approach 1 will on average require less processing power than approach 2. But I don't really know anything about the relative frequencies of the patterns in my input data.
m = pattern_a.match(line)
if m:
    x, y = m.groups()
    # do things specific to pattern A
    return

m = pattern_b.match(line)
if m:
    y, z = m.groups()
    # do things specific to pattern B
    return

m = pattern_c.match(line)
if m:
    z, q = m.groups()
    # do things specific to pattern C
    return
14:53
If all else fails you could consider randomizing the order of the matches to minimize the bias of one showing up a lot more than the other
Kevin's sneakily asking about AoC
brief cbg
Each approach is missing logger.info('A|B|C matched') to let you know what the frequency is of your data ;)
@poke This is a valid approach, and yet I am reluctant to drop my elifs in favor of independent ifs. Maybe I'm being irrational.
use switch-case
wim's animation for day 8 was wonderful. I won't link it, because it's pretty much the answer
14:55
@idjaw how so?
he linked it himself
I feel like elifs better communicate my intent. But on the other hand, is it not written, "practicality beats purity"?
@AndrasDeak yes. Last night when the solution was released. He solved it and had an animation
I think it would be fun to write the reverse solver for this problem
@idjaw I don't get it
what do you not get?
14:56
patterns = (
    (pattern_a, 'a'),
    (pattern_b, 'b'),
    (pattern_c, 'c')
)

key = None
for p, k in patterns:
    match = p.match(line)
    if match:
        key = k
        break

if key == 'a':
    x, y = match.groups()
    # do things specific to pattern A
    return
elif key == 'b':
    y, z = match.groups()
    # do things specific to pattern B
    return
elif key == 'c':
    z, q = match.groups()
    # do things specific to pattern C
    return
1. why link it if he linked already?
2. why is it spoilery? Everybody has a different code (mod hash collision), and the algorithm is clear
I did not read day 8. I just noticed the animation provided a string, so I assumed that was the solution. I did not want to "revive" it here, in case people would be spoiled
thinking the string was the same for everyone
ah
I thought you were convinced to start working on those fake internet points;)
I think linking to the image (but not hotlinking it) would be fine under the terms of our informal AoC policy.
for pattern in (pattern_a, pattern_b, pattern_c):
    match = pattern.match(line)
    if match:
        break

if match:
    if match.re is pattern_a:
        x, y = match.groups()
        # do things specific to pattern A
    elif match.re is pattern_b:
        y, z = match.groups()
        # do things specific to pattern B
    elif match.re is pattern_c:
        z, q = match.groups()
        # do things specific to pattern C
14:59
@poke Ooh, now there's an interesting approach.

« first day (2245 days earlier)      last day (2930 days later) »