« first day (3388 days earlier)      last day (1777 days later) » 

wim
wim
00:14
@SebastianNielsen Why does that suck?
 
2 hours later…
02:25
cbg
02:43
I have been working on this project for a while now but now I am stuck and can't seems to move any further. The issue is I have 4 modelForm I will like to display in a detailview. I have been able to show two of the modelForm by using a for loop on the landlord model and using context_object_name to get the rental model. Where I am stuck is how to get the apartmentBasicInfo and Contract modelForm to display in the detail view. Thanks. link to the code here: dpaste.com/2BTS9TN
 
4 hours later…
06:46
@Kevin Indeed! The shell theorem says that anywhere inside a uniform spherical shell there's no gravity due to the shell itself. And that implies that the gravity outside a solid ball acts as if all the ball's mass were concentrated at its centre.
There's also a version of the shell theorem in general relativity: Birkhoff's theorem. Both of those theorems also guarantee that you won't experience any tidal stretching inside a uniform spherical shell.
07:33
@AndrasDeak print ("hello world")
Is it that my question is wrongly worded or it doesn't have a solution:)
@AndrasDeak juggling so many languages sometimes I forget the syntex
 
2 hours later…
09:25
@superv first of all you should explicitly mention django. Second of all you asked it outside Europe and US business hours on Saturday. People are sleeping and traffic is low until Monday.
@xitas it would've been correct in an ancient and dead language called python 2 ;)
09:56
@superv I'm a Flask user and I've found that django is not as similar as I'd like, to be able to help, but I'm a bit lost on what your issue is. There's a lot of code there; what exactly is the problem?
 
1 hour later…
11:03
> You have already voted to close this question, but you may vote again on Feb 6 at 3:01
Wow, that second part has to be new
@superv You need to overwrite the get_context_data method to add your own data (from your 4 models) to pass to the template for rendering.
Also, performing {% for property in property_detail.rentalproperty.all %} in the template is not healthy, unless you're sure the number of objects would be considerably less. It's always better to explicitly pass data to the template (by fetching the data in the view) and not let the template trigger any big queries (small ones might still be okay, at times).
11:36
Hey, was hoping someone could help me with my Procfile (python flask) over at https://stackoverflow.com/questions/59908738/problem-with-procfile-wsgi-when-deploying-to-heroku-with-python-flask-app-fa
if any additional information is needed please ask!
Thank you in advance!
@Sparrow Hello. We ask that you don't ask for help here with fresh questions on the main site. Traffic is slow on the weekends, you'll probably get an answer by Monday.
Okay
You seem to have all of your code in off-site resources, which is not good for a question. You should boil down your code to a minimal amount that can be directly included in the question. Links rot away eventually, but SO is designed for long-term content.
@AndrasDeak Thanks for the tip. I am in Europe also, I just didn't look at it from that angle.
This code has been boiled down, as it is aprox 20 lines
11:40
@Sparrow great! So add it to your question directly in code blocks :)
okay, will edit my post
you can use code fences with triple backticks on the main site (but not in chat, alas)
@shad0w_wa1k3r Thanks for the tips. I am new to Django so I am learning as I go. How do I overwhite the get_context_data or if you have a tutorial you can point me to. Thanks once again.
@superv did you follow the link he posted?
in chat text is orange for a reason ;)
@superv Do it like it's shown in the linked documentation - docs.djangoproject.com/en/3.0/topics/class-based-views/…
11:45
@AndrasDeak I didn't notice the links. Thanks for pointing that out. @shad0w_wa1k3r I will go through the documentation. Thanks a bunch.
you're welcome
11:59
@Sparrow I've fixed some of the formatting but you still have a quote block and an empty code block after it at the start. Do I undertand correctly that your linked "boilerplate code" is not yours, but some third-party library? If it's your own code it should also be included in the question (because it may be buggy or otherwise relevant)
Thats actually a really good idea, dont know why I didnt think of it. Ill just download that repo, and try to get it to work from there, and then modify my code accordingly. Thanks!
12:58
Ugh, people have started mailing me python questions :/
No escape from SO life :P
Then hide your email?
It's not email, I linked my site on my profile so they've gone through that to follow up on their SO question
Haha, wow, they must be desperate xD
Which I think was a typo but the formatting got garbled when I wrote it to my db so there's little hope I can answer :P
Is the serialization of a smaller object an expensive operation in Python? I am contemplating whether I should serialize my class objects whenever an attribute is updated.
In other words, call a serialize method from "_setattr_"
13:04
For what purpose?
Saving the state of my program
So that when I start my program at a later time, it can continue from where it left off
Wouldn't you want a db for persistence?
Nah, that would be overkill. It's just a small project I am working on.
vs. serializing an entire class every time an attribute is updated?
It's not prohibitively expensive for a small project; are you using pickle?
Yup, I use pickle.
13:11
guys, any link on a good TF-IDF code?
I still think that SQLite would be a better approach but if you're sticking with serialization, I don't suppose you have any option but to redo it every time an attribute changes
Uh well, that's what I thought.
@roganjosh ignore!
@AndrasDeak Oh, for sure. But my goodness, it's a bit of desperation being exposed there :)
@SebastianNielsen I'd think IO each time would be the problem, not serialization necessarily
13:21
Hi all, just wanted to ask if someone knows a simple way to split a whole url into 2 parts, base_url and path, I have looked at urlparse, but its splitting the url into several parts, schema, netloc, path and query. is there any way to just split it into 2 parts?
I've also had messages saying that my parents screwed me up and what a horrible person I was for downvoting them. It's curious when you provide a way to break the fourth wall of SO
E.g: "https://repl.it/languages/python%3Flite=&classroom_template=&outputonly=&fileName="
Splits into: ['https:\/\/repl.it', '/languages/python%3Flite=&classroom_template=&outputonly=&fileName=']
I think that's parsed_url.host and parsed_url.path respectively
oh okay, let me try
the only thing is the query is not included in the path
for example:
url = 'http://www.google.com/locatio/search?client=firefox-b-d&q=python+get+base+url+from+urlparse'
parse = urlparse(url)
print(parse)
# output = ParseResult(scheme='http', netloc='www.google.com', path='/locatio/searc'h', params='', query='client=firefox-b-d&q=python+get+base+url+from+urlpcarse', fragment='')
so path, and query is seperated
well, you can just put it back together
13:36
yes true, was just wondering if something was out there already to do iit before I manualy join them but then I am just worried about the joining process, because here there is path, params, query and fragments
 
1 hour later…
14:46
Hey i have a question regarding virtual environments.
I have created api trading bot for 4 different crypto exchanges.
I have UI in nodejs and bots are python. Problem is some of them are using different versions of same module so i have to use virtual environments.

So, i have installed in each folder different environment. Do i need to activate the environment each time user clicks Start button? Or will python detect there is environment installed in its folder?

Currently this is my code for running it:
let args = [
                __dirname + `/../../engine/${exchange}/` + name,
            ];

            console.log(args);

            const ls = child_process.spawn('/usr/bin/python3.7', args, {
                detached: true
            });
If i do have to activate it, i guess i do it the same way with
spawn(source exchange1_env/bin/activate)

And when i kill the process i just run deactivate? But then it might deactivate some other environment...
15:16
Theres gotta be a way to tie virtual environment whenever specific file is ran
@TheGarrus wim claims it's enough to run the executable within the given env chat.stackoverflow.com/transcript/message/47733389#47733389
Just watch out for potential envvars set in activate
 
1 hour later…
@anky_91 have you spam flagged as well?
nope i will do it now , thanks :)
done @JonClements
hello guys, can you help me?
I have this code that print the the TF-IDF Corpus, but I don't know how to store it to dataframe. Here is the code:
`for sent in tfidf[gensim_corpus]:
               print([[gensim_dictionary[id], np.around(frequency, decimals=2)] for id, frequency in sent])`
what can I exchange the print with what?
Maybe something like: df = pd.DataFrame([[gensim_dictionary[id], np.around(frequency, decimals=2)] for id, frequency in tfidf['gensim_corpus']], columns=['id', 'value']) ?
it only return one column @JonClements
16:59
I missed a couple of [] in the original version - have you tried the edited one?
it says:
`ValueError: not enough values to unpack (expected 2, got 1)`
may be this calls for a mcve @JackZakiZakiulFahmiJailani
i guess so yeah.
it's a little bit complicated here now haha
it's only complicated as such because we don't have the output in hand. Essentially, once you figure out what datastructure is being presented to you, it should then become very easy to manipulate it in the manner you want
17:08
For you, that should basically be a bunch of type calls on the object being given to you
So, try it out. append things in a list if the datastructure is not easy to work with, and just keep "unpeeling it" so to speak.
or well, technically i suppose "peeling it" would be the right term huh. hmm. goes in deep thought
okay
i checked the type of result I got and i got this:
gensim.interfaces.TransformedCorpus
first and foremost : see if you can not have any list inside a dataframe
figured it would be a gensim type of datastructure. But you've already shown to us that you can iterate through it.
You don't cry if you wear contact lenses when peeling onions. Yam all to do with the discussion, I just find it curious from practical experience and it's already a bit scatter-gun :P
keep peeling away at it
you have to go deeper! peel-ception
17:13
yes I can iterate through it,, @ParitoshSingh. But I want to store it in a dataframe. I figured out that, it says:
serialize the resulting corpus to disk first and continue using that
@ParitoshSingh I've spent a good 5 minutes trying to find a pun, and failed. I've let myself and humanity down :/
aww haha
it's okay, a pun 5 minutes later wouldn't have been very apeeling anyways eh?
My puns are timeless
@roganjosh my turn now, 5 minutes and nothing :P
@roganjosh did you get time to try koalas? Just asking
17:24
<internally boiling> it's within our grasp, but what is it? :P
@anky_91 I didn't, no, sorry. I read some of the docs and watched the presentation but we're rolling out Version 2 of my dashboard at work and it's got me a bit swamped
@roganjosh Absolutely no issues :)
Presumably you have worked with it a bit?
@roganjosh Nice :) All the best. I know it would be all good
@roganjosh some basic operations respond well, but I am not equipped enough in pyspark to compare so the process would take a little long :)
Eh, I think it's probably more about just knowing the syntax. When I was working with hadoop, it literally was just the same as any other programming and tasks just got added to a pool
Aye, it just takes a bit initially
17:31
yes, may be lesser than what i am expecting but I will update you soo then, I have been quite occupied lately
That was in a company with 500K employees. I think that most companies are just a bit discombobulated with what they're supposed to be doing with clusters
Essentially, i've found myself saying something like the following: "If you're trying to learn a new concept, but you also have to fight to learn a new syntax at the same time, things get a lot more difficult." So, allow yourself some extra time, as one thing (be it syntax or the concept itself) gets clear, the other becomes cake to handle.
@ParitoshSingh absolutely , thanks :)
I've used it more in terms of machine learning, but i think it can apply to things like pyspark as well
"Be immediately productive with Spark, with no learning curve, if you are already familiar with pandas" - so i was a little optimistic-- hoping this isn't just an advertisement
17:35
Shouldn't be, It's just an abstraction essentially with the same api, as far as i know
It depends on what you expect as output
exactly, i am trying to find that *t&c :) which presumably would take some time
Just, Abstractions sometimes become barriers too. When that happens, it's time to tear things down
The question is, how long does it take to hit that wall, so to speak. Good abstractions let you get a lot done without ever reaching that point
I've had my fill of people suggesting that machine learning can just fix everything. No doubt some people can really do great things, but a lot of it seems to be people setting up infrastructure and then other people fumbling about to use it.
17:37
and the cleansing + data transformation of course
So, provided you know how to use pyspark to some degree, you're probably ahead of the curve
@roganjosh right , i have just started tbh
What's that, you had your fill of people suggesting things? ML has just the solution for you! How about a filter, driven by state-of-the-art AI, so that you only see conversations and people that you want to!
Embed it in your mind, like a chip, and you won't even have to configure anything! it will be good to go!
Oh, i have no idea how to use pyspark personally :D
I should dive into that side of things sometime
Soz, Paritosh, the chip is throwing some major exceptions with your outburst. I think I'm just gonna block you :P
cue black mirror
17:41
@ParitoshSingh Sounds very Black Mirror-ish
d0h - Kevin'd
;)
That show was..something. It always unsettled me how some of the scenarios seemed so very...*very possible*
Though i couldn't get myself to watch the last season, heard it wasn't as ..black mirror-y as the rest
White Bear was one where I really had to go sit in a dark room and question reality
Well - some of it is pretty much real... that episode where social status is determined by people rating you etc... is very very China...
and then the one where a cartoon bear runs for PM and is quite successful :)
And the pig + PM, which loosely came to fruition :)
17:44
Hello 911. I'd like to report some shots fired
but yeah... White Bear was interesting... (never mind I do have a bit of a soft spot for Lenora Crichlow :p)
Charlie Brooker has stopped doing f"{year} Wipe" which is frustrating
I do like Charlie Brooker... I kind of think of him as a slightly more tame Frankie Boyle...
@JonClements It's given me my two favourite sketches (is that the word?) starting with this
Heh... that fighting scene reminds me of the Black Knight sketch in Monty Python and the Holy Grail :)

« first day (3388 days earlier)      last day (1777 days later) »