« first day (1681 days earlier)      last day (3260 days later) » 
00:00 - 12:0012:00 - 00:00

12:07 AM
I lovveee bay leaves
 
roasted marshmallow
Eating one right now....
 
@PeterVaro I was playing around with fontconfig, and updated to fontconfig-infinality-ultimate from the wiki, and fonts look even better than with regular infinality
 
Mhmmm
I'm sitting at work...
 
12:23 AM
@AlexanderHuszagh, why are you sitting at work?
 
I work in a mass spec lab
Told my boss I'd have stuff on Monday
 
mass spec? Monday? Monday's a holiday!
That means you can do it next Monday!
right?
:)
 
:D
Oooh yeah
And mass spec means mass spectrometry
High throughput datasets
Which our lab used to crunch manually
I said "Nope, not doing it"
I... uhhh.... there has to be a better way of doing this.
And I know the answer is "restructure your code"

# old list of indexes, and new
# data is paired...
old = [0,1,2,3,4,5]
new = [3,4,1,2,5, 0]
convert = {i: new.index(i) for i in old}

# values to sort in place
a = [2, 3, 1, 5, 4, 6]
b = copy.copy(a)

a.sort(key=lambda x: convert.get(old[b.index(x)]))
Eh, that is the answer, so I'll do just that.
 
12:41 AM
Done, that was way easier than I should have made it.
 
copy.copy?
b = a[:] you mean?
you get a new list when you pass one to sorted though
 
Yeah, the problem was is I had most of my items in a namedtuple
So I was trying to sort a in place based on the value at an index in another list.
Which means: restructure because doing that sounds silly
 
1:12 AM
ok so I have two data frames with only float values but they wont add, they only concatenate?
 
Are you doing df.add?
 
no just df.b + df.c
 
Should still work, got an example?
Are the index/columns identical?
 
@AlexanderHuszagh how do i show python examples is there an online ipython or something
 
1:30 AM
Umm there is, but I'm not sure if collaborative.
 
2:16 AM
Anyone on?
 
@michaelpri I am, just ask a question if you have one though
 
I am slightly
 
@grasshopper I don't have a question, just bored
 
@michaelpri oh my bad, what are you working on now?
 
@grasshopper Working on an answer for this Health SE question, hbu?
 
2:23 AM
Oooh
Hydrogen Peroxide? Seriously?
Some people believe the darndest things.
 
2:38 AM
What do you all think about this?
 
2:53 AM
hmm.... I set n to 500 and it took 15minutes and gave me an oob_score_ of 0 is that normal?
 
3:46 AM
Greetings.
 
@Christine Hey
 
@michaelpri Hey
 
What's up?
 
Well, I'm just taking a break. I'm frustrated w/some code
How's it going in here?
 
It's pretty slow right now
 
3:49 AM
ah
Well, Saturday night (in the US) and all.
 
Plus it's Memorial Day weekend
 
ahhh right
Okay so, I'm gonna ask a question
Maybe someone will have the answer at some point.
 
On SO?
 
I'm getting a RuntimeError:
yeah, just here
I may ask there in a bit -- if I can't find the answer by reading up
 
What does your program do?
 
3:52 AM
but this runtime error says "maximum recursion depth exceeded while calling a Python object"
so from what I'm reading, I need to change it from recursion to irative
sorry, iterative
I'm scraping about 3000 pages.
everything runs smoothly...'cept for that.
 
Are you using a recursive function?
 
yeah, see, I don't know the difference
what makes something recursive?
I create a list [] of links then go back over them, open them, and scrape the pages.
 
I think you're hitting an infinite recursion
 
I am
but I don't know how to change it
I'm reading about it (thanks for the link, btw)
but it's not sinking in.
 
Yeah, I'm not good with recursion. I prefer iteration
 
4:00 AM
I thought that that's what I had written
but since I obviously don't get the difference...
 
Hey Jon
 
@JonClements cbg
 
Cabbage Puppy :-)
 
cbg pups :)
 
4:11 AM
Hows your 04:00? :D
 
lol... it's 0511 :)
 
Its 09:42 in India. I am supposed to reduce 05:30, right? So, it should be somewhere around 04:15?
 
just checking out a server text alert thingy - then errr, back to laying down me thinks :p
 
@michaelpri I think I'm just gonna break it up into pieces so it doesn't hit the max rec depth
cuz I can't figure out how to change it to iterative
 
@Christine sounds like you should re-write it to be iterative rather than recursive :)
 
4:14 AM
I would if I could. Been reading.
@JonClements - good advice, indeed.
 
A quick hack that might work for you - although not recommended is to temporarily increase the stack limit
 
@JonClements Yes, I've read that. They also warn against it. I'm afraid of doing more hard than good (harm that I would not be able to fix so easily).
I have about 3000+ pages to scrape and I make it to page 285.
 
Umm.... are you using a framework such as scrapy?
@thefourtheye Ahhh... we're in BST now - not GMT :p
 
Oh. I didn't know that :-)
 
I still haven't quite grokked why we change forward/back an hour each year either :)
(think it's something to do with farming or something...)
 
4:21 AM
@JonClements I'm using python/selenium/sublime. No scrapy.
What's the deal with scrapy, anyway? Why would one want to use it?
 
@Christine ahhh... so you need to automate a browser to get JS content or something?
 
@JonClements yeah, you can see an older version of the code here: stackoverflow.com/questions/30365315/…
I'm just grabbing pages for research
it's all running smoothly (the code I have now) - I'm just up against this RuntimeError now
frustrating
It happens when I iterate over urls
 
well - wouldn't happen if you were iterating... :)
 
indeed
:)
 
Most useless comment ever but oh well :)
 
4:30 AM
lol
 
@Ffisegydd cbg?
 
@Ffisegydd cbg
 
This guy is amazing
Note that if two elements of l are equal, this will compare the elements of l2 to determine the order. This may be undesirable, especially on Python 3, where trying to compare semantically unordered types will produce an exception. If this is a problem, you can use [z for x, y, z in sorted(zip(l, range(len(l)), l2)] to avoid comparing elements of l2. — user2357112 6 mins ago
 
4:58 AM
ahh... there we go - freed 90gb of space.... shouldn't get an alert from that server again
 
nice
 
hopefully it wasn't anything important :)
 
hoping on your behalf
:)
 
melon :)
 
Wow....
Oh cbg :D
 
5:14 AM
I was waiting for the rest of the "Wow..." :p
 
me too
watermelon :)
 
okay. I think I might have to post this. ARg.
 
I found out that cairo-dock was chewing up a gig of ram
After I enabled a compositor...
 
@Alexander darn... thought the "wow" was going to be that you'd just discovered faster than light travel or something :)
 
5:21 AM
@JonClements I know, that's pretty dull for a wow...
 
I'll let you off this once :p
 
Fine, I'll discover time travel next.
 
ahh... don't worry about that one - leave it to your future self
if he discovers it - he'll let you know
work sorted - not usually up until 10am on Sunday
so - rbrb for now
 
5:37 AM
@JonClements Rhubarb
 
6:22 AM
Have good sleep Puppy
 
@thefourtheye what is puppy?
 
6:45 AM
Hey up
 
7:05 AM
@Christine @JonClements is a puppy and who is also an evil overlord
 
"evil" - definitely not - "overlord" - I might warm to that "title" - you're the evil twin don't forget :)
 
You are supposed to be sleeping Puppy :D
OMG! EnglishMaster is in the JS room :O :O :O
 
Guys, I have a question
Let's say your site admin is set to accessible only by your company ip-address to enhance its security.
However, as an site-admin, you've decided to leave a dirty way to access your admin just in case of the site lock-out your company IP (You were typing in password while heavily drunk and blacklisted yourself because you've entered wrong password for 5 times). Do you think this is a good idea?
Why did you just kick me?
 
7:27 AM
Hello everyone
 
@EnglishMaster how are you ?
 
I got really confused about something today in Python
 
what is it
 
7:30 AM
@direprobs Hi, welcome to the room :-) Please take sometime to read about this room. And you can just directly ask your question :-)
 
It's against the rule to discuss a question here ?
 
Not like that :-) Its perfectly okay to ask your questions here.
 
Oops I already deleted what I've typed for the question
 
Normally, if a question doesn't fit in SO's quality standards, you can feel free to discuss that in the chat rooms :-)
 
Among the great advantages for iterators that they save memory, but thinking about sequences, technically, for loops uses iterators to traverse them. But that wouldn't save the memory as the sequence physically exists on the RAM.
 
7:39 AM
When we say iterators, they just follow the iterator protocol. If a sequence doesn't follow the protocol, we will not be able to iterate it.
 
@davidism well, I'm not sure, if I already have that one installed or not.. but thanks for the heads up, will try it on thuesday, once I get back to my beloved arch-machine :)
 
No, it follows the normal protocol, 'it = iter(list) -> next(it).... StopIteration' , assume when have a list of L = [1,2,3] the list itself exists on Ram, but the for loop won't save memory if it calls iter(L) as the list already exists. So in terms of sequences iterators won't save memory ?!
 
Iterators are not for saving the memory actually. Their purpose is to allow iterating an object.
 
In other words, sometimes they do and sometimes they don't. For example, in generator functions, they do save mem for large tasks (e.g. computation) same for generator comprehension.
 
7:47 AM
Generators follow Iterator protocol, but its not because of that the memory is saved.
 
How is that ?
 
Whenever the next function is called on an iterable object, the next value will be given bu that iterable object. If it is a sequence, the value is already created and in RAM, if it is a generator, the value will be created and returned.
afk for a bit
 
Then I misinterpreted the traversal functionality ( iterators) and generators
Both of seqs and generator have differing iterator objects for traversal only.
 
You might want to check this
63
Q: Understanding Python's iterator, iterable, and iteration protocols -- what exactly are they?

c.had1990What are the most basic definitions of "iterable", "iterator" and "iteration" in Python? I've read multiple definitions but their exact meaning still won't sink in. Can someone please help me with the basic idea?

 
I already did
 
7:56 AM
Hi guys
Does anyone here have Python AND java experience?
 
If having written a few lines counts, I might.
 
http://stackoverflow.com/questions/30412391/maximum-independent-set-weight/30412929#30412929

For the solution given in this question, I was was wondering how it could be written in Java
 
Files are there own iterators, and when they're opened with (open) function are they stacked into memory at once ? I don't think so, and their iterator object load one line per next(), but I think there iterators load the lines from the disk directly, correct ?
 
In particular, how I would deal with the function returning 2 values (as Java only allows one return value)
 
You can return an array
... or even a tiny class instance, though then it helps if you already have right type lying around.
 
8:02 AM
javafx.util.Pair @cp101020304
 
@JanDvorak in the link, is the "weights" variable an array?
@vaultah cheers, will look into it
 
What else?
 
@cp101020304 Warning: I know nothing about Java and just googled "tuples in Java"
 
@direprobs Files buffer the data actually
 
@vaultah JavaFX != Java
 
8:05 AM
@JanDvorak Found this
 
though it is easy to implement a Pair yourself
@vaultah nice
 
@JanDvorak as you can tell, i'm not familiar with python. I'm really stumped on how I would even begin to write the java solution, any ideas?
 
@thefourtheye, True, but internally file objects don't stack chars in mem and use pointers to refer to the location in the file ?
 
From a quick survey the code looks rather straightforward to implement in Java
 
I literally know nothing about Python
Is it a recursive function?
 
8:08 AM
Looks like. You can have private static methods in Java.
 
@direprobs File objects read chunks of data and when you iterate them they will return one line at a time.
 
return (weights[i] + left[1] + right[1],
                    max(left) + max(right))
Where do those values get stored? I mean what index of "weights"?
 
They get packed into a pair, then returned from the function.
 
and then what happens to this information once its returned?
 
One such pair is stored to left and one to right
 
8:14 AM
@thefourtheye, Aha ! you mean up until specific bytes, but basically not all the bytes. Once specific number of bytes pulled out (exhausted), another are loaded in mem to speed up the process, correct ?
 
Then left and right are fed into max
 
If I show you my attempted java implementation, would you be able to tell me what I've done wrong?
 
@direprobs Exactly ;-)
 
Not sure what the actual type is in Python, but it should be clear what max does with it
@cp101020304 do show
 
give me a sec, i'll put it on pastebin
 
8:17 AM
@thefourtheye Thanks :-)
 
@direprobs You are welcome :-)
 
Technically the only language I know that can return multiple values is Lisp. The others just have a fancy syntax for returning an array and destructuring assignments.
 
I used the algorithm from this link on page 19 btw : cse.psu.edu/~sxr48/cse565/lecture-notes/…
 
Heh, nice cartoon
 
8:20 AM
Doesn't look like the same algorithm as in the answer at all
 
^^^ I used the link above
pg 19
 
I'm reading through the PDF
 
@JanDvorak appreciate you taking the time to help :)
 
@thefortheye thank you for the puppy clarification!
 
Why not implement what is on page 20 instead?
Seems much easier.
 
8:31 AM
I don't know what it means :/
 
Paragraph "Independent Set on Trees: Algorithm" shows a short pseudocode that looks simpler (and faster) than what you have
 
Oh, that is page 19
That's what I was referring to sorry, it shows up as page 19 on my browser
That's also what my code is based on
 
I'm not sure what the number means when there are multiple pages on the screen. I thought it referred to the topmost visible page
 
How is my code different from that algorithm? I thought i implemented it exactly as it says
 
Sorry, missed the "in postorder" part of their spec. Ideally you'd have the leaves already stored in a topological ordering, though
meaning you can just loop over the array backwards
 
8:38 AM
So the code I have is correct?
 
Not sure what left_index and right_index are. Are you MWSing over a balanced binary tree?
 
left_index and right_index are the left and right children of the node at index
i'm MWSing over a complete tree
can be balanced or unbalanced
 
Are you sure you need the first two special cases?
 
nope, I just put those in to see if they made a difference. You can take them out if you'd like
 
They shouldn't hurt, though.
 
8:42 AM
Yeah, I mean they're quite trivial
 
Maybe you should add some comments about what the index contitions tell us about the position in the tree
 
Doing that now, will post updated pastebin link
 
Looks valid to me. I'm not a big fan of the variable names, though. s/tree/weights/
 
It doesn't work for the tree represented by [1,8,3,19,2,25]
output is 46, when its supposed to be 47
 
Print the M_in and M_out at each node and compare to the expectations
 
For the tree i just mentioned, it gives an answer which is a MWS excluding the node, when it should give the MWS including the node
I have tried to debug it, but can't seem to pinpoint the issue
 
You don't need the recursion here, just iterate over the indices backwards
 
How?
 
good old for..i
 
of course :P give me a second, I'll give it a crack
It's 47; 1+ 19 + 2 + 25
pastebin.com/jav97ker This is the for loop I have right now, but I'm not sure where to go from here..
 
8:59 AM
Rhubarb peaches and pears.
And goodnight.
 
I've just simulated the algorithm by hand and it returns 47; time to recheck your boundary conditions
 
Did you simulate the algorithm in the pdf or the one I have implemented?
 
The one in PDF
 
I honestly can't see which boundary condition is incorrect o.O
 
L11 is redundant. If the right index equals length, the left index is surely below the length
similarly L16 can be simplified
Your practice of returning multiple values trough side effects is really dodgy
 
9:04 AM
I made the changes you said in L11 and 16, but I still get 46 as my output
@JanDvorak what do you mean?
 
Your function both returns a value and stores some data to a persistent array. That's kinda confusing and can easily lead to bugs that only manifest depending on previous calls.
 
How would you suggest I do it?
 
Have you printed out M_in and M_out and looked at where they diverge from expectations?
L26/L27 duplicates ?30. If I were golfing I'd be sure as hell to exploit it :-D
Are you sure you're not outputting M_out[0] instead of the return value?
 
@JanDvorak I'm printing M_in and M_out right now
 
about time ;-)
 
9:13 AM
@JanDvorak When index is 0 M_in is 22
When index is 0 M_out is 46
It is supposed to be 23 and 47
 
M_in is incorrect, then
Uh, no
It should be 47 and 46
 
The code for M_in seems correct though...
 
M_in[0] = M_out[1] + M_out[2] + tree[0]
are M_out correct at that point?
 
I went through my entire program last night with pen and paper (old school I know) and my M_out[1] is 21 and M_out[2] is 0
 
M_out[2] should be 25
That node has a left child, #5
Bug at lines 12 and 13
 
9:20 AM
Should it be M_out on the first line instead of M_in?
 
Nope. Think about what they mean
 
M_in is the MWS including the node, so the MWS would be just the node itself?
so M_in = tree[index]
 
check
 
and M_out is tree[left_index]?
checking
 
and check
 
9:24 AM
it
works
do you know how long this took me to solve
praise the lord
and Jan Dvorak
thank you good sir
 
I guess I should implement this in Haskell, too
 
Haskell?
 
One great thing about Haskell is that it essentially forces you to write clean code
 
not like python ?
Python doesn't force users to write clean code ?
 
Since you don't have mutable variables, you can't pollute the global scope with them.
 
9:27 AM
This is a common catch for newbies in Python
 
Python lets you return though side-effects. Haskell doesn't.
 
We would argue in our life-span about prog langs philosophies. No perfect lang
 
Haskell ranks pretty high, though. Its motto is "if it compiles, it's probably correct"
 
What is Haskell used for mostly?
 
It fits well with mathy stuff
or anywhere you want strong compile-time checks
You really have to go out of your way to write unsafe code
 
9:34 AM
I guess for a beginner such as myself, that isn't a very uncommon thing haha
 
I mean, if you want I/O side effects, you have to mark your function as IO sth. And then you can chain it with other IO actions, but you can't just do something when a function is evaluated
 
I learned C first as my 1st lang
Then I moved to Python
I wasn't that good in C indeed, but after learning Python, this is good !
 
The functional paradigm is a great thing to learn, too
 
@direprobs Same, but when I started learning C in university, we were only taught the real BASICS (static memory allocation problems and such)
It's really quite a hard language to be proficient at
 
@cp101020304 C for beginners is a little bit tough, it works down to the iron, unlike Python
 
9:39 AM
I love Assembly programming, though
 
@direprobs Yeah I think that's why we were introduced to it as the first language. So that once we get exposed to other languages, it's seemingly easier, comparatively
 
What's fun - design your own microcontroller, then write your own microcode for it, microoptimise it, and then compile down to a list of hex values.
 
I think so, but practice is important, the problem with C, you wouldn't find new books for it and if you did you won't find many exercises online, they're all too advanced or too basic. You really can't compare the sources where you can learn Python with C. C lacks these resources, especially for newbies.
@JanDvorak agree
 
@JanDvorak We're actually learning GCC right now, although maybe not as difficult as designing our own microcontroller
@direprobs Agree, whenever I was stuck with a problem when writing C code and I tried googling, I'd stumble across the most difficult to understand answers
 
It isn't hard. The simplest version just has [next-address, condition-to-test, control-output] on each line, where the condition just supplies the lowest bit of next-address.
 
9:45 AM
Maybe we'll get introduced to it in Stage 3 :)
 
A slightly more complex version just includes an extra ROM as a decoding/decompression stage for the control-output
The simplest microcontroller is just a ROM and a clock
 
There's a lang similar to C, that's called D
 
I actually had to take a second to think about whether you were being sarcastic, then a google search concluded that D actually does exist
maybe sarcastic wasn't the right word
"taking the piss" more like
 
@cp101020304 no, I wasn't
By the way, it's not that strong as C is.
Still has lots of ups and downs, you really can't relay on it yet
 
Is Ruby similar to C?
in terms of strength
 
9:52 AM
It's way more high-level
 
No, C and C++ can take you down the iron.
 
Is Python similar to Ruby in terms of strength?
 
Almost, it depends on what you mean by strength ?
 
highlevelness
 
In some forms, but not like C or C++ at all
 
9:55 AM
How's it doing in terms of FP primitives?
 
Generally high-level means easier language to learn right?
 
easier to use
 
Technically, yes, high level languages don't delve into details like mem, allocation etc..
You get most of things for free
like mem management, you have to do it yourself, but in higher langs you don't !
 
I almost want to go back to C
 
why?
 
10:00 AM
Seems like theres SO much more that I don't know about. Being exposed to the static memory allocation part of it really doesn't teach you much about the language apart from syntactic correctness
but then again I don't want to do my own memory management because I'm lazy like that
:P
 
Do check out Haskell
 
I suggest you master Python and then learn C if you want to go back to it or vice versa, if your master one lang the other becomes easier and so on
 
a little secret: I don't know any Python whatsoever :D
 
Just don't delve into details about programming langs, I used to do that, no lang is perfect.
 
Can I be recommended a REPL for Python?
Actually codewars supports Python. Perhaps I'll do my learning this way
 
10:09 AM
Anyway lads, I'll be off. It's quite late here
Thank you @JanDvorak for your time again :)
 
I've recently heard of pony
 
pony ?
It's real
 
First kata: got caught up by integer division vs. float division
 
 
1 hour later…
11:43 AM
Cbg
Playing with a bit of D3
D3+jsfiddle=fun
 
@Robert awesome. I love D3.
 
Just got to get my head round how it works a bit more, but I really like how generic it is
 
Downvote the answer -> Wait until the poster comments "why down vote ??" -> Flag the comment as not constructive -> Remove the downvote. Free flags!
 
11:59 AM
This year's Radio 1's Big Weekend is fantastic
 
00:00 - 12:0012:00 - 00:00

« first day (1681 days earlier)      last day (3260 days later) »