« first day (2241 days earlier)      last day (2932 days later) » 

00:00
oic...so a long lasting, on going discussion.
I am searching for a string to unicode converter
considering that some of these arguments have already been made in October
@Code-Apprentice well it was that one time, and now this:)
to fix it
thanks for the info. Her project certainly caught my interest.
@Ralf17 gist
yeah, it's neat, and heather is an enthusiastic young future-scientific-something
00:01
or pastebin if you prefer
I know basically nothing about quantum computing. Quantum mechanics is on my list of subjects to study on my own. But who knows when that will happen.
if that helps, quantum computing has little to do with quantum mechanics in my opinion
I tried html.encode('utf8') to convert
For instance, I sort of do relativistic quantum mechanics (sounds fancy, but nothing extraordinary or novel), but quantum computing eludes me
quick question.. i'm new to python. But in my class I defined a function but when I call it, it says "name not found" why is that? (line 9) coderpad.io/79JT4JAN
its clearly defined right under it
00:05
cabbage
you throw a rock in a bush and three pastebins jump out:P
No luck, I'll try another.
yah, I don't know much about either quantum mechanics or quantum computing. I'd like to learn more about both, though.
and about a million other academic topcis.
same errors
@KevinDuke how are you calling the function?
func_name()
00:07
right within another function
DSM
DSM
@Ralf17: using Python 2 can be a little confusing with regards to unicode. In your case, you have a "str" object, which is basically just a bunch of bytes. htmlmin wants a real string. So you want to decode your bytes into a string, e.g. html.decode("utf-8") [or whatever encoding you're using] or unicode(html).
@KevinDuke You forgot self.
oh i need that? like self.func_name()?
DSM
DSM
@KevinDuke: the key word in the error message is "global". Your method is a method of the class, and so as @Code-Apprentice says, you'll need self..
00:08
No: def func_name(self):
oh...actually you need both changes.
DSM
DSM
@Code-Apprentice: well, he'll need that too, but that's not what's causing the error message.
lol, you are right. I noticed the definition first, not the call.
@DSM, I've been posting some silly pandas answers, please be gentle if you ever come across them:D
i ran it like func_name(self) and it still says global name not defined
talking about list of things to learn...pandas is on that list, too
00:10
wait, i need it in the function declaration?
@KevinDuke You need to do self.func_name() and later def func_name(self):.
ah.. so different from other languages
DSM
DSM
@AndrasDeak: I'll do my best.
The first one will fix your current error. The later will fix an error you haven't seen yet because it didn't get that far.
@Code-Apprentice "and later"?
don't you need the def first?
00:11
"and later" meaning a few lines down.
maybe not the best wording =p
that is another detail in python that I avoid and make sure everything is defined first
C habits...
@Code-Apprentice no, that's pretty clear
technically, the interpreter parses the entire class definition before anything is executed anyway.
so line order in the file is separate from temporal order at run time.
i don't really see the reason why python needs to know "self"
00:13
@KevinDuke are you using self?
@DSM Thank you!
or anything that belongs to a class instance?
@Code-Apprentice oh, I see, thanks
makes perfect sense in hindsight:)
> Middle schooler who loves math, physics, and computer coding.
Is that true? A middle schooler that is learning Quantum Computing? mind blown
00:15
yes, heather is pretty active on physics.SE (well, the chat room which I've been to; I'm not familiar with physics.SE main)
you can see why I'm more than happy to discuss the code:)
DSM
DSM
@Ralf17: as soon as possible, you're going to want to upgrade to Python 3. Working with unicode in Python is pretty straightforward, but 2 lets you get away with a lot of stuff you shouldn't and so it's very hard to build the right mental model because doing the wrong thing will work half the time.
@KevinDuke Other OO languages use something similar and mostly hide it. Occassionally you have to use this in Java and C++, but most of the time it is implied and optional. Python prefers to be more explicit.
@KevinDuke then that ^
i see, but seems kind of pointless for such a highlevel language
self is not special in python; it's by definition the first variable passed to a bound method; you could call it this or poopoo if you wanted to
but don't do that; it's called self by convention
DSM
DSM
00:17
Fred.
you could call it Fred too, yes
@AndrasDeak I try to make no assumptions about anyone's age or experience level here at SO. I am occassionally surprised in many ways.
oh you would be
we have teenage mods, and boy are they awesome at their job and at being humans in general:)
Graphics are expensive D:
There are several teenagers active in the Android room where I usually hang out.
the regulars are pretty good coders all around.
I was talking to my brother recently and his two oldest sons are learning about robotics. Not sure if it is in their school curriculum or an after-school activity or both...didn't get the details about that. I don't think they have gotten into much coding yet, though.
@Code-Apprentice You wouldn't happen to be into making graphics for Android apps, would you?
Nope. I don't know much about creating graphics. I can do very basic stuff in Gimp and that's all.
I use fiverr.com with some success.
@DSM I'll keep that in mind.
00:59
cbg
sorry i took so long
recbg
that's OK, we've had some time to gossip about you
@AndrasDeak, @Code-Apprentice, I think the problem with the database idea is that there is still (I think, not sure) the same problem - so it records every operation that the user wants to be done, and then at the end it calculates it...well, actually, I guess you could maybe use an if statement at that point...oh, wait, I remember what was wrong with that: the user might use multiple control/target commands.
@AndrasDeak lol
wim
wim
hey AoC hackers, I just released this thing on pypi... pip install advent-of-code-data
now I don't have to load files or paste my data into source files, I just import it like this. give it a try and let me know if it's working for you...
So I think the problem is, let's say the user wants to apply a Hadamard gate and then the control part of a control not gate to the control qubit and then a target gate to the target qubit. Then it would go through and record some thing like calc 1: hadamard, control calc 2: target. So then it would have to use an if statement like "if calc 1 includes control then run calc 1 first, else run calc 2 first".
But then what if you have the user wanting to do something like calc 1: hadamard, control, target (cNOT) calc 2: target (cNOT), Z, control? Then the if statement doesn't work, does it?
you could have two parallel queues, and work on one until you find a prerequisite -> switch
01:06
I guess, hmm, could you make the things the user wants to do a list, and then a for loop goes through the list, and for each thing in the list, you check if it is target or control...
would that make any sense?
1. hadamard? fine. 2. control? fine. 3. empty calc 1 1, 4. calc2
1. target? NOPE -> switch to calc 1 -> ...
wim
wim
@vaultah I actually used the traceback code from your answer earlier today, so thanks for that!
@heather superficially (because I don't understand in depth): sure
but two lists might make more sense
@AndrasDeak, yeah, I like your idea better
the question is how exactly to implement it.
the whole reason you're trying to make this into something async/multiproc/etc. is that you have two parallel conveyor belts to work with, so to speak
01:08
right
I guess I would use two lists (or deques or whatever) in a dict, and switch between the keys of the dict in a loop. End if both queues are empty.
probably deques, as you want to pop from the front
so something like
hmm, okay. I think what I'll do is start by implementing the dispatch dict thing, it'll make all the code so much easier to work with. it'll take a bit to figure out what I need to do, but I think I can do it. then I'll try to implement that. Part of the problem here i think is that I'm not very experienced at all with python =P
tasks = {0: ['hadamard','control'], 1:['target']}
itask = 0
while True:
    task = tasks[itask][0]
    # if this can be done: do it
    # pop the front of tasks
    # else:
    itask = 1 - itask #switch queue
    # handle invalid input case somehow
might be unnecessarily convoluted, but I still don't understand your specific needs
just a rough idea
there might be better suited tools, but I don't know them
hmm, okay
@heather this is how you'll learn, you'll be fine:) You can always ask if you have specific problems. And some working code can always be made more efficient.
the main hurdle is coming up with a clear algorithm for what you want to implement (just to repeat myself:P)
01:13
@AndrasDeak, =) you should just say CAFI every time we meet (clear algorithm for implementation)
I'll try to keep that in mind:P
@wim "breaking shit" is oddly confusing yet visual
I like the get_data(day=24, year=2015) format, looks handy
also, @wim, numpy allows you to reshape with one dimension size set to -1, that will be determined by numpy
wim
wim
@AndrasDeak I don't understand the context of your comment. I don't use one dimension array ...
grumblecakes. AoC part 2 is a lie
DSM
DSM
A.reshape(N, 3) could be A.reshape(N, -1) or A.reshape(-1, 3), etc.
wim
wim
ahhh, ok. cool, I'll try it out.
01:23
2 hours ago, by Andras Deak
fundict = {'Hadamard':hadop, 'X':xop, 'Z':zop} #etc
if fstgat in fundict:
    qstat = fundict[fstgat](qstat)
    done2 = input(...)
else:
    pass #handle non-trivial and custom cases
@AndrasDeak, I'm trying to implement this, and I don't understand what to do in the else statement. I have a few gates that do work outside of the actual function (I should probably just fix that, now that I think about it...)
nvm then, i'll just fix that part so I don't have to worry about it
@wim sorry, was afk a bit, but exactly what DSM said (thanks)
My part 1 works. My part two transformation gives me [[101, 102, 103], [301, 302, 303], [501, 502, 503], [201, 202, 203], [401, 402, 403], [601, 602, 603]]
but for some reason, when I run it against the actual input I get the wrong answer >.<
@WayneWerner newlines, off-by-one-line errors etc?
@heather OK:) I think even if, say, 5/7ths of your if branches do the exact same thing, it's worth defining a dict like that
I had one of those in my original code (the off-by-one, i.e. < rather than <=)
you can have some elifs afterwards, like before, it will already be more tidy
01:27
and I'm doing index access, so if I just have a newline I would have some serious problems that I don't have
when you see yourself repeating something a lot: time to refactor
booga booga booga
runs away
@AndrasDeak, yeah, I am defining the dict, it's definitely worth it. I'm just fixing it so all the functions can be defined by the dict.
that's the tidiest:)
DSM
DSM
01:30
@WayneWerner: if you'd like, we could generate a smaller test case for you to try.
@heather if you do that, you can even set a default value for handling invalid cases
Anyone mind running against their set? github.com/waynew/advent2016/blob/master/03/03_triangles.py
If you get different than what you succeeded with I'm happy to admit I've got a problem
In [14]: {'hadamard':'hadafun','xor':'xorfun','custom':'customfun'}.get('hadamard','invalidfun')
Out[14]: 'hadafun'

In [15]: {'hadamard':'hadafun','xor':'xorfun','custom':'customfun'}.get('nor','invalidfun')
Out[15]: 'invalidfun'
@WayneWerner not there yet 😛
The only issue that I could have is one where there aren't enough triangles...
01:32
@WayneWerner I get 6 with that test input for part 2 format
but I get the same sum of triangles both ways
wait, do you want your code with my input or your input with my code?:D
I want you to try my code with your input, to see if my output matches your output ;)
OK, sorry for being dense
if my code gives a different round 2 output... then I've got something different. Not sure what it could be though, given that it gives the expected groupings based on the input (and I also get 6 with the part 2 sample input)
01:35
I'm trying to catch up on this AoC stuff. Heard about it yesterday, but got really lazy. Didn't even work much on my existing projects.
@Code-Apprentice So far it's only taken me 20-30 minutes per challenge
mostly due to me not seeing something obvious
@WayneWerner yours with your sample input gives me 6 3?
that's not right, is it?
maybe your repl workspace is tainted?
I'm not in a repl :P
well whatever:P is 6 3 the correct output?
which one is part 2?
You should see

6
0
6

3
3
6
the top is the possible, impossible, and total
DSM
DSM
01:37
@WayneWerner: you want a one-word hint?
I saw that before commenting out the irrelevant lines:P
@DSM sure
DSM
DSM
equilateral
> In a valid triangle, the sum of any two sides must be larger than the remaining side.
then they're liars
DSM
DSM
01:39
1 + 1 > 1
argh.
apparently I'm an idiot -_-
Would have been easier for me to just use trig.
> the sum of any two sides
that should be for all sides the sum of the other two sides
that's the mildly bastardized version of the triangle inequality
grumble grumble grumble
I've got 59 seconds more to grumble about the wording of that problem
are you sure it's misworded?
DSM
DSM
Ehh, their statement is okay, IMHO..
01:46
I agree
my only non-issue is the case of equality
degenerate triangles are triangles too, you know
oh holy heck.
DSM
DSM
I can't tell if that was an "uh oh, my fixed version is still broken" or "uh oh, I just found out that the Canucks are leading by one so DSM is unhappy".
The game is turning in favour of the leafs
they are playing better as the game goes on
No it's still broken
aarrrrrhhhggg. I think another off by one
5 minutes later...
DSM
DSM
Are you also handling cases like (1,2,2)? The whole side != longest idea was a misstep, I think.
01:53
it was. Because that's the direction I was nudged in
DSM
DSM
Find whoever nudged you and beat them with a cluebat. Nerf, of course, because we're civilized.
Fuuuuuhhhh
> You have 7m 57s left to wait.
> For example, the "triangle" given above is impossible, because 5 + 10 is not larger than 25.
This is what happens when I read instructions rather than problems
:P
@WayneWerner it would take me less time if my power didn't keep going out.
I think I'd probably go faster today :(
do you have to wait after wrong answers?
02:00
I wasted a lot of time on Aoc3 part2 -- was completely thrown off by their mentioning of hundreds digits
I was not sure if that was supposed to be a necessary condition
I am spending too much time hacking the breaker box of my apartment complex ;-(
apparently my apartment shares circuits with my neighbors.
Was also unsure if the groups of vertical threes were meant to be treated as distinct groups or if we just iterate down one by one and take each group of 3
@AndrasDeak, is this kind of like what you were thinking when you explained the dispatch dict?
@Code-Apprentice so free energy is a thing!
DSM
DSM
@AndrasDeak: yeah, brought to us by Gibbs. #rimshot
02:03
:D
@heather almost, but you're repeating yourself:)
lstsingates == singates.keys() (for all intents and purposes)
@MarcusS Only if you get it wrong a whole bunch of times
@WayneWerner I think that was meant for @AndrasDeak
DSM
DSM
Minor: this line singates = ["Hadamard":hadop, "X":xop, "Z":zop, "Y":yop, "sqrtX":sqrtxop,"phase shift":phaseshiftop,"measurement":measurement,"custom":customop, "control":control, "target":target] won't work because it doesn't use curly braces and because the functions haven't been defined yet so you'll get NameErrors.
@AndrasDeak, oh, okay
@DSM told you 😛
02:05
@heather and what DSM said;)
Yeah it t was
I'm not tired at all
I read it anyway;)
@DSM, oh, darn. ::face palm::
otherwise, as far as the dispatch dicts is concerned, yes, I mean that:)
@AndrasDeak financially, the electricity is included in my rent
02:08
@heather there are some subtleties such as multiplying non-integer matrices in customop yet using == on them for equality; returning a matrix in one case, returning the input in another case; etc.
DSM
DSM
@idjaw: you did! Now please tell me we're going to win 4-2. ;-)
@Code-Apprentice so the neighbour is using yours?
I'm pretty sure all the leases are set up the same way.
Leases?
rental lease
02:09
yeah that's what I gathered...I don't get it
don't you people have devices that measure your energy consumption and pay accordingly?
ooooh, I see what you meant now
I mean that no one in the building pays an electric bill.
you pay flat-rate electric bill included in your rent
well, you pay rent and don't pay for electricity
sorry, 3 AM confusion fun
I pay a flat-rate rent. I'm sure the rent amount was calculated to include electricity.
yeah, it's clear now, thanks:)
I doubt the landlord is kind enough to just completely pay the electricity out of his own pocket.
=p
get some sleep!
02:11
I should:D
guess I'll try to walk the dog
@heather that latest version certainly looks much cleaner!
@Code-Apprentice, yay! =D =D that just made my day =D
got a few details to iron out it seems. But other's have already pointed out many of them.
@AndrasDeak there was a summer I was in housing at the university like this, we had the AC on at like 60F all summer (when it's normally 90+ outside)
ahhh the days of responsible youth...
i'm not sure, but I think the tabbing may have gotten all messed up...curses
02:21
@heather tabbing????
4 spaces:P
excuse me, I meant spacing, don't worry, I do use 4 spaces
or did you just mean indentation?
ah OK, sorry
yeah, indentation
@MarcusS they could have worded that a lot better
DSM
DSM
It certainly looks to me like there are some tabs (not four spaces) in there.
02:22
python 3 should scream for that, right?
DSM
DSM
It should, come to think of it.
i edited some of it in the github interface because you can't copy and paste in vim...bad idea...=/
DSM
DSM
Ah.
you can
or what do you mean?
Random mind teaser: You decide one day to go out for a walk. You walk 1 mile north, turn right, walk 1 mile east, turn right, and walk 1 mile south. When you are finished, you are back where you started. How is this possible? Where in the world are you?
02:24
the north pole, or south pole
north pole?
didn't read through, but typical kind of question:P
can't go north from the north pole
it's too late to read and actually figure out which
must be south pole then :)
02:25
of course, I should figure someone here has heard this before.
s/someone/everyone/ ;)
nah, it just strikes me as one of those "there are only a few places where you could make a teaser about directions" and that is either the north or south poles
@heather what did you mean by "can't copy and paste in vim"?
@AndrasDeak ?
@heather Every delete operation in vim puts text on the clip board. One way to paste is by using p while in normal mode.
02:26
2 mins ago, by heather
i edited some of it in the github interface because you can't copy and paste in vim...bad idea...=/
DSM
DSM
I know it mostly under the "what colour is the bear" variant.
You mean I could have avoided all of this!? You can copy and paste in vim!? 0_0
@AndrasDeak, ::sighs:: this is why I need to a. learn more about vim b. think about things more
you can 1. yank/put from vim to vim, 2. paste in input mode 3. if it's borked, then first :set paste, then do it again, then :set nopaste
02:27
the answer to "can I do X in vim" is almost always yes
@heather think of it this way: we wouldn't like vim so much if it made life harder:)
@AndrasDeak I don't know if I agree with that
:P
@DSM and "all sides of the house face south"
@heather I'm learning vim myself. users.ece.utexas.edu/~adnan/vimqrc.html is a good cheat sheet. Also, run vim-tutor for about a half-hour lesson on the basics.
@enderland Can I make coffee in vim?
=p
@Code-Apprentice, thanks for the advice
02:31
I've almost exclusively used emacs in the past. I recently decided to learn more vim, though.
I've worked in containers too much to use emacs
vi is on so many unix systems, emacs... :/
I don't even know what emacs is. I used to use an online compiler, and then I was shown the light of Linux, vim, and git.
someday when I have some good schedule time, I should just force myself to ONLY use vim for at last 30 days straight
hmm, I'm getting some strange errors, if anyone would mind taking a look
@DSM It's getting wild!!
02:37
Traceback (most recent call last):
File "python", line 118, in <module>
File "python", line 23, in hadop
TypeError: unsupported operand type(s) for *: 'complex' and 'NoneType'
DSM
DSM
@idjaw: yeah! I really don't want to lose in reg in the last 90s..
here we go :D
it seems to only be happening after I run a bunch of gates though...
@heather stay the way you are, untainted and pure etc.
@heather one of your functions returns a None instead of a number
or something else does
target() doesn't return anything, is that on purpose?
neither does control()
you now have functions, so they have separate namespace
::bangs head on desk::
02:41
if you need to pass variables, you need to pass them (if conceivable), or use globals
i think i need to learn more about python, because i didn't understand that last bit
nah, you're fine:P
although the dispatch dict approach might be more cumbersome if you need to pass to and fro other stuff depending on type
maybe start OOP and use instance attributes?:P
DSM
DSM
At worst she'll need to change the return signature a bit.
and the calls too, probably
hmm, I didn't have any errors now that I made target(), control(), and measurement() return qstat, but for the rest I honestly don't know what you are talking about. =)
02:46
def control(qstat):
    typegat = input("Which gate is this the control qubit for? See list of two qubit gates at the top.")
    if typegat == "cNOT":
        mem1 = qstat
    elif typegat == "swap":
        mem2 = qstat
that function doesn't do anything then?
sorry, have to go
also, I would use np.sqrt and built-in complex numbers instead of cmath;)
@heather see you later
I'm off too
good night
DSM
DSM
Aw, man, I hate shootouts. :-/
yeah it's always a toss-up
DSM
DSM
Bloody skills competition.
02:53
The Canucks got really lucky to get those two points
they blew a two goal lead and barely got a shot in the third
and the Leafs had the OT
DSM
DSM
I hate that my phone makes a noise to tell me we lost. I mean, I just watched it, isn't that enough?!
03:16
Yay! I finally finished Day 1 of AoC
@idjaw hockey?
@Code-Apprentice yeah
I could probably get into that if I ever started watching any games. I used to play street hockey a little bit in college.
anyone around who can help me decipher some of scipy's source code? I need to implement two functions by hand
DSM
DSM
03:35
At-least-the-Raps-won rhubarb for all.
wim
wim
@AndrasDeak is this what you meant? github.com/wimglenn/advent-of-code/commit/…
hmm... For part 2 of day 1, do you start from the location that part 1 finished at?
@Code-Apprentice no, it's "instead you notice" so it's the same start you started part1 at (0,0)
doh! it doesn't have to be at a corner where you turn
What if I just wrote a script that submitted an answer every 5 minutes?
seems like it'd be easier to just solve the problem
03:50
The same script would work for any problems accepting numerical answers. Unless there's something nasty like an increasing amount of time between allowed submissions or completely blocked out after X incorrect submissions.
or a negative answer
I guess you could try a binary search type of thing? hah
I believe it tells you if you are too high/low
yah, could scrape the web page for that info, too.
If I don't solve a puzzle today, does the test input change tomorrow?
No, I did days 1-3 this morning
So you didn't stop half way through solving one and come back to it the next day...
04:06
well, I copied the text into my CodeReview question for day1, you can compare tomorrow if you like ;)
I wish the AoC instructions were clearer -- I think back to challenges that took me the most time, and most of the wasted energy is spent trying to figure out what's being asked
Except for those RPG questions... those took a while (14 min for day 21, 26 min for day 22)
@enderland Do you mean on the subreddit?
bah, my solution is completely borked. Need to rethink this.
04:41
I'm ashamed of my solution.
it's....terrible.
to what?
AoC
I mean which day / part
oh sorry...day 1 part 1 :P
it's all I had time for so far
05:28
@wim you're welcome :)
wim
wim
phew
they are getting harder
LOL at the other room names spoiler
05:53
Do they build on each other or can I skip to Day 4?
wim
wim
06:14
they are self contained
 
1 hour later…
07:19
both this question and the dupe target
new_birdie here
can someone tell me how to plot parametric plot succesfully
in python
no, unless you explain what exactly do you need and provide mcve while following the room rules
ok i have plot parametric plot r= sin6 \theta
x^2+y^2=r^3
its asking many thing still error persists
it would be great if somebody let me have asparagus
That's not a MCVE
07:34
ok iwill be back lemme read how to create mcve
07:50
AoC4.1 done
08:08
And AoC4.2 done
<3 cribs
08:19
cbg
08:49
wow I did bad :(
30 minutes
had a problem first with regex, then most common was least common...
... took forever to realize that it is not written as north pole
and didn't remember how .translate works
@MarcusS not pythonic enough ...

« first day (2241 days earlier)      last day (2932 days later) »