« first day (2772 days earlier)      last day (2176 days later) » 

12:37 AM
@OlivierMelançon This looks too deep to dive into during a compile-cycle break at work, but interesting enough to look at some time this weekend if you don’t get an answer by then (or to read what someone else comes up with, if they get there first), so I’ll just favorite it and come back later.
 
12:54 AM
Hurrah :D
 
A question on Enum with an answer from Ethan looks worth a favorite to read later, too.
A couple weeks ago, I was playing with my old pattern-matching-case hack to see if dataclass is sufficiently restricted that it can be treated as ADTs, and it isn't. So the next step is to see if I can add build Swift-style enum-with-value types and use those as ADTs. Because trying to do it for arbitrary Python classes with a __match__ protocol was a really distracting rabbit hole.
 
1:31 AM
@coldspeed One of the few ways where American != extreme. In Asia, it seems like the last time any road had light enough traffic for anyone to reach half the posted limit was 1973, so it never comes up. In Europe, on the other hand, 10mph under is no worse than 10mph over; if you're driving in the left lane at any speed < c that's infinitely unacceptable. So it's only in America where the difference between a little under and a little over matters.
Google Cloud Datastore filters do not have a != option. You can filter on any of >, >=, < <=, or =. If you want to do !=, you're supposed to do one < query and one > query and merge the results. Seriously? I cannot process this; I'm done coding until Monday.
 
In python 3.5 if you call dct.keys() and dct.values(), will they be guaranteed to be in the same order relative to each other?
I haven't had it not happen yet, but better safe than sorry
 
2:04 AM
As long as you don't mutate anything, then yes, they are guaranteed to be in the same order.
> If keys, values and items views are iterated over with no intervening modifications to the dictionary, the order of items will directly correspond. This allows the creation of (value, key) pairs using zip(): pairs = zip(d.values(), d.keys()). Another way to create the same list is pairs = [(v, k) for (k, v) in d.items()].
 
2:57 AM
Greetings! I have been thinking about a numpy problem of assigning values of randomly spaced grids to a regularly spaced grid. Would appreciate if some one could have a look at this link: stackoverflow.com/questions/50421049/…
 
Please don't link recently asked questions in chat. They have to be > 48 hours old before it is acceptable to link them here.
Check out the room rules here sopython.com/chatroom if you have any further questions
 
@konstant were you able to figure out the solution to this?
einsum is like a silver bullet for really pro numpy-istas who're too lazy to type
 
Not really. I just used the idea of hpaulj, and it kind of worked for now.
@chrisz Sorry, I wanted to remove the comment, but can't delete it anymore.
 
@konstant interesting. What was your end goal?
Are you trying to write a compiler that can compile numpy code to numexpr code so it can run % faster than it usually would?
because that is really hard and really cool at the same time
 
3:14 AM
My main goal was avoiding intermediate storages, so as to save memory. And, yes, I was also hoping to enhance the computational speed.
 
 
1 hour later…
4:34 AM
0/
 
\0
 
sup?
 
\0/
 
/dev/\0
 
@coldspeed nice xD
 
5:06 AM
cbg
 
5:51 AM
cbg
 
cbg
 
cbg
 
hows ya day going?
 
midnight cabbage
 
6:31 AM
cbg
 
6:45 AM
I should not be answering questions on site like these. It's a massive black hole of procrastination xD. This is why I delayed making an account for many years..
 
@Cosmo yep, you should really know when to stop, or even start for that matter.
 
I was born without that gene, lol.
 
you get better, it's worth the effort
 
It's part of what makes me a good developer though, as it manifests an endless tenacity when I need it to.
 
Is StackOverflow really a procrastionation device for you @Cosmo?
 
6:50 AM
I do consider it skills development it's just, terrible prioritisation on my part. Tbh I just want enough points to access chat stuff on some other exchanges rn though xD
@Mulliganaceous Yep.
 
Even I got addicted to StackOverflow. Even though I am top 0.5 this week (it is nearly ending), I don't consider myself as a high-level programmer.
I am a Tr00 Kvlt Compsi Reject!
 
black holes have that effect on people
 
Today I did some dude's basic terminology research for him: ai.stackexchange.com/questions/6446/…
 
Spent 15 minutes finding the answer, 1.5 hours formulating my response and the links for it
I'm clearly insane
 
6:53 AM
Quite a long answer! Sadly I cannot upvote here because I haven't got into that site yet!
@Cosmo, how active have you been this week?
 
Haha no worries. I don't really know if it's a good answer yet tbh
On SO? Not very
 
What happened?
 
I haven't made any new posts since we met, been trying to not procrastinate xD
Today I need to be researching some java stuff for an assignment
I feel like the gradient descent example was probably unneccessary in my answer, now
 
I will be less active next week
Will do some housekeeping on my account, this week was the best so far
 
nice
@W.Dodge indeed
 
6:59 AM
Remember this question: stackoverflow.com/questions/50310731/… @Cosmo
I need to find a way to improve it to reopen
 
Yeah, I was expecting it to get closed
you could possibly narrow it down to asking whether or not a specific justification for link lists in other languages applies to Python?
 
How about narrow it down to "Why some languages like Java or C++ provide buitl in linked list structures?
 
@Cosmo still technically opinion based, it's an interesting question at any rate
 
Yes, it's an interesting question, and I really don't know how to get it reopened, tbh
 
Interestingly enough I am quite sucky at asking questions. Better at answering
 
7:06 AM
How exactly is "Why doesn't X have feature Y?" opinion-based?
 
It is probably one of the most interesting questions I've considered. Sadly it still needs editing.
 
@Aran-Fey It invites /answers/ are inherently opinion based. Like "Linked Lists are usually a horrible idea" from the second comment on the OP for that Q
I don't really expose to see answers better than what we already have, tbh
 
And I invited an extremely long answer from a >100k user
 
Then down- and delete-vote those answers. Don't punish the question for that by closing it
 
We didn't close-vote it, Aran-Fey. I'm guessing it got closed after a lot of low quailty answers flooded in
 
7:14 AM
IT only invited one answer. I am finding an appropriate resolve to improve it to be non-opinion based
 
Well, you have my reopen vote
 
oh. ok
 
I think it is perfect as it stands
One good question but outside the scope of the site and one detailed response
 
It is a little controversial right now though it does attract more views. I need to edit the question a bit
But I am kinda indecisive.
 
Maybe something that focuses more on answers that relate to historical activity on the issuemight be more acceptable under the rules
 
7:17 AM
If this guy can ask "Why does the requests library have a __cake__ constant?" and get 9 upvotes for it, then you sure as heck should be allowed to ask "Why doesn't python have a linked list?" without getting it closed
 
That is a very good point
 
hahahahaha.
(I will work on that closed question maybe sometime in the long weekend)
And will promptly be on chat once I declared what I will edit
 
7:35 AM
alrighty
 
what is your favorite stackexchange site
(I will say goodbye in around 12 min)
 
Uh not sure
probably SO
I haven't spent as much time on the others (inculding before I made the account)
 
I might go to Math or Computer Science
but right now I will stay at SO
 
Ah yeah
Wait there's a Computer Science?
 
guess how much rep did I have when I last talked here
@cosmo
Yes, but that is for the theoretical stuff and is much smaller than SO
 
7:38 AM
700
There's a couple of questions I'm tempted to ask on AI but I mainly want to ask because I don't have the time to look into them so they aren't going to be well researched and therefore are low quality questions :c
 
I would say around 640
 
pretty close ;P
 
Sure. (It is now time for me to say goodbye. See ya in the long weekend. Will you be available in chat)
 
See you! Uh, it is Saturday here, I'll be on less over the coming days
 
You live in australia, I live in Canada, so we are very distant. We are on opposite sides of the world!
 
7:58 AM
Ah, roughly 15-18 hours apart, depending on daylight savings iirc
 
 
1 hour later…
9:06 AM
Ahhhh I did it again xD
 
 
1 hour later…
10:08 AM
@Aran-Fey that;s not how it works. If a question can likely only be answered by a language dev with anecdotal evidence, it's opinionated
Funnily all answers are opinion-based
 
I don't agree with that. If it's possible to give an objective answer, don't bash the question for "attracting" opinion-based answers
That's like telling rape victims to dress more modestly so they won't attract rapists
 
Nope
Or, downvote all the opinionated answers and flag them as VLQ if you believe that
You can't claim both that the question is fine and its opinionated answers are fine
 
hello i a bilal new with python new here with you :)
 
cbg
 
10:24 AM
@AndrasDeak I think you're using "opinionated" as "not based on facts" now. Neither "I guess" nor "it seems to be" is an opinion. You're right that the answers aren't good, but they're not opinionated.
 
cbg
@chrisz I really think reverse_reverse should be in a ChaChaSlide class
 
I need to stop doing people's homework for them. I'm usually better than that, but I've been in this airport for 6 hours and I'm dying of boredom
Yea I'm deleting the recursion one
I really should have named it reverse_recurse, would have been catchier
 
Eh, I wasn't suggesting you deleted it, just that I immediately got the Cha Cha Slide song in my head when I saw your function name :P
 
Honestly my answer was just low quality
 
Why have you been stuck for 6 hours? Is that hell likely to end soon?
 
10:38 AM
Boarding now
 
Ah, safe flight :)
 
I took a large flight voucher to get bumped off a previous flight
 
@Aran-Fey I guess we do disagree
 
That's just, like, your opinion :P
 
From someone coming from PHP : "So I looked into Python it has many job offers but there are some things about it that look so sketchy like using underscore prefix instead of access modifiers".
 
10:50 AM
@Aran-Fey I guess :P
 
@roganjosh I mean, he's not wrong, but he's also not right, at all. Sketchy isn't a bad description of Python, IMO. But at the same time, access modifiers are just sugar, and _ is an explicit "use at your own damn risk" - even before I knew what an access modifier was I saw _ in library code and was like "Hm, that seems a bit odd, better not mess with it" - this was 10 years ago, btw
But also, the idea that php implements access modifiers somehow feels wrong to me
is it even possible in normal servers to have persistant background php scripts?
 
The question was deleted because it was wildly off-topic for SO but I just found that a bit funny as a gripe about switching from PHP
 
wait that was an SO question? Whoops xD
And yeah, but PHP got fancy in recent years didn't it?
(5 years ago maybe?)
 
Yeah, they were looking to switch out of PHP and were trying to decide between Java and Python
 
Ah
ok
 
11:04 AM
I don't know what PHP is like these days, only really what it was like, but then I popped into the PHP chat room and decided that things probably haven't changed. There was a lot of abuse and swearing. I swear quite a lot in my day-to-day but if it spills over into SO like it did there then there is probably something wrong with the mindset. Luckily I don't encounter PHP at work at all :)
 
11:24 AM
@roganjosh, I tried PHP back in December. It got better since I last used it. There's native Unicode support IIRC. Then I immediately decided to rewrite the code since PHP got messy quickly.
Never to PHP again.
 
:)
 
On another note, I learned to be suspicious when I hear that someone loves PHP and never bothered learning another language aside from Java or C#. Probably due to my environment I guess.
VB lovers also makes me suspicious.
It's probably just me getting used to dealing with a lot of people loving PHP or VB that churn ugly code.
But, it's injustice to the craft in general if I dismiss the fact that you can write beautiful PHP and VB code.
Oh, where are my manners? CABBAGE!
 
Haha, cbg. I'm off to the pub now to enjoy what little sunshine we get but there's a royal wedding to avoid so I'll probably be checking in :)
 
You're from Britain, mate?
 
yes mate
 
11:31 AM
Damn! Well, have fun at the pub.
 
Cheers
 
@roganjosh You're right. The PHP chat room is... "uncivilized". A quick few scrolls to the top and I have already read someone swear.
 
@roganjosh Have a good time. :)
 
@SeanFrancisN.Ballais I don't remember the discussion they were having at the time, but it was in every comment and insulting people asking questions on SO. Some criticism of questions might be funny but linking to a question and calling them an "******* idiot" kinda crosses a line IMO here.
 
Okay to be fair, No abuse so far in the PHP chat. Only one case of swearing but there's this guy I am weary of from the PHP chat. Shafizadeh guy. Gives off an abusive/angry vibe.
@roganjosh Oh, something of that accord haven't come up in the PHP chat rn. Maybe later.
 
11:40 AM
It was only one time I popped in to the chat room so potentially it isn't representative at all
 
They seem to be a mix of friendly, helpful and abusive.
The PHP chat room seems a bit serious. This chat room is quite light-hearted.
 
To prove your point: banana job too!
 
Banana job?
 
11:49 AM
... the wedding is on a projector. This was a terrible idea re: avoiding it.
 
Don't pubs have a tele for you to watch the wedding?
 
what wedding?
is this a UK thing?
 
Yes
 
Ah, yes. I figured it's either royalty or Kardashian since it's just "the wedding"
 
Hahaha, both hold the same kind of significance to me
 
11:54 AM
The Kardashians are still popular? :O
 
who are the kardashians?
 
They seem to be just another celebrity that's just popular and nothing much to offer other than potentially scripted reality shows about themselves.
 
The royal family does actually do quite a lot of good for us, but the fever around this has driven me slightly mad
 
That reminds me. We could have been colonized by the British.
 
12:30 PM
I have a form in Flask and I want to add a button that will scrape some data and fill out the form values with that data. I know how to write that scraping mechanism in pure Python but can someone point me in the right direction in regards to integrating that with Flask?
 
I'm thinking of creating a route that you can POST to and will return the scraped the data in JSON format. JS would just be needed to fill out the form fields.
So, when the button is pressed, it'll send a POST request to that route and the data you get will be used to fill in the form. Someone else might have better idea though.
 
1:00 PM
I'm thinking of making a button next to the submit one in my form class, and in the route have something like this to check which one is pressed:

def test():
form = Form()
if form.validate_on_submit() and form.submit.data:
. . .
elif form.random.data:
data = scrape()
return render_template('form.html', form=form, data=data)
return render_template('form.htm', form=form)

And then I would just have to check to see if data exists with Jinja. Thoughts?
Messed up the formatting, just a second
Edit time expired, forgot about the sandbox room. My bad
 
1:15 PM
def form():
    form = Form()
    if form.random.data:
        data = scrape()
        return render_template('form.html', form=form, data=data)
    elif form.validate_on_submit() and form.submit.data:
        . . . do something . . .

    return render_template('form.html', form=form)
 
You're scraping your own page?
 
No, the elif case is unimportant
 
I'm a bit lost on what you're trying to do from your initial question
 
With the form I can either type it in myself or have the data be scraped and values put in the fields with the click of a button
 
Ok, so scraping pre-fills the form? The contents of the form can be updated using ajax. You could supply a data template of blank strings to the form, and then update those blank values if the user chooses to populate the form with scraped data
In other words, you supply your template with a correct data structure initially, but all the values are empty strings. If they scraped, you fill out your template with those values and update the form values
There's probably a smarter way of doing it with JS but this is an approach I've used so that jinja can always render a template
 
1:31 PM
Doing it with ajax is the goal, but I'm not sure how to do it right now so I just wanted something functional at first. I will definitely look into it later on.
What's concerning me is that if I render the form as {{ form.field(value=data) }} it doesn't give any errors when there is no data which looks fine on the surface but I'm wondering if it will prove to be an issue down the road.
Nevermind, I just realised that's exactly what you said.
 
I really want to caveat that with the fact it's something that works well for me but I have no idea if it's a standard approach or whether there are security implications (I doubt it, but I don't know for sure). My flask app is on an internal network
 
Uhm
I'm not understanding your you're using scraping instead of like, default values (populated dynamically either in your python or in JS)
 
Because then you'd have to override all of the scraped fields if they were the default option?
IMO it makes sense to have a choice of whether a form is pre-populated, no?
 
Yes, that does, but the act of HTML scraping is expensive.
 
Yes, I only want to populate the form when the user clicks the button to do so.
 
1:45 PM
Why are you parsing values from html you're generating when you should already have access to the values when you generate them?
 
I don't know why scraping is involved in this at all but presumably there's a reason
 
Unless that reason "The HTML I'm scraping is from an external resource", I'm not seeing
and if it /is/ from an external resource, it's a security problem
 
I'm scraping to give the user an option to use a generic randomly generated template for the form.
If they wish to input their own data, which is true in most cases, they don't need to pay attention to the "scrape button"
 
I repeat: Why are you parsing values from html you're generating when you should already have access to the values when you generate them?
 
Can you elaborate on why it would be a security concern scraping data from an external API?
 
1:50 PM
Because of XML Injection Attacks. It's one of the top 10 critical security risks according to OWASP (owasp.org/images/7/72/OWASP_Top_10-2017_%28en%29.pdf.pdf)
 
I'm not sure what you mean when you say I already have the values.
 
Well, is the HTML you're scraping your HTML or external HTML?
 
It's from an external API
How would you recommend I remedy the security flaw introduced by scraping a foreign source?
 
Well to be fair I mispoke
it's only a risk if you can't trust the source (e.g. if the source is the user, or you're scraping off the live page the user can artificially edit before you start scraping)
if you call an API, and scrap from the API response directly without any chance for the user to tamper, you should be ok unless the API wants to mess you about
 
I doubt the API would want to tamper with me seeing as it is a fairly large site but I see a learning opportunity here. Can I encode the response somehow to prevent an attack in case that happens?
 
1:58 PM
I'm not sure if I have enough information to answer that but basically what I'd recommend is this:
#I'm assuming here that callApi() returns a string
originalData = callApi()
putDataOnPage(originalData)
# and then, instead of data = scrape():
data = parse(originalData)
 
If we take a step back, the fact you're scraping the data, rather than using some kind of API, implies that this data comes with no guarantees
 
^
As soon as the page loads in a browser, the user can go into dev tools and change the HTML to whatever they want. Consequently, if you scrape that data back, you're scraping user data, not api data.
As a general rule, user data can be malicious at any time, so if you have something you expect to be equivilant to user data from a non-user source, take the non-user version.
 
out-of-context question titles are great: "Weird cat behavior with braces" sounded more interesting before I realized it was asking about the linux command
14
 
rofl
 
3:09 PM
@edsheeran looking back over the conversation, what do you mean by "scrape"?
 
@roganjosh I was wanting to scrape a site that generates fake names with requests + lxml OR use an API if they provide one. I've found the package Faker does more or less the same thing. I swear Python has packages for everything.
 
Mostly, yeah, there's a library for everything :) but you did keep mentioning an API and scrape at the same time so I wasn't sure if we'd gone off-track
 
3:34 PM
Why the shape of scalar in numpy is `()`?

>>> A = np.random.randn(2,2)
>>> A
array([[-0.6663516 , -0.41884056],
[-1.2614304 , -0.3910689 ]])
>>> A[0,0].shape
()

So is that `3*A` kind of broadcasting that extends the shape of `3`, which is `()` to `(2,2)` of 3's?
 
What would you expect instead?
I don't get what it has to do with broadcasting. You asked for the shape of a scalar, specifically by index
 
@roganjosh I meant: the result of 3 * A is each element of A times 3. So is could I think of it as first broadcasting that scalar 3 into [[3,3], [3,3]], which of shape (2,2), then do element-wise multiplication of two (2,2) matrix.
Yes I know that numpy is designed like that but I'm just thinking about whether it may be related to broadcasting.
 
What does that have to do with A[0, 0].shape?
 
3:50 PM
@roganjosh because 3 is just a number which has nothing to do with numpy, so 3.shape is no defined. But A[0,0], which is actually a scalar, but it has shape (), so I'm thinking about that could I think 3 as of shape ().
Sorry about the grammar I'm not very well of english grammar.
 
() is falsey, so it's saying it has no shape
 
Since I ran A[0,0].shape I got (), so I ask about this.
@roganjosh But actually I'm reading about tensorflow, which a tensor of rank 0 is of shape []. So I'm re-learning/reading about dimension/shape of numpy.
 
Ok, so numpy reports the shape as a tuple, not a list, but you can read () as being equivalent to []. It's just saying it has no shape.
 
I'm reading the shape section: tensorflow.org/programmers_guide/tensors#shape
line 8
Is that something has no shape equivalent to it has shape []?
 
If I understand you correctly, yes. The fact that the docs list a scalar as having [] shape and that numpy reports the shape as () is unlikely to create issues. They're just empty containers
They're both falsey so it's unlikely to be an issue. Lists are mutable while tuples are not, but I can't see why this factor would be relevant.
 
4:06 PM
@roganjosh Yes, that's what i meant. But I didn't mean I want it to be an issue, I expect it with no issue about returning [] or () as shape, but if it's no shape, there should be a exception since everything should have a shape?
 
Why would there be an exception?
 
It's a long story if you want to know...
Hours ago I asked a question about it but I deleted it.
I got an error related to ()-shape
train_X = np.linspace(-1, 1, 100)
train_Y = 2 * train_X + np.random.randn(*train_X.shape) * 0.3
# create model
X = tf.placeholder("float")
Y = tf.placeholder("float") # Y is label/answer
W = tf.Variable(tf.random_normal([1]), name='weight')
b = tf.Variable(tf.zeros([1]), name='bias')
z = tf.multiply(X, W) + b
 
It doesn't have to be a long story. The empty containers are "falsey" meaning that they can be caught in the code by if not A[0,0].shape:. It's not an exception to ask the shape of a scalar, the answer is just that it doesn't have a shape
 
I was learning tensorflow, and I just found that I can change the [1] of tf.random_normal(...) with [] and everything works fine.
But that W of shape [] or [1] has different meaning, one of rank 0, one with rank 1. But anyway I'm just relating this to broadcasting...
@roganjosh but since 3.shape is a syntax error, so why A[0,0].shape returns ()/[] without error?
 
Ok, now I understand your question
 
4:17 PM
I appreciate your time, sorry I didn't express it well.
 
Don't be sorry, it's just as likely that I'm being slow :P
 
1) 3.something looks like a float to the lexer, so it throws a SyntaxError. Something like (3).something works fine though. 2) Because 3 isn't a numpy number, it's a python number. Python numbers don't have a shape.
>>> type(3)
<class 'int'>
>>> type(np.array([3])[0])
<class 'numpy.int64'>
 
@Aran-Fey You would be one of my accepted answer if I were not be restricted to asked question every 90 minutes. I meant thank you.
Oh that makes sense.
np.array([3])[0].shape
()
(3).shape
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'int' object has no attribute 'shape'
Why I got error?
 
import numpy as np

a = np.int64(2)
print(a.shape)
 
ok I can't format it well.
 
4:25 PM
As was said before, you're not working with standard python integers
Numpy integers have a shape attribute
 
Ok, if thinking 3*A as broadcasting works/doesn't cause an issue I will accept it until I hit a wall. I appreciate your time, roganjosh, Aran-Fey :)
 
Your ultimate concern is 3 * some_array?
It will work as you expect :)
 
4:55 PM
Weekend cabbage
Or as my mobile keyboard suggested: weekend carnage... it's about the same thing
 
Cbg, very nearly :)
Can anyone tell me what is the difference between [i for i in range(100)] and (i for i in range(100))?
 
The latter is lazily evaluated
 
Googled and I can now see a similar example.
 
[i for i in range(100)] creates the whole list. (i for i in range(100)) gives you values from the list without generating the whole list beforehand.
 
I noticed, but it is also slower. So is there actually any point to using it?
 
5:09 PM
What are your benchmarks for it being slower?
 
Oh I lost the example. Just a second please.
 
I feel like I'm on a call to a helpline :P
 
Please wait. You are being transferred to line 2, Soothing music
Finally it finished: dpaste.com/0GFN83N
That is a 3.071425748789224 difference.
 
DSM
Creating a genexp does have additional overhead. But it's trivial, and for very large objects you'd otherwise need to materialize it does have a performance advantage. Use Python structures when they're conceptually the right thing to do, not because of microbenchmarks.
 
I'm gonna have to recreate on my end. i for i in range(100) doesn't make sense to me.
 
DSM
5:17 PM
(Aside: since you're using IPython, you can just use %timeit whatever.)
 
def a():
    for j in (i for i in range(100)):
        pass

def b():
    for j in [i for i in range(100)]:
        pass
%timeit a()
9.01 µs ± 57.5 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

%timeit b()
7.15 µs ± 46.2 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
 
Shall I run that as well?
 
You can do, but it does suggest the list comp is faster, I'm not sure why
 
Is that a*b a shorthand of tf.multiply(a, b)? I haven't find it in the tensorflow docs.
The book I;m reading mixs both ways in its description...
if Explicit is better than implicit. I should use tf.multiply(a,b) instead?
 
5:34 PM
@Niing something like this sparked an argument between me and another user. If there's a significant speed-up using less clear syntax (but fully supported), then I say go for it. Others will disagree and that's fine too, they have a valid point.
 
@roganjosh Ok, thank you~
 
6:09 PM
got a question but Idk if this is the right place to ask it, but anyway
 
wim
anyone have a good reference / mathematical paper about sphere packing, preferably with lots of pretty pictures?
 
isn't divide and conquer linear? because at the end of the day you have to go through every element from the first half then the second half
 
@wim in terms of practical problems? I'm curious what sphere you're packing.
outside of oil/gas I'm not aware of spherical vessels
 
I installed tf-nightly-gpu to run tensorflow, but why it's my CPU went 100% usage rate when I ran my program?
And I supposed it to spent a blink of time to complete the program since the randomly generated sample data to be processed is just (100,). But it takes some seconds to print out all the result?
 
6:25 PM
Wasn't there a question about the common error of using list elements as indices when iterating? Like for x in my_list: print(my_list[x])
 
@Aran-Fey This question maybe?
 
It's not great but it'll do, thanks
 
Yeah :/ I was digging around for a better canonical but no luck
 
7:11 PM
recbg
 
7:42 PM
cbg
 
someone here worked with gif's via wand.py?
having a problem, and I dont know how to solve it
http://maxlunar.insomnia247.nl/files/file.gif
http://maxlunar.insomnia247.nl/files/res.gif

done some liquid rescaling frame by frame, and weird glitches pop off
 
The problem is obviously caused by the fact that you're not using gifsicle :P
 
can it work without intermediate files? I prefer using io.BytesIO
 
It can, but it's not a python lib. You'd have to run it as a subprocess and feed it the image through stdin
 
7:48 PM
any way to do it only in Python?
 
Not with gifsicle. I haven't used wand.py, but it would help if you could post the code you used to resize the image
 
0
Q: wand.py strange behavior with gifs rescaling

MaxLunarI want to make script which liquid-rescales GIFs frame by frame, but I stuck into the problem. Every time it just distorts image, and it looks like previous frame isnt disposed. I used this answer as base for my script: In [19]: with Image() as result: ...: with Image(filename='file.gif'...

I did iterating through frames, liquidrescaling each and putting them inside new image
 
8:06 PM
Welp, the code looks like it should work (i.e. there are no obvious bugs)
 
I think I just wrote my cleverest use of generator ever and I feel like sharing it
If you are interested it's that, I'm just kind of proud
@Simon ah, your comment was adding drama to the whole thing!
Well it changed, but an earlier update had a cool use of next
 
8:26 PM
Huh I just need to test script and there is not one wav file on my pc to test it with.
 
8:50 PM
Hmm I have this code, the problem is that SND_FILENAME is not recognised. I have here the docs but I don't see where to define the flag.
Working in C great though...
 
DSM
9:02 PM
@OlivierMelançon: that's nice work.
 
 
2 hours later…
10:48 PM
HEy guys again
 
11:41 PM
Cabbage
 

« first day (2772 days earlier)      last day (2176 days later) »