« first day (2255 days earlier)      last day (2918 days later) » 

00:00
cbg
@Dominico909 why is that function defined inside draw()?
I removed it
didn't change anything :/
I threw it up above the setup() function
sure, it's weird regardless
It's driving me crazy
so is that you're defining Pluto to be a planet, that's wrong
00:05
NO
THATS WHY ITS COMMENTED
:D
anyway, even when I print out x,y of jupiter
and if you have weird behaviour, you should suspect your globals first
are you sure you need a global?
it says the x and y are changing but it doesnt move
just the i
is global
@Dominico909 yes, that's more than nothing
00:06
Ill try removing it one second
Doesn't change anything
then leave it that way:P
Yea I don't even know why I did that, can be done without
do you have a newer version that's verified to still produce your issue? With no nested functions called from outside, nor globals?
yes Ill get a link
btw "object" is needed in the class definition because you're using python2, and you need that to define a "new style class" (which is indeed what you should do)
in python3 you wouldn't have to specify object as a parent class (since new style classes are the only kind there)
you should also add those modules that make it work....
noStroke, framerate, loadImage, etc are undefined
00:10
They need to be imported?
only if you want me to run your code to see where it's going wrong
I don't insist :P
your code also seems to contradict import math at its top; it's as if you were actually doing from math import *
you'll never get your code debugged by strangers if you won't even produce a working example of your program
what's worse, if your example code doesn't match your real one, you can't even be sure that it reproduces the problem
see also MCVE on main
The code I used in the pastebin was exactly what I had before any help
and how were you running it?
ooooooooooooh shit
wait a sec
no, it's OK:D
for a second I thought that I was missing a part of your pastebin
00:14
Okie, also I didn't change anything and am now getting a nullpointerexception
a WHAT?
so I have to figure out what I did
confusion level over 9000
yea same here
I just ran the code after successful runs and I got that error
without changing any code
You got a nullpointerexception.
With the linked python code that defines functions and some globals and doesn't run anything.
It's a holiday miracle:D
00:17
Here's the function outside of draw()
sorry, it's still nonsense
Most importantly, that snippet doesn't run anything, only defines stuff
and if I tried to run it, it wouldn't work due to all the undefined names
it does run
How would I make it so it will run for you
$ python2 tmp.py
Traceback (most recent call last):
  File "tmp.py", line 50, in <module>
    fill(random(255), random(255), random(255))
NameError: name 'fill' is not defined
tmp.py contains your snippet
00:20
processing.org/download is where I got it.
OK, so it's not Python code, but Processing code?
How important do you feel this detail is?
Also:
5 mins ago, by Andras Deak
You got a nullpointerexception.
big red flag ^
I said that it was in processing
so I can't say I'm surprised
00:21
in my original question
25 mins ago, by Dominico909
This is done in processing for Python by the way ^
you're right, but that sentence didn't come across to me as you meant it
Just redesign the whole thing from scratch
Ah my bad, didn't word it very well
you didn't:P
@MarcusS Why redesign it? I think it's as simple as need be for what Im trying to do.
00:24
this is the first time I'm seeing Processing, but I don't like it
Why does it have access to the methods contained in an imported module?
on a related note: can't help you, I've never seen Processing
Thanks for trying though. I can't see any issue with how calling one planet would affect the outcome of another, just looking at it as if any other python code...
maybe it doesn't work like any other python code, see also nullpointerexception
hence "can't help you"
Yea, java
However, it was designed to run as Python code. So after fixing the nullpointerexception, I dont see how pythonically this wouldnt work
you're missing my point
Right, that it doesn't work as other python code. I hope that's not the case or I'm pretty screwed
I'll have a go at just trying to write it differently but performing same operations and see if anything will work
00:31
It can easily be something trivial, but I'm not sure (read: I'm convinced of the opposite) that knowledge of python itself will help
The code, as python code, shouldn't run anything. It just defines functions and global variables.
The functions contain names that are defined in math, yet they are not referred to via math.random etc., which wouldn't work in python
Like the usage of sin and cos?
and there are other Processing-specific built-in names
or I think I dont understand
@Dominico909 yes
hmm
I see what you mean
00:33
or maybe those are Processing built-ins, but then you don't have to import math
For example I just removed it
and it works
right
at least it doesn't do namespace black magic, that's a plus
is it not a problem that you don't define a position for your planets?
oh, you're only using the Sun's position
Yea, that part was kind of confusing as I need only the suns pos
00:35
you'll probably want to write the magic numbers inside translate() to the coords of TEST_SUN as well
magic numbers?
ohhhhh
it's when you hard-wire numbers which could/should be dynamic
I still don't understand, which exact numbers?
yeah, looking at the rest, I don't see why independent calls to planet_Orbit should interfere, so the problem can easily be Processing-specific
@Dominico909 translate((x-(650/2)), (y-(650/2))) --> translate((x-TEST_SUN.posx), (y-TEST_SUN.posy))
gotcha
that made it not work. Now only the sun appears in the center of the screen
Ok now this is weird
00:40
yup
I am well confused why that would change anything
My mistake it works
maybe the first call to translate() shifts the coordinate system somehow, interfering with the later call
Sorry I had a small typo but fixed it. Now it still does the same thing
no, that's silly, nothing modifies TEST_SUN in the mean time, in principle
@Dominico909 OK:P
anyway, I'm out of ideas
Do you have the program installed?
00:42
nope
Alrighty, I noticed something weird. After uncommenting all the planets, Only mercury orbits in a circular motion but all the other planets orbit in a circular motion with an added (what appears to be) sin or cos wave...
So it's directly showing that each function call affects the next
what if you skip mercury and keep another planet?
it should do the same thing with that planet
which should be due to your global i most likely
The global is gone, I completely removed it and nothing has changed.
Other than the color is now white for every planet, of course.
00:46
why are you multiplying cosval and sinval in x and y with the planet's radius?
Where am I doing that?
line 38-39 in your second pastebin
Increases the size of the cos and sin wave
to make it a bigger orbit
but shouldn't the planets orbit at PLANET.distance_from_sun? :P
And what does translate() do exactly? That might be the problem.
well, I should really word it as distance_relative_to_sun
as it's not really supposed to be just a unit measurement
translate moves an object to a position you specify
00:50
how does it know which object to translate??
since sphere() only takes radius and not the x and y position
^^ the object that is created is translated in that function
that's soooo not definitive
the documentation?
Yea it's pretty bad to be fair
let me try something else
00:51
please do
Whatever magic translate() is doing to determine what to affect, it's doing it different from what you expect
OK
So translate() shifts the global coordinate system somehow? Apparently? Maybe?
> Transformations are cumulative and apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling translate(50, 0) and then translate(20, 0) is the same as translate(70, 0). If translate() is called within draw(), the transformation is reset when the loop begins again. This function can be further controlled by using pushMatrix() and popMatrix().
ahhh
rightttt
let me tinker with that
yup.
Again: if something weird is happening, and something seems to pull in objects to manipulate from thin air, be suspicious.
That's why I started with globals: same thing.
except this is worse than globals
Worse!?
00:54
much
oh brother
it's completely unlike python
I wonder if this push and pop matrix thing can help
I would understand this in, say, TikZ in latex: there clip(...) will affect every subsequent drawing command in the given block (scope). And there it is perfectly well-defined what a scope is.
The thing is, there's a buttload of implicit things going on, which is very alien to python.
I feel like this pop and pushmatrix might help
I don't know the how or why though hehe
wim
wim
01:01
YESSSSSSSSSSSSSSSSSSS
Got it!
However, I don't understand how
good job:P
I had to do
with pushMatrix():
    translate(x-TEST_SUN.posx, y-TEST_SUN.posy)
    sphere(PLANET.radius)
@Dominico909 What package are you using for your graphics?
I am using the Processing language
With python
01:09
@Dominico909 equivalently, you probably have to translate -> sphere -> translate with the inverse
sorry, I haven't been following the entire conversation.
@Dominico909 you should start capitalizing Processing to minimalize the number of misunderstandings
Ah sorry
I've heard of Processing come up in the past, still your original question didn't register to me
01:10
what do you mean by translate with the inverse?
translate(-5, 0) would be the inverse of translate(5, 0)
However, a better solution is probably to push and pop the transformation matrix as appropriate.
Right, I've seen Processing here
@Dominico909 what Code-Apprentice said, and I concur, that pushMatrix is probably the idiomatic approach. For instance, you don't repeat yourself. And it seems to scope translate, which is a very good thing
Can you explain what push and pop do in this instance? I can't seem to understand after looking it up
haha, no:D
> Understanding pushMatrix() and popMatrix() requires understanding the concept of a matrix stack.
you know what to do ^
> pushMatrix() and popMatrix() are used in conjuction with the other transformation functions and may be embedded to control the scope of the transformations.
at least we know that indeed those should be used here
that's all I can help
I'm also off to sleep soon, so pre-emptive rhubarb
Ok thanks :D, Ill study networking then hit the hay
rhubarb
01:20
@Dominico909 Sorry for the delayed reply. I'm alt-tabbing all over the place. If you are familiar with a stack data structure, then pushMatrix() and popMatrix() should be pretty familiar. They simply push and pop the current transformation matrix to/from a specialized stack. They make it relatively easy to save the current state of all accumulated transformations and restore the transformations later.
Note that I am writing from experience with OpenGL, not Processing. It appears that the underlying concepts are the same, though.
Im not familiar but Ill look into it. I understand the basic that if you push an element it is added and visible, whilst popping removes topmost and makes next visible
I just can't comprehend what that serves for in functionality
Why, for example, it made my program work
01:39
What kind of programs would I be able to build, before applying for a job as a Python dev? What kind of concepts should I know?
01:52
@Dominico909 You might want to read about "coordinate systems" in computer graphics. In particular, we learn about the difference between "world coordinates", "camera coordinates", and "local coordinates".
Ok thank you!
pushMatrix() and popMatrix() allow you to design an object in its own coordinate system and then place copies of it inside the world coordinate system.
AHhhhh
for example, if you want a solar system with two stars, you create the star with it's own coordinate system and origin. But then in the world, you use transformations to place them.
actually...planets might be a better example. And moons.
Yea thank you that helped me understand it :D
01:55
And if all of your celestial objects are spheres, then you are just making multiple copies of a sphere.
with different transformations
@Dominico909 glad I can help ;-)
 
3 hours later…
wim
wim
05:10
first!
shit
I didn't sleep long enough it seems
haha I managed to get 100th for the first star
then lost some positions because I accidentally also printed the output for 2nd part :d
another brute force here
a fast solution exists to this problem though
again the n is way too low
mine takes like 5 seconds for 2nd part
phew I am still first on the local leaderboard, for now :D
wim
wim
i'm back on the global leaderboard
wow, marcus is very close behind you, Antti
05:20
:(
I should have gone to bed earlier
I didn't submit wrong answers but it took way too long... I kept typoing in pycharm.
if it weren't for a certain function in my helpers I wouldn't have made any points today :d
wim
wim
@Code-Apprentice wat? marcus is way ahead
On the sopython board
@wim in local stars :D
wim
wim
oh
I hate these types of problems. I was ranked fourth for the first part of the bots puzzle... because it was totally of the "wtf" kind...
wim
wim
the bots one was my favourite
good for imperative programming style
ah this is how to do this in binary hmhm.
05:47
How to do what in binary
do you get points for each part or only for completing both?
you get points for each I think
@AnttiHaapala guess what I'm watching right now?
R1?
ANH?
hahaa much faster
close
already saw R1 yesterday
05:54
TFA?
sw holiday special?
and I wouldn't be chatting in the theater =p
are you doing that on purpose? lol
Rogue One worth seeing?
if you liked the original trilogy, especially then.
"Whoever didn't love episode 7 for any reason. This is your movie."
the fan service is raised to the next level
like the comedic relief says: "I have a bad fee" ... "oh shut up"
but yea, it is now an essential prologue to ANH
I liked it
If I call a generator directly does yield act like return?
wat, you don't call a generator directly...
well, you will call the name once to start it...
after which yield yields successive values from the generator.
and return ends the generator.
06:08
I was just thinking about calling it directly to test the first iteration. I guess I can use iter() and a single call to next() to get the same result.
def my_generator(limit):
    for i in range(limit + 1):
        yield i

g = my_generator(3)
print(next(g)) #0
print(next(g)) #1
print(next(g)) #2
print(next(g)) #3
print(next(g)) #StopIteration error
thanks for the illustration
I think I was confused about how to use a generator manually. I think I have only used them in a for loop.
wim
wim
are you doing today's AoC ?
I used generators too (spoiler)
@MarcusS why are you putting all your code in different subdirectories? that's weird
06:28
Now I need a generator that applies its algorithm to the output of the previous result.
And starts with a seed result, of course.
lol numpy slower than all python...
or I can't numpy this.
@wim shrug, comparmentalization
I should probably use spoilers even when I don't mention AoC in my question, eh?
this wasn't my first solution but it is much faster now, 0.876 s cpu
would be much faster if there was a popcnt in python
Something weird is happening
Can anyone try the input ^^^^......^...^..^....^^^.^^^.^.^^^^^^..^...^^...^^^.^^....^..^^^.^.^^...^.^...^‌​^.^^^.^^^^.^^.^..^.^ for both parts
06:40
@MarcusS
there :P
repr it
'^^^^......^...^..^....^^^.^^^.^.^^^^^^..^...^^...^^^.^^....^..^^^.^.^^...^.^..‌​.^\u200c\u200b^.^^^.^^^^.^^.^..^.^'
wim
wim
oh you did a binary one, cool
wim
wim
why don't you guys try aocd
I think Antti is the only one using it
I promise you it's much nicer than copy/pasting your data into files and reading files
wim
wim
@MarcusS but you already get that for the module namespace, no need to have a directory as well
06:43
there are zerowidth characters to enforce breaks after n consecutive chars
I get [1978, 2001938] but when I look back on the AoC website it says "Your puzzle answer was 20003246."
80 in that case
@MarcusS you copied it from reddit that adds unicode wordbreaks after 80 consecutive non-space characters.
I'm not on reddit atm -- I copied it from my data file
ok, so those breaks just came from stack overflow :D
Day 18 part 1
answer 1978
Day 18 part 2
answer 20003246
I must have bugged something then when I simplified my code
thanks
06:49
Hello
@MarcusS is there a fast solution?
I wouldn't be too sure...
Just realized what I was doing wrong -- was using 40000 instead of 400000 for that recent test, d'oh
code is fine
yay! I got it!
Probably not the most pythonic solution...but it works
@AnttiHaapala Yes, there's a fast solution
@MarcusS I did the same thing. That's what we get for not copying and pasting.
06:59
@AnttiHaapala Speaking of which, if you're interested in seeing a fast way to do 16, that one is possible too: day 16 faster
@Code-Apprentice Yeah, ackk
headache :D
Did anyone hear about Carrie Fischer's recent memoir? She published a journal that she kept while filming the movies.
I haven't read it yet, but I listened to a podcast interview with her. She writes for the first time about an affair with Harrison Ford.
07:25
Okay, I tweaked my solution a little to be slightly more pythonic
 
2 hours later…
 
1 hour later…
10:34
Cabbage
cabbage
10:48
I got a comment today from the OP of a question I hammered a week ago. I even waited to hammer it until I got positive feedback from the OP. But now he's complaining that his problem's still not solved. :grumble: So I left him a couple of comments. stackoverflow.com/questions/41084058/…
11:44
@AndrasDeak Funlandia <3
@AndrasDeak Chancellor of Justice which is a sort of independent organ in Finland, the watchman of government, is complaining that the government is passing initiatives into parliament that are against the constitution / didn't go through the constitutional committee that decides whether they comply with the constitution or not...
@AndrasDeak so, a cabinet representative replied that the cabinet is now so busy and they have this political agenda set forth and set in stone that they do not have time for such minutiae as debating the constitutionality of new laws...
haha, rings a bell:D
except in Hungary they'd just change the constitution
and... we do not have a constitutional court at all
it's not in the power of the government in itself.
one needs 2/3 of parliamentary votes and 2 sessions with one elections in between to change the constitution
but ignoring the constitution just requires 51 % of the votes, some bought media and passive public
"2 sessions with one elections in between", sounds handy
11:52
ah wait, I will get the exact wording, it is not that long
OK
btw I stole your bit check approach for today's AoC:P
I needlessly overcomplicated mine originally
Procedure for constitutional enactment

A proposal on the enactment, amendment or repeal of the Constitution or on the enactment of a limited derogation of the Constitution shall in the second reading be left in abeyance, by a majority of the votes cast, until the first parliamentary session following parliamentary elections. The proposal shall then, once the Committee has issued its report, be adopted without material alterations in one reading in a plenary session by a decision supported by at least two thirds of the votes cast. However, the proposal may be declared urgent by a decision t
yeah, 5/6 is a lot
no way they have 5/6... but as always it just requires 51 % in the vote of confidence if you ignore it altogether.
so now there are some professors of justice demanding the immediate resignation of the cabinet...
yup
good luck with that:P
11:58
@AndrasDeak as always, the national broadcaster is silent... even though this is supposed to be one of the things that it should report foremost in all news...
you're seeing things:PP
after all its is of people/parliament, not government.
@AndrasDeak so wanna move to finland? :D
oh, you have a veeeeery long way to go for that to be a "no" :D
well, bottom line is "no", but not because of your political stuff
if I were into rebasing, Finland would be top on my list (if I could ignore stuff such as not speaking the local language)
12:16
morning quick cabbage - github.com/gboeing/pynamical might be interesting to the data science-y folks around here
12:28
"Oh, nice trick with these matplotlib legends, just what I needed. Oh, maybe I should upvote. Oh, @DSM wrote this!"
@AndrasDeak at least you didn't
yeah, I stopped myself just in time
and now I have the weirdest colouring bug in matplotlib, grumble
http://pastebin.com/YPmBDy3J
how do i resolve this "inconsistent tab" error on line 28
@jagdish you fix your indentation to use 4 spaces exclusively...
i was trying to resolve it for an hour...Thanks by the way @ŁukaszRogalski
12:46
and grab pep8 or pyflakes (or both) and run that on your code
as it turns out, if you don't actually setup SaltStack to manage your nginx.conf, it won't manage your nginx.conf
Who knew??

« first day (2255 days earlier)      last day (2918 days later) »