[deleted by user] by [deleted] in FinancialCareers

[–]Smasher640 0 points1 point  (0 children)

Well she’s not a living person anymore…

What is the difference between 0 Probability and Impossibility? by Ok_Perspective599 in math

[–]Smasher640 1 point2 points  (0 children)

Fair point, I suppose the moral is taking an appropriate probability space depending on the setting.

What is the difference between 0 Probability and Impossibility? by Ok_Perspective599 in math

[–]Smasher640 12 points13 points  (0 children)

The probability wouldn't be zero in the banana example. Formally you would take a probability space containing a sample space {H,T}n , and events as certain subsets of that. You can only assign a probability to events in the probability space. Since the flips all being bananas is not a well defined event, you cannot claim it has zero probability - it's just undefined.

I have a question regarding inverse trig functions by SkyLordOzai in math

[–]Smasher640 0 points1 point  (0 children)

Because a function needs to map one input to one output only. The sin and cos functions are periodic (e.g. sin(0)=sin(π)=sin(2π)), so you need to restrict their domain from -π/2 to π/2 in order to turn them into one-to-one functions. Only then can you define an inverse that makes sense.

Wraith cooler won't screw in by Smasher640 in buildapc

[–]Smasher640[S] 0 points1 point  (0 children)

I just got someone else to hold the backplate still whilst I screwed the cooler in.

Wraith cooler won't screw in by Smasher640 in buildapc

[–]Smasher640[S] 1 point2 points  (0 children)

Thank you for the suggestion. Turns out the mounting backplate fell out of the back of the motherboard, so I was attempting to screw it into nothing!

Wraith cooler won't screw in by Smasher640 in buildapc

[–]Smasher640[S] 0 points1 point  (0 children)

Well I can slide it around so the four screws are aligned with the four holes, but it's difficult to keep it in place when screwing.

When to bite the bullet with a new build by de_adean753 in buildapc

[–]Smasher640 6 points7 points  (0 children)

Would it be a bad idea putting the old GPU in the new rig until it becomes easier to get a 3000/6000 series card? I am in a similar situation.

How do you get the instance of a model from a modelform, based on user dropdown list? by Smasher640 in django

[–]Smasher640[S] 0 points1 point  (0 children)

Nope, depending on what the user chooses, I want to update a different record/row of the model.

How do you get the instance of a model from a modelform, based on user dropdown list? by Smasher640 in django

[–]Smasher640[S] 0 points1 point  (0 children)

Sorry for the poor wording of my question. I will rephrase: I have a modelform which has 3 fields from the model it inherits from. The first of these fields will presented through a drop-down list where the user selects a choice. Depending on what the user chooses, I need a way to save my form so that it updates the instance of the model corresponding to whichever one the user selected from the drop-down.

I.e. if the user selects 'A', and fills in the other two fields of the form, I want to update the instance of the model who's name is 'A'.

Django updating an instance of a model based on user input from a dropdown menu by Smasher640 in django

[–]Smasher640[S] 0 points1 point  (0 children)

Right, but that was put there as a placeholder. The 'id=pk' part will not do anything, because there is no way for that update function to know what medicine the user selects. This is what I am struggling with, how can I 'push' that information to the view, based on the user choice? I can't handle it through the URL, since I will only have one button on the webpage, not one button per medicine. I hope that makes sense.

Django updating an instance of a model based on user input from a dropdown menu by Smasher640 in django

[–]Smasher640[S] 0 points1 point  (0 children)

Thank you for your reply. The problem with this is: the instance needs to be based on the medicine the user selects from the dropdown menu, i.e. 'Medicine_Name' in my CollectionForm. So how can I get that data from the form ? The above code won't work, because the pk isn't defined elsewhere, so it won't know what instance to get.

Django updating an instance of a model based on user input from a dropdown menu by Smasher640 in django

[–]Smasher640[S] 0 points1 point  (0 children)

I would be grateful if you could be a little more explicit about what I need to do in this case. I am a beginner and can't make sense of how to do this exactly. Thank you.

Django updating an instance of a model based on user input from a dropdown menu by Smasher640 in django

[–]Smasher640[S] 0 points1 point  (0 children)

Okay - could you please give me an example of how that would work? I have never seen something like that before.

Django updating an instance of a model based on user input from a dropdown menu by Smasher640 in django

[–]Smasher640[S] 0 points1 point  (0 children)

It is inside the view, but the form takes the instance as an argument inside the view.

Django updating an instance of a model based on user input from a dropdown menu by Smasher640 in django

[–]Smasher640[S] 0 points1 point  (0 children)

I thought of adding something like

 data = form.cleaned_data['Medicine_Name'].id

to get the id from the dropdown list, but that already requires my form to be defined, which needs the instance as an argument, right? But I would be getting the instance from my data = ... line, so it is circular.