« first day (3422 days earlier)      last day (1526 days later) » 
01:00 - 20:0020:00 - 00:00

1:26 AM
Who would be willing to help out fix Pipenv doc URLs? The domain registration has lapsed and all docs.pipenv.org URLs are b0rken.
I’ve fixed the top 30 or so already, but it’s late and there are another 60+ posts to fix
the new URL is https://pipenv.kennethreitz.org/en/latest/ and in 95% of cases it’s trivial to fix the old URL.
Sample edit for a link-to-the-project URL: stackoverflow.com/posts/46448677/revisions
Sample edit with direct-to-section reference: stackoverflow.com/posts/50382837/revisions
And finally, a sample 5% case where I had to adjust an older link referencing a specific CLI switch: stackoverflow.com/posts/48431669/revisions
Grateful for any assistance given!
 
1:43 AM
@MartijnPieters I can work on that
 
 
2 hours later…
wim
3:31 AM
the broken links have one small advantage - it sends the correct signal (that this project is dying/dead)
 
 
2 hours later…
5:38 AM
cbg guys o/
 
user10984358
What decides the visibility of rep count below the user names in chat? I cant see roganjosh or dodge or LittleNaruto rep but I can see Martjin and Neo?
 
If you scroll a little up, rogan's rep is visible. But yeah your question still stands.
 
user10984358
maybe the first time they chat after sometime, but if that were the case yours must be visible I guess
 
Hmm, search/post on meta SE
 
user10984358
yeah, let me check
 
5:45 AM
@TheNamesAlc it the depends on the size of the message box.
Multi-line message boxes will expand the info box next to it.
If it's long enough, you can see the rep.
Four lines should be enough, IIRC.
 
user10984358
it is, it was staring right at me all along, >=4 lines
 
6:04 AM
Hi, Is this requirement possible?
Need to write a Python program to
- traverse my specify facebook, ig, twitter, youtube id
- download all photo, video and pdf
 
"is this possible" => generally, yes
 
Is it how can I do this requirement can you give me a road map @MisterMiyagi
 
start with just one site. learn how to access information on that site
 
@stack I recommend starting with a program that downloads one image, based on a pre-defined URL. work your way up from there.
 
also, lots of good resources for this online. pick one tutorial and go from there
 
6:09 AM
how can I search tutorial for this purpose
 
do you know google?
 
Yes but I searched I didnt got the perfect one thats why I just asked your suggestions as you people are experienced..
 
there is never a perfect tutorial, and it's hard to recommend even a decent one without knowing your current skills.
 
@stack there is no such thing as the perfect one. The best is to try, and try. become self sufficient in your learning, and that really starts with just googling and implementing what you find. Expecting someone else to do it for you will end up with you never really learning how to search for yourself though
 
just pick one that doesn't look super complex.
 
6:13 AM
and if everything looks super complex, pick one of the top ones and go through it line by line till it stops looking so complex.
 
Ok Thankyou for your suggestions @MisterMiyagi @ParitoshSingh So first I need to write script downloading images from a website right?
 
Sounds like a reasonable building block, yeah
 
Ok Thankyou @ParitoshSingh
 
yes, that's the basis of what you want to do. it helps to start and understand this before adding too much complexity.
 
Yeah Thankyou @MisterMiyagi
 
6:16 AM
Also, don't be afraid to ask if stuck once you go through the tutorial and start implementing things. At that point (once you're in the thick of things so to speak), you should hopefully be in a better position to ask more specific questions, but more importantly, be in a better position to understand the answers given
Treat it like an iterative process
 
Yeah right Sure!! @ParitoshSingh
Actually I had learnt selenium through tutorial and tried scrapping one website and struck
 
A graph I made years ago depicting when people say cbg and rhubarb in the room :)
There's about a 13 hour difference between peaks.
 
Interesting
 
@stack One thing to keep in mind, is that every website is different. But Selenium is usually pretty robust about it, since it "mimics" an actual user interacting with the website. Did the tutorial work as-is and only fail when you changed the websites (im assuming you changed the urls) or did the tutorial fail even before that? (If the latter, change tutorials. If the former, An MCVE can help, essentially what specifically got you stuck?)
 
Actually I had tried get the email of the name which I had searched in this search.rutgers.edu url for that I wrote this script like this dpaste.com/26AAS8F here when running the script the in google the website is opening searching for the name and getting the results page but I am not able print the email of that name @ParitoshSingh
 
7:14 AM
@JossieCalderon that plot seems to have suffered when viewed from mobile. Which seems a bit odd since I use plotly.js all the time so they have a web slant
 
@roganjosh There is indeed a lot of data on the graph. Originally it was meant to be the top graph only.
But at least you know when everyone's online :)
Oddly enough programmers say cbg around 4-5am, which boggles me. Don't people work at 8am etc?
It could make sense if there are some UK programmers though
but then it would be 10am for them
 
cbg. :P
 
I'm in the UK and sometimes start at 6am to catch the start of the factory shift. And rarely say cbg for myself, only in reply to others. I'm screweing your stats up :P
 
You can also click "use desktop version"
:P
@roganjosh Flagged.
 
7:24 AM
cbg Andras
 
@JossieCalderon I just found it odd because I thought the point of plotly was that it would adapt to things like mobile view vs, say, matplotlib. It's not done a very good job there. Then again, I've not seen the desktop version yet
 
cbg
 
7:45 AM
Interestingly, tk.create_image() displays the image relative to the center of the pic, not the left-corner of the pic.

most annoying.
and it doesnt allow for negative co-ordinates sob sob
nvm, fixed with
anchor=NW
attribute
 
8:08 AM
@AndrasDeak It's difficult...you'll sometimes look for an hour for an answer, and finally find it.
 
8:23 AM
Indeed
 
8:58 AM
@LogitechFlames please don't ask for help with fresh questions on main as per our rules. You'll probably get an answer soon.
 
9:13 AM
morning guys how am I doing this curl in python ?
curl -X POST \
https://image.adobe.io/sensei/cutout \
-H 'Authorization: Bearer <auth_token>' \
-H 'Content-Type: application/json' \
-H 'x-api-key: <YOUR_API_KEY>' \
-d '{
"input":{
"storage":"adobe",
"href":"/files/images/Example.jpg"
},
"output":{
"storage":"adobe",
"href":"/files/output/cutout.png",
"mask":{
"format":"binary"
}
}
}'
 
9:35 AM
@AnotherUser31 Did you find curl.trillworks.com when searching for this problem?
 
9:52 AM
@MisterMiyagi might bookmark that and try it out... although it generally doesn't take long to grok a curl command...
 
I found it neat how it nicely prepared the header.
 
 
1 hour later…
11:20 AM
Hey small doubt
should we need Facebook API for writing python script for scraping images and videos from facebook?
 
Train wrecked D:
 
@TheLittleNaruto don't
 
12:05 PM
Can anyone who knows please give an answer to this chat.stackoverflow.com/transcript/message/48714320#48714320
 
@stack I can give a general answer: service providers usually don't like to be scraped, and they offer APIs as an alternative that's a controlled source of information. If a service offers an API odds are you should use that. The bottom line is what's written in the Terms of Service of the given service; look for "automatic collection of data" as well as "scraping".
if the ToS doesn't forbid scraping then you probably can (legally speaking)
 
I want to write a python script for downloading images and videos from my facebook account is it possible ? @AndrasDeak
 
general answer: it's probably possible
 
How without using API??
 
I don't know, but most things are possible until proven otherwise
 
12:10 PM
Ok @AndrasDeak
Did you ever tried these @AndrasDeak
 
nope
 
Ok Cool :)
 
@stack so i finally got a chance to take a peek at this. Your issue is because of iframes. iframes essentially allow you to embed external websites in the same webpage. The issue however, is that your selenium code is looking in the wrong "context" by default because you never switched to the iframe
btw, good MCVE, it was clean and easy to follow.
 
Oh Ok ThankYou@ParitoshSingh
 
@stack here is a quick fix that may or may not hold up, but should still give you a sense of what you'd need to do. Note that I personally did not know about this issue till i looked into it just now: aka there might be better ways to do this, i do not know.
 
12:27 PM
@ParitoshSingh Yes it worked but got all the text with email ok I will go thorugh it but I didnt understand where is this iframe in the html element
 
re facebook. Sites that provide APIs usually expect you to use them to do stuff, but i do not know about Facebook apis as such. See if their API allows image access or not. If not, you can attempt scraping, and there's only one way to find out if something works or not. Note that Scraping is a pretty "grey" area in general, my only suggestion would be to scrape responsibly. (don't scrape information on others, don't bombard a site with scrape requests)
@stack oh, it's literally the whole div below the grey search bar. The entire white area with all the text. If you wish to find it, keep trying to select the "outermost" div that contains your information. Once you do that, open up the body and look at the html
I suppose no shortcuts for that. If you wish to know whether something is an iframe or not, staring at the html till things make sense is just about the only way i know.
 
Ok there wont be any element in the html like iframe to identify?
 
user11585758
guys
I was training the model by using previously accuracte model using

refined_model.fit(x=x_train, y=y_train, batch_size=16, epochs=1, validation_data=(x_valid,y_valid), callbacks=[tensorboard_callback], sample_weight=saved_model.get_weights())

Throwing down error
AttributeError: 'list' object has no attribute 'shape'

how do i use it guys
 
@stack it will be there, you'd have to find a means to locate it.
the iframe tag is literally <iframe> in case you were wondering
 
I didnt understand for example in the link the body below search bar there is no <iframe> right?
then how did you identify?
 
12:35 PM
I paid attention to how the states were changing before and after i did the search. The iframe section only loads once a request is processed. Other than that, i was actually counting the count of anchor tags, and it wasn't adding up on browser vs in selenium (ps. in console, you can use xpaths by writing $x("YOUR_XPATH_HERE"))
the browser was reporting 14 vs selenium's 12. That gave me the clue on what to look for, so i suppose that helped
Since i already started suspecting what was going on, it was easier to spot the signs.
tl;dr trial and error really.
 
Wow great @ParitoshSingh Thankyou.
 
and just for why the browser can mislead you here: when you use inspect element and click an element, it automatically selects the right "context/iframe" to search in
 
yes
 
Im guessing that's how you got your xpath, because it matches with the absolute path. But that can mislead you
alright, rbrb
 
yes
after search button and before search you found iframe right
I am not able to identify here
 
user11585758
12:44 PM
oh i change weights to np.array , now its dimension is not matching
 
Hi guys, I have very short question. I loop a function with input values coming from a csv. I then append all the results of the function and write the results in a new column in a csv file. If the output of the function returns multiple values, how can I write each seperate value in a seperate column. Currently they are all written in 1 column.
 
How are you currently reading/writing the csv files and generating what should be new columns?
 
Before my function would return only 1 value. I added some things, so now it returns 5 values.
Example of the result of the function:
result: (93.89192461687617, 10.0047, 0.5739, 0.0143, 53.7779)
 
That's interesting coding... curious way of skipping what presumably is a header row?
If your input already contains the column names... have you first off considered using csv.DictReader instead of csv.reader and then you get dicts you can access by name instead of that rather lengthy unpacking...
and the major things... why are you constructed your new lines manually... you're already using csv to read stuff in, so why not utilise a csv.writer or csv.DictWriter to write it back out?
 
@JonClements Yup
Skipping the header row
I didn't think of that. I am aware this is a quite lengthy unpacking, but it worked so far :)
 
1:01 PM
Well, the thing is, if you change to using a DictReader, then you can also access its headers attribute and use that + your addition list of fields to pass to the writer...
 
I am not that familiar with csv.writer unfortunally.
 
why open the file 3 times... do you really need results as a list... can you just read a row, calculate the new value(s), write the row, repeat... not sure why you're building a list from the input, opening it again then splitting the lines, then opening it again and indexing into results...
 
You are right. Read a row, calculate the new value and write the same row would be the most optimal way.
Probaly for someone like you with quite some experience, this looks like a mess xD?
 
We all started somewhere :)
 
hi any1 python developer here???
how to convert matplotlib plots to webpage?
 
1:09 PM
@JonClements Would you be willing to help me a hand with this :/ ?
 
how to show forecast plot in web pages
 
@Leon maybe... :)
 
with pandas lib
 
import pandas as pd
import matplotlib.pyplot as plt

s = pd.Series([1, 2, 3])
fig, ax = plt.subplots()
s.plot.bar()
fig.savefig('fore_castplot.png')
then to htlm/webpage
<img src='fore_castplot.png'>
@krishnamohan
 
import csv

with open('test1.csv') as fin, open('output.csv', 'wb') as fout:
    csvin = csv.DictReader(fin)
    csvout = csv.DictWriter(fout, fieldnames=csvin.fieldnames + ['new1', 'new2', 'etc...'])
    for row in csvin:
        res = calculate_stuff(row['calculation_date'], float(row['redemption']), ...)
        csvout.writerow({**row, 'new1': res[0], 'new2': res[1]})
@Leon I think ^^^ is a reasonable template you can use
 
1:13 PM
@JonClements Okay, let me figure out how this exactly works. Btw, 'fout', are you dutch :)?
 
lol no... I just tend to use fin for file in and fout for file out...
 
le fin, le fout
 
laurel. that's a blast from the past. is that C convention?
I feel like i have seen it before, but i can't quite place it. It has to have been either C or C++ though, the balance of probability makes me think C
 
it's "lazy programmer's English"
and in python "in" is a keyword
and "inf" is misleading...
 
fwiw, i find fin and fout quite clean to interpret. Just never seen those terms used in python before.
 
1:20 PM
I think it's what I picked up when doing C ages ago... mirrors cin and cout in the C++ stdlib...
 
I suppose that means i've never had two file handlers open at the same time, strangely enough. all mine have been f as far as i can remember :P
@JonClements oh, that might have been what i was thinking of, thanks! this would have bugged me for quite some time :P
 
I also find that it jogs my memory when writing as fout to check I've actually set the file mode to w or at least something that's actually writable :)
 
@JonClements Using your template, with res = calculate_stuff fully filled out. Looping the function seems to have an issue. KeyError: 'calculation_date'
 
What's the actual name of that column in your source csv?
 
calculation_date
 
1:28 PM
What do you get if you just print(row) there?
and you're running it on the original version of the file... as you've overwritten test1.csv already?
without a header....
 
I have not overwritten test1.csv already. It has the first row with all the header with all the corresponding names. Second row has the values.
OrderedDict([('calculation_date;redemption;spot_price;conversion_ratio;issue_date;maturity_date;settlement_days;coupon;frequency;time_steps;call_dates;call_price;put_dates;put_price;dividend_yield;credit_spread_rate;risk_free_rate;volatility;next_dividend_date', '6-1-2011;100;52.1;1.512199976;6-1-2011;31-1-2018;2;0.025;2;1000;;;;;0;0.0476;0.028;0.19818301;')])
is print (row)
 
sorry... put a delimiter=';' for the reader
and for the writer... I missed you were using semicolon as a separator
 
I missed it myself aswell.
what is the difference between opening function wb and w
wb gives TypeError: a bytes-like object is required, not 'str', so I changed it to w, which works.
 
1:46 PM
Has anyone gotten the Google FooBar "challenge"?
wb = write bytes, w = write strings
 
But now I ran against a new problem, but we getting there
Thanks @MooingRawr
@JonClements it writes the row + results perfectly, but without seperation and without the header
 
ahh... you need to call csvout.writeheader() before you write the rows :)
Not sure what you mean by without separation though?
 
csvout.writerow({**row, 'new1': res[0], 'new2': res[1]}) writes all the values in one column
 
@MooingRawr I got that but I was closed down as I was working the problems, Is it back again?
 
See here
Output isn't spread out. Need to use split here?
 
1:54 PM
@Leon errr no... can you pastebin a fresh copy of the code you're running?
 
@Dodge Idk, I just got an invite, and you can save your progression so I assume it never "close down" just your invite times out if you dont accept and link it to your account. I could be wrong though
 
When you're opening the file up are you still specifying ; as the delimiter and you haven't added delimiter=';' to the writer... so it's going to use commas, and if your spreadsheet software is still looking for ; then you'll get that
so either specify the output delimiter or tell whatever you're opening it with to use commas
 
with open(r'G:\Project\test1.csv') as fin, open(r'G:\MSCthesis\test2.csv', 'w', newline='') as fout:
    csvin = csv.DictReader(fin, delimiter=';')
    csvout = csv.DictWriter(fout, fieldnames=csvin.fieldnames + ['new1', 'new2'], delimiter=';')
    for row in csvin:
        res = calculate_stuff(row['calculation_date'], float(row['redemption']), float(row['spot_price']), float(row['conversion_ratio']), row['issue_date'], row['maturity_date'], int(row['settlement_days']), float(row['coupon']), int(row['frequency']), int(row['time_steps']), row['call_dates'], row['call_price'], row['put_dates
Final and working solution
Thanks a lot @JonClements, a lot more efficient and works perfectly
 
@MooingRawr I got a link to refer a friend and shared it here in chat, I think I gave it to Kevin IIRC. After doing advent of code, my opinion is that AoC > Google Foobar
 
2:07 PM
@Leon great... I'd probably name the columns something other than new1 and new2 etc... so they're more indicative of what those columns actually are :)
 
I already did hehe
 
im not a fan of the time limit they have on some of the questions. It makes me nervous to commit.
 
It is so much more efficient + easier to read, really happy with your help
 
I'd be curious to see your calculate_stuff if you're willing to share? (I don't imagine it's top secret...)
 
Sure, its a long function though
You are familiar with finance?
finance concepts
 
2:08 PM
Relatively...
Just curious as it's odd to have such a large number of arguments...
 
Here is the calculate_stuff function
 
Thanks... is ql quandl or something?
 
QL is quantlib, it is an econometrics module
 
ahh okies... yeah... that's a rather lengthy function... like I said, just curious as to the number of arguments passed :)
 
Lots of inputs needed to calculate the theoretical price of a convertible bond (financial instrument)
Usually I would use Matlab for it, as it doesn't really require me to code much, if any (and I am a noobie at it). But Matlab does have it disadvantages compared to what advanced modules like Quantlib can offer.
 
2:20 PM
@Leon whatever's the most appropriate tool for a job :)
 
@JonClements I agree, but Python has some seriously strong data analytic modules, pandas/numpy's, and then a whole spectrum of custom econometrics modules. I am quite enthusiastic about them so far.
 
yup... a fun of pandas and numpy myself :)
 
2:44 PM
@Dodge Thanks, that was a huge help!
 
@MartijnPieters Anytime
 
I'm surprised SO doesn't have a link replacer for mods for this exact scenario.. but I guess the 5% would still be broken
 
For big tasks one could sometimes convince shog to do a db update thingy :)
 
the puppy has been de-ninja-fied?
 
I felt like going back to my crazy looking puppy look :)
no harm in showing my wonderful blue eyes and goofy smile :)
 
3:01 PM
that goofy smile is pretty out-of-this-world... almost on pluto!
 
@inspectorG4dget flattery will get you everywhere :)
 
@JonClements puns too, I hope :P
 
as long as you don't take the Mickey :)
 
I have to minnnie-fy my efforts, I see
 
3:12 PM
/me slowly backs away from this madness...
 
I slapped myself a little too hard for that joke, and now I feel pain in dis knee
 
groan... have you stopped taking your medication again? :)
 
@MartijnPieters related, I need to write some sort of script (maybe need mod approval) to rewrite all the Pallets docs urls, since they're all https://flask.palletsprojects.com/..., etc.
 
@davidism... you're giving me flashbacks! :)
 
&quot;
 
3:20 PM
hehe
 
It's been on the new domain for a few years now, but eventually the old pocoo redirects will stop working
 
only 1312 hits for "flask.pocoo.org"...
 
remember jinja, click, and werkzeug, and to a lesser extent itsdangerous
 
oof
already the 1312 was "only"
 
@AndrasDeak like more than 4000
 
3:25 PM
flask-sqlalchemy too
 
@Dodge ah. "Only" 1020 open, though
or no, that excludes answers
 
5000 edits at 30 seconds a piece is about 41 hours straight... I got this
 
only 64 closed
 
fairly sure you're joking, but don't bother starting it manually, I'll probably have someone sprint on a script at PyCon
 
if the company cared a lot more they could make Community do it
I suspect they wouldn't bother for such a "small" volume (compared to the https rewrite) anyway
 
3:28 PM
I do edit links in posts as I arrive at them through notifications or dupe hunting.
 
but there'd be a huge risk of flooding the main page with edits, so scripting should be done gently
 
@davidism I was joking about doing them all, but might have made a start. I'll leave it be
 
yeah, that's the main thing I was worried about, I was going to contact the mods or devs first to see if there was a less public way to edit them
anyway, it's not an immediate concern, I've got other Pallets stuff to finish first
 
@davidism In the past, Community Managers have run search-and-replace jobbies for projects that were big enough.
@davidism: maybe write a meta post?
 
@MartijnPieters but not like he did last time? :p
 
3:45 PM
@Leon hi @leon
do i nee to run a cron and show in web page the image file
cant we run python code in the html and call the .py script in the web apge
 
4:01 PM
@krishnamohan the answer is probably "don't" if it can be avoided
What type of plot is it? Is it something that couldn't be done in another library? How are you running the web page?
 
if the webpage can be run in a flask server, then use matplotlib. "Problem solved"?
 
Noooo :/
If it's a simple plot, you should pass the raw data and use a JS library to make the plot
 
oh yeah! that'll work too. I'm just pretty allergic to JS
 
I find eCharts to be both intuitive and visually appealing with respect to JS plotting libraries
 
4:12 PM
@inspectorG4dget I hear ya. But JS has some really cool plotting capabilities
 
I've normally ended up using d3.js (poorly)
although things like plotly dash make some things really quite straightforward
 
Yeah, I look at d3 examples, attempt to implement them and then fail badly when it starts blatantly screaming "you suck at JS" and I get hurt
 
d3.js is the first place my mind went. That being said, I'd much rather let jupyter notebooks handle the JS for me XD
 
I think I'd rather a sedated slug handle JS for me - it'd do a better job and quicker :)
(mind you I have been trying to brush up on JS as I really want to start getting properly into some node development)
 
Oh? What do you have in mind?
So far I've not encountered anything that made me think I need node but I'm guessing it has some areas where it really excels
 
4:18 PM
Well... I haven't thought that far ahead yet... seems like it'd work nicely to create websocket/event driven bots etc...
 
sedated slugs are not a problem, it's the ones who are off their meds you need to worry about ;P
 
although... I do also want to get a decent bit of time in with Go...
 
> have you stopped taking your medication again? :)
sorry for being a the problem :P
 
we still luv ya Doc :)
 
permission to make one more pun?
 
4:20 PM
go on :)
 
Or if the parasites transfer from snails
 
If I can have permission to reserve the right to slap you if it's particularly bad :)
 
(I hear the collective eyerolls and sighs and groans of anticipation across the vast distance)
 
@roganjosh yeah... those are some quite amazing parasites... what a way for the snail to go :(
 
what do you call someone who is very motivated to, and with a lot of effort, finally manages to understand Go?
@JonClements by the way, was that statement itself, a pun? Very well done! I just got it
 
4:22 PM
I have a feeling I should be able to guess this one but.... ? (gets Lucille ready...)
 
a real Go getter!
 
@JonClements oh, I was still on the slug thing. When I'm on a phone, I need a good 3 minutes of time correction in responses :P
Add 30 seconds for subsequent edits
 
@inspectorG4dget I wonder if this ignore option actually works :p
 
(It's not a song. It's zombie snails that get a parasite that makes them want to get eaten and screws with their eye stalks - technical term, I'm sure)
 
I've seen the whole documentary on those... quite scary indeed
 
4:28 PM
@JonClements stopping, now
 
Fantastic JS devs, though
 
there's also those wasps (think it's wasps) that sting something or other to lay their eggs inside, which then proceed to steal the food/eat the host until they can then escape...
@inspectorG4dget you don't have to stop... after all... Go Go Gadget and all that!
 
the parasitic wasp lays eggs in a caterpillar. The larvae burst out of the caterpillars body, but some stay behind, hiding the the caterbody to ward off predators, protecting the unhatched wasps
@JonClements :D
 
@inspectorG4dget sounds like the one I'm thinking of
 
N'awww. That's really cute and very noble of them
 
4:31 PM
fwiw, this is a really cool ted talk that covers that (and others). Plus, the speaker has a ton of on-stage charisma
 
@roganjosh for some strange dictionary's definition of "cute" and "noble" :)
 
@JonClements oooh. I totally conflated the ping that made with this message. The ping highlighted this message for some reason, so I guessed you'd peeked at the link before clicking and assumed it was a song because YouTube. Things make much more sense now. Sorry
 
I was slightly confused but then I normally am so... didn't worry too much about it :)
 
We both did well to muddle through in an exchange that really didn't make sense to either of us. I think we should both be proud of that :P
 
@JonClements yeah, lets not repeat the last result. :-D
 
4:38 PM
Well, it was kinda &quot;fun&quot; :p
 
I really wish SO would turn off autocomplete on the form for dupe closing. It's all but impossible to know whether the URL of the dupe target it remembers from previous close votes is relevant, so why give the dropdown?
 
4:54 PM
oh gawd... came up with a cheeky silly looking solution in a comment and I might have been taken seriously... it's clearly homework and no way in heck if they try turning it in is anyone going to believe they did it :)
 
Has it been raised on meta before? Theres just no need for that garbage when I'm trying to close a question as a dupe on mobile
 
morning cabbage
 
Surely that's not SO - isn't that just your browser trying to be helpful by offering auto-fill suggestions?
@Code-Apprentice cbg
 
@JonClements if you don't turn off autocomplete in a web form it will do that. I'd have thought it needs correcting on their end?
Unless chrome on mobile somehow overrules the web form, but that's not my experience
 
I don't think I've ever tried serious moderation stuff on mobile so it's never bothered me... but at the same time I don't recall having seen it come up before... so up to you
 
 
1 hour later…
6:26 PM
cbg all
I am trying to create a multipage form that saves on separate model. I wrote a views here: dpaste.com/1WX0RC8. When I save the form, the data entered into the form doesn't appear. I will appreciate any inputs. Thanks
 
@superv I'm getting deja vu here...
 
@JonClements Why is that?
 
wasn't Aran trying to help you with that the other day?
 
What @shad0w_wa1k3r helped me with was using multiple forms in one page and using that idea I wanted to create a multi-page form this time and it's not working as I thought. Hence, my need for someone to have a look at what I am doing wrong.
 
6:52 PM
oh my bad - it was shadow... sorry
won't be me - I don't have time I'm afraid, and normally the only time you use multiple forms is when you serialize them on the front end and send 'em to the back-end using ajax and have a serializer there with the logic to handle it rather than basic Django forms... I haven't read back enough and don't have time to do so :(
 
@JonClements No worries. Maybe @shad0w_wa1k3r or @Code-Apprentice could be of help when they are free. They are the two people I at least know that works with Django
 
7:12 PM
Pytorch question:
I have a [n, 3, x, y] tensor that represents normals. I want to normalize them all to the length 1. How would I do that?
 
Are pytorch tensors by any chance compatible with numpy stuff?
 
In principle I can just .numpy() and then torch.fromNumpy(foo) ...
But very propably there is a function similar to the np function in torch ... I just don't know how it is called yet
Part of me learning how to torch is basically just getting to know what functions even exist - reading the whole documentation is ... tedious though
 
Probably not the best approach though...anyway if they were numpy arrays you could just divide with the magnitude of the right shape. How are you trying to do the normalization? Is it n objects of shape [3, x, y]? Or [n, x, y] objects of shape [3]?
@salbeira have you tried looking for some tutorials?
 
I want to keep ONLY the env variables set by python scripts in a dictionary. is there any module in python to use or I can write a wrapper over the os.environ command to capture the user specified ENV variables. any idea
 
Yes I worked through all the tutorials but I am working with data that is not dealt with in tutorials
 
7:18 PM
OK
 
In my case I have a GAN that completes normal maps and part of making it harder for the Discriminator to identify "fakes" is to ... well ... normalize the output to vectors of length 1 because the GAN doesn't guarantee that of course
 
That's not an answer to my question. Whats a single "vector" you want to normalize?
although now that I asked this I'm certain that pytorch has to have something that normalizes data
 
Batch size n, 3 directions, x y image : Torch shape is [n, 3, x, y] - so ... n objects of shape [3, x, y]
 
OK. This means that you'll have n norms with which you'll want to divide your data. If these were numpy arrays you'd have to divide by an array of shape (n, 1, 1, 1) for broadcasting to work.
but I shouldn't mislead you; I don't know any ML, I just know numpy
 
Yes though the normalize functions I found do some normalization around a mean and a standard variation ... I just need to do normals = normals/length but each needs to be done for each element on its own
 
7:23 PM
but anyway, what is the norm you wish to normalize by for your "vectors" of shape (3, x, y)?
l2 norm of the 3*x*y components?
 
Don't think of the normalization as a statistical normalization
 
I got that, but there's still legroom
 
torch should be able to do that
 
do what? :P
 
mutliply with a tensor of shape (n, 1, 1 ,1 ) ... though that seems false
I'd need to get a (n, 1, x, y) tensor where for each pixel the length of the vector is stored
and then divide the images with that tensor
 
7:25 PM
that seems surprising to me. I assume whatever you can do in numpy, you can do in pytorch as well
 
@salbeira that directly contradicts your earlier reply to me...
 
... which one?
 
7 mins ago, by salbeira
Batch size n, 3 directions, x y image : Torch shape is [n, 3, x, y] - so ... n objects of shape [3, x, y]
Side note: does that normalization make much sense? That would mean that light gray and dark gray get normalized to the same [1, 1, 1]/sqrt(3) colour. What's worse, black would have 0 norm and you wouldn't be able to normalize it...
 
Uh ... how ... ok ... well in the end I have n images with 3 channels each with dimensions x and y - what one would of course usually think when they say "image" they'd say n objects with dimensions x and y containing a 3 dimensional vector
 
if we're dealing with images, shouldn't a simple divide by 255 suffice? all pixel values range between 0 and 1, everyone is happy, what's going on here, did i miss something?
 
7:29 PM
it's all just vectors in a linear space, so nothing is obvious
@ParitoshSingh that would make a lot more sense as "normalization"
or, more like dividing by the max of the second component across the entire image
 
The "image" is a normal map: A pixel of value (0,0,0) means "There was nothing rendered here" and every other pixel already has length 1
Just the output of my network needs to be normalized after it is ran through it
 
OK, so if this were pure numpy I'd do arr /= np.linalg.norm(arr, axis=1, keepdims=True)
>>> arr = np.random.random((2, 3, 4, 5))
... np.linalg.norm(arr, axis=1, keepdims=True).shape
(2, 1, 4, 5)
 
I am trying to find an equivalent to the norm() function of np.linalg in torch ... "normal()" sadly just returns a normal distribution of random elements from a tensor :-P
 
Ah ... one of these: See pytorch has SOME METHODS that tensors have, so you call:
tensor.function()
and some FUNCTIONS are only available as part of the torch module:
torch.function(tensor)
It is VERY confusing what is available how
 
7:45 PM
That's the same in numpy, really.
Some things are methods, some are module-level functions, but methods are almost all available via module-level functions.
 
Ah I just saw that norm() exists as a method but it is not axis=1 but dim=1
 
boo
 
OK ... this works very well! Thank you!
 
no problem
 
Now I just mentioned that I screwed up my own thoughts in transforming my normal map into the visible RGB spectrum by doing a 0.5 + normal * 0.5 ...
I will either have to undo my transformation or find the length each vector has transformed in the RGB spectrum and go from there
 
7:55 PM
I don't really understand the problem but I know you're probably just thinking out loud
 
Yeah I am just using this chatroom as a rubber duck right now :-P
Sorry
 
that's all I can do in machine learning anyway
 
Well ML is actually not very hard to work with ... all the math behind it is completly abstracted away by libraries nowadays - you just need to think about the math you need to apply before throwing ML at it
 
I'd actually be quite happy with the math, I have solid linear algebra background. I'm more unaware of the learning machinery.
 
01:00 - 20:0020:00 - 00:00

« first day (3422 days earlier)      last day (1526 days later) »