class – subclasses with functions having the same name in python

I have two classes in python, and a third which inherits from the first two:

class A():
    def __init__(var1, var2):
        self.var1 = var1
        self.var2 = var2
    def MyFunc():
        #do stuff
class B():
   def __init__(var1):
        self.var1 = var1
    def MyFunc():
        #do other stuff

class C(A,B):
    def __init__(self, var1, var2, var3)
        A.__init__(self,var1, var2)
        B.__init__(self, var3)

As you might notice both classes have different functions bearing the same name. Doing the following:

>>> classC = C(1,2,3)
>>> classC.MyFunc()

Appears to work but I would like to be sure of which MyFunc function I am calling. How do I control which function from my subclasses is being called?

لینک منبع

tidyverse – R modelr: which functions can be applied on a resample output?

R modelr package has a nice set of functions to resample (bootstrap, cross-validate, permute, etc) data multiple times. Instead of copying the resampled data, it keeps pointers to it.

Say I want to compute a simple mean or standard deviation on each resampled data, (how) can I use mean() or sd()? on these datasets, without converting to a data-frame (and I guess doing an effective copy)?

mt <- resample_bootstrap(mtcars[,"mpg", drop=FALSE])

## Wont work

## does work 
lm(mpg~1, data=mt)

It seems that only function lm() can use directly object of class resample? Is it that lm() actually also calling internally anyway?


لینک منبع

list – Excel Assigning functions to text

I am wondering how to do this:

For every F in a list, it means to add 1 to the input number
For every Q in a list, it means to take away 1 from the last output.

For example:
Number = 2
output = 3 -> 1,2,3,4,3

The formula will need to read from different line inputs and then go through the processes of F and Q until it reaches a final output.

Thank You.

لینک منبع

c – Is there a way to define fprintf in terms of printf / simpler functions (easily)?

I’m trying to link a program built with MSVC against a DLL compiled with MinGW. The problem is the DLL assumes the function fprintf exists, but MSVC doesn’t have a definition for it in any of the libraries it links against. I cannot change versions of neither MSVC nor of MinGW, so the only way I can think around the problem is to write my own fprintf, but I would hope there’s a simple implementation that doesn’t require from me to maintain a whole library of code…

لینک منبع

Google Cloud Functions API “Activation steps failed for services [[]]”

I’m attempting to create the basic weather assistant on As part of the documentation I’m directed to set up a Google Cloud account and enable the GC Functions API on the project I’ve created. However, each time I try to enable it, it fails with the following error: “Activation steps failed for services [[]]”

Any advice would be appreciated.

لینک منبع

javascript – Calling functions within a jquery plugin

Hey so i am trying to make my own custom jquery plugin however am having some trouble. to start of with this is some of my code:

(function($) {

    $.fn.catagorySlider = function() {

      var tabElement = $(this).children("li");
      var currentTab = $(this).children(".active");
      var scrollRight = $(this).children(".cat_scroll_right");
      var scrollLeft = $(this).children(".cat_scroll_left");

      var tabNum = 1;

      resizeElement = function (){
        var elementWidth = $('catagory_body_nonscrollable').width();
        $(this).css('width', 100 + 'px');




basically i was trying to create some functions within my catagorySlider function for convenience. The resizeElement function would grab the width of an element on the page and make the target $(this) have that same width (the 100px is in there for testing purposes). at the bottom of my function i would then have a $(window).on(‘load resize’) method to call this resizeElement() function.

Problem is this is not applying a width the my element at all. If i take the $(this).css(‘width’, 100 + ‘px’); out of this function however it works fine.

Is there something i am doing wrong here?

thought id note i am not using a this.each(function(){}; method as i only care about applying this function to a unique class.

لینک منبع

firebase hosting react + firebase functions express

have problem with correct config firebase.json

in folder build have react app,
in firebase functions have app with express

    "rewrites": [
    "source" : "/admin",
    "function" : "app"
    "source": "**",
    "destination": "/index.html"

this works only on safari – in chrome it doesn’t why and how to solve it ?

why this config

    "rewrites": [
    "source" : "/admin/**",
    "function" : "app"

doesn’t work to express app

لینک منبع

QUERY using table valued functions in SQL server Management studio

I am trying to create a function.

   (@teacher_name[nchar]  NOT NULL)

@st TABLE 
([stu_id] [int] NOT NULL,
 [stu_nam] [varchar](255) NULL,
 [stu_dob] [date] NULL,
 [stu_add] [varchar](255) NULL,
 [org] [nvarchar](max) NULL,
 [org_id] [char](10) NULL)



 DECLARE @teacher_id [nvarchar] NOT NULL
 SELECT stu_id=@teacher_id
 FROM dbo.[teacher];


Msg 102, Level 15, State 1, Procedure tedata, Line 16 [Batch Start Line 20]
Incorrect syntax near ‘NOT’.

I am getting the above error. Can you please help me out.

Thanks in Advance

لینک منبع

php – How to prevent from multiple calling onchange functions automatically in javascript?

I have a problem in the code and don’t know why this is happening. I am using multiple functions call on onchange event in javascript. When user enters the values into the fields then other values changed by javascript functions through onchange event. But problem is that where I used an only single function in onchange event then it is working fine for calculations.
On the other hand where multiple functions used for onchange event then both function calls randomly. I need to prevent from that means I want only that single function call which is the need.
Why both functions call and how to call them separately according to needs?

function update_net_amount(){
		var moduleprice = $('#module').val(); 
		var charges = $('#charges').val();
		var amount1 = ( ( parseInt(moduleprice) + parseInt(charges) ) );
		var discount1 = $('#discount').val();
		var netamount1 = amount1 - discount1; 
		$('#netamount1').val( netamount1 );
	function update_net_amount_percentage(){
		var moduleprice = $('#module').val();
		var charges = $('#charges').val();
		var discount = $('#discount1').val();
		var amount1 = ( parseInt(moduleprice) + parseInt(charges) );
		var netamount = ( (amount1 * discount) / 100 );
		var total = amount1 - netamount;
        $('#netamount1').val( total );
	function update_net_amount_percenatge_amount(){
		var moduleprice = $('#module').val();
		var charges = $('#amcpercent').val();
		var netamount = ( (moduleprice * charges) / 100 );
		var amount2 = ( parseInt(moduleprice) + parseInt(netamount) );
		var discount = $('#discount').val();
		var nettotal = amount2 - discount;
        $('#netamount1').val( nettotal );
	function update_net_amount_percenatge_amount_percentage(){
		var moduleprice = $('#module').val();
		var charges = $('#amcpercent').val();
		var netamounts = ( (moduleprice * charges) / 100 );
		var amount3 = ( parseInt(moduleprice) + parseInt(netamounts) );
		var discounts = $('#discount1').val();
		var disamount = (( amount3 * discounts ) / 100 );
		var fulltotal = amount3 - disamount;
		/* discount in % subtracts from amount3 */
<div class="pro-add">
           <form action="" method="post" enctype="multipart/form-data" id="name">
                   <span class="txt-val"><input type="text" name="pro" value="<?php echo $data['fvprojectname']; //from database ?>" disabled="disabled" /></span>
                <span class="txt-val"><input type="text" name="mod" value="<?php echo $data['fvmodulename']; //from database?>" disabled="disabled" /></span><br />
                   <span class="txt-val amc"><input type="text" id="charges" onchange="javascript:update_net_amount();" name="charges" placeholder="amount in rupees only." value="0" /></span>
                   <span class="txt-val amc-per"><input type="text" name="percentcharges" id="amcpercent" onchange="javascript:update_net_amount_percenatge_amount();" placeholder="in %" />&nbsp;%</span>
				   <div class="invoice-table">
                       <table style="border-collapse: collapse; border: 1px solid black; text-align:center; width:130%;">
	                           <td rowspan="2" class="col-all" style="border: 1px solid black; background-color: #00701c; color: #fff; font-weight:bold;">
                               Sr. No.</td>
                               <td rowspan="2" class="col-all" style="border: 1px solid black; background-color: #00701c; color: #fff; font-weight:bold;">			                                Price Per Module</td>
                               <th colspan="3" class="col-all" style="border: 1px solid black; background-color: #00701c; color: #fff; font-weight:bold;">
                               <td colspan="2" class="col-all" style="border: 1px solid black; background-color: #00701c; color: #fff; font-weight:bold;">
                               <td colspan="2" class="col-all" style="border: 0px solid black; background-color: #00701c; color: #fff; font-weight:bold;">
                               Net Amount</td>
                           <?php global $counter; $counter=1; ?>
	                       	<td rowspan="2" style="border: 0px solid black;"><?php echo $counter++; ?></td>
                           <td style="border-collapse: collapse; border: 1px solid black;"><input type="text" id="module" name="price" placeholder="module price." value="<?php echo $data['fiamount']; //from database?>" onchange="javascript:update_net_amount();" /></td>
                               <td colspan="2" style="border-collapse: collapse; border: 1px solid black;"><input type="text" id="discount" onchange="javascript:update_net_amount();update_net_amount_percenatge_amount();" name="discount" class="set-tr" placeholder="enter discount in rupees." /> or&nbsp;&nbsp;
                               <input type="text" id="discount1" onchange="javascript:update_net_amount_percentage();update_net_amount_percenatge_amount_percentage();" name="perdiscount" class="set-tr-per" placeholder="enter discount in %." /></td>
                               <td colspan="2" style="border-collapse: collapse; border: 1px solid black;"><input type="text" id="netamount1" name="net" class="set-tr-net" placeholder="net amount in rupees." value="<?php //echo $data['fiamount']; ?>" onchange="javascript:update_net_amount_percenatge_amount();" /></td>
                   <span class="btn-adding"><input type="submit" name="adding" value="Save" /></span>
                   <span class="btn-cancel"><input type="submit" name="cancel" value="Cancel"  /></span>

How to call functions calling on need the separately onchange event in javascript.

Thanks in advance, please help me.

لینک منبع