Split custom form code into multiple aspx files

If have a custom form. I’m working on including different webpart zones.

What I would like to do is outsource the code for one webpart zone into a seperate .aspx file. Then I’d like to include a link to that file within my original custom form aspx file.

Is that possible? And if yes, how?

regards

Ben

applications – How to avoid AdMob code 3?

I have been developing a small Android app with some ads by AdMob. But for quite some time I am facing an issue that is affecting my app popularity as the target public grows up.

The app lets you play a game if you see an ad. And ads work as expected and are shown normally. The problem is, when I update the app, the ads stop working for some hours. The code of the error is “code 3” which means that everything is ok with the code, but the ad could not be displayed because there was no ad. And from my investigation, this seems to occur when you add a new ad and it is not yet processed by Google. It seems it takes some time to load the ad on the server-side.

The problem is, that this occurs every time I update my app. I am using the same ad id and the ad should be loaded already. How can I avoid this? This is already impacting the few reviews I have in my app.

Have wallet but only 1st name shows up in the Excell file where I saved code?

I bought coins from coinbase and created my wallet in Exodus years ago. Now it is worth 10 times as much, but the Excell file is now corrupt and I can only retrieve 1 of 12 keys. Can someone fix my Excell file?

Using XenForo Code in other applications

Introduction
One of the most-asked questions in the XenForo Dev Section is: How do I access data from XenForo in other applications? Generally speaking, there is two ways you can go about this: If your application is in a different language than PHP, or resides on a different server, you can utilize the built-in API to access most data, and push and pull content from and to your XenForo installation. If you’re on the same server, and your other application is also running PHP, you can…

.

“Python AutoClicker” Part 2 – Code Review Stack Exchange

Your code is generally fine. I suspect you are not doing enough validation (for
example, to forbid negative values or multi-character keys). Also, if you want
to expand your toolkit, you can think about eliminating the duplication in your
code by generalizing the input collection process.

Collecting user input involves a few common elements: an input prompt, a
function to convert the string to a value, a function to validate that value,
an error message in the event of bad input, and possibly some other stuff (max
allowed attempts, fallback/default value in the event of bad input). If we
focus on just the basics, we end up with a function along the lines of this
sketch:

def get_input(convert, validate, prompt, errmsg):
    while True:
        try:
            x = convert(input(prompt + ': '))
            if validate(x):
                return x
            else:
                print(errmsg)
        except ValueError:
            print(errmsg)

With that in hand, all of the algorithmic detail will reside in that single
function, and your main() will be little more than straightforward,
step-by-step orchestration code.

def main():
    key = get_input(
        str.strip,
        lambda s: len(s) == 1,
        'Key to be autopressed',
        'Invalid, must be single character',
    )
    n_clicks = get_input(
        int,
        lambda n: n > 0,
        'Number of autopresses',
        'Invalid, must be positive integer',
    )
    delay = get_input(
        float,
        lambda n: n > 0,
        'Delay between autopresses',
        'Invalid, must be positive float',
    )
    auto_click(key, n_clicks, delay)

As shown in that sketch, I would also encourage you to favor a more compact
style in messages to users. Brevity usually scales better across a variety of
contexts than verbosity: it’s easier to maintain; it’s easier to make
consistent across an entire application; and most people don’t appreciate
having to slog through long messages when an equally clear short one
is possible.

Finally, you might also consider whether input() is the best
mechanism to get this information from the user. In my experience,
it is almost always preferable to take such values from the
command-line, either from sys.argv directly or, more commonly,
using a library like argparse. The advantages
to this approach are numerous.

Where change the size of the window in Bitcoin code?

I already try changeing the height and width parameters of the forms in src/qt/forms but nothing changes, where else i need to look?

javascript – This code renders a time dilation calculator. Am I abusing React state? Can I reorganize my components so that this scales better?

I’ve been learning React for about a month now. I wrote a small (interactive calculator)(1) to show the effects of time dilation under special relativity. It’s Node/React/Razzle(for SSR)/Typescript/Javascript.

Here are the issues I’ve run into and would like help with:

  1. I feel like I’m abusing state. You change one parameter and it cascades through other dependent values which then trigger a recalculation; but because state updates are asynchronous, I have to set awkward artificial callbacks to force a timely update.

  2. Bootstrap prepend and append on input forms take up a lot of space and cause certain calculators to render poorly on mobile… Should I consider using Material UI, or can I “prettify” and resize the input fields appropriately with custom CSS / bootstrap?

  3. Scalability – Currently there are only ~13 components but intend to make a lot more pages and calculators, and I’m wondering if there’s any room for refactoring to take advantage of recurring patterns: it feels like I could be writing a lot less code. Also, routes – the file containing routes could get huge – will that become a problem in the future?

import { ThreeColumnContainer } from "../Layout/ThreeColumnContainer";
import { TextControl } from "../controls/Input";
import { Helmet } from "react-helmet";

const c = 299792.458; //km/s

export class TwinParadoxUnderSpecialRelativity extends Component<{}, { (key: string): number }> {

  constructor(props) {
    super(props);
    this.state = { 
      velocityAsPercentageOfC: 0,
      lorentzFactor: 1,
      velocityInKph: 0,
      velocityInMph: 0,
      contractedElapsedTime: 1,
      dilatedElapsedTime: 1 
    };

    this.calculateLorentzFactor = this.calculateLorentzFactor.bind(this);
    this.updateVelocity = this.updateVelocity.bind(this);
    this.updateLorentzFactor = this.updateLorentzFactor.bind(this);
    this.calculateVelocityAsPercentageOfC = this.calculateVelocityAsPercentageOfC.bind(this); 
    this.calculateTimeDilation = this.calculateTimeDilation.bind(this);
    this.updateElapsedTime = this.updateElapsedTime.bind(this);
    this.updateTravelerElapsedTime = this.updateTravelerElapsedTime.bind(this);
    this.calculateTimeContraction = this.calculateTimeContraction.bind(this); 
  }



  updateVelocity(e) {
    var velocityAsPctOfC = e.target.value;
    var lorentzF = this.calculateLorentzFactor(velocityAsPctOfC);
    var kph = this.convertToKmh(velocityAsPctOfC);
    var mph = this.convertToMph(kph)
    //var dilatedTime = 
    this.setState({ velocityAsPercentageOfC: velocityAsPctOfC, lorentzFactor: lorentzF, velocityInKph: kph, velocityInMph: mph},
      () => this.setState({dilatedElapsedTime: this.calculateTimeDilation(this.state.contractedElapsedTime, lorentzF)}));
  }

  updateLorentzFactor(e) {
    var lorentzF = e.target.value;
    var velocityAsPctOfC = this.calculateVelocityAsPercentageOfC(lorentzF);
    var kph = this.convertToKmh(velocityAsPctOfC);
    var mph = this.convertToMph(kph)
    //var dilatedTime = this.calculateTimeDilation(this.state.elapsedTime);
    this.setState({ velocityAsPercentageOfC: velocityAsPctOfC, lorentzFactor: lorentzF, velocityInKph: kph, velocityInMph: mph},
      () => this.setState({dilatedElapsedTime: this.calculateTimeDilation(this.state.contractedElapsedTime, lorentzF)}));
  }

  updateTravelerElapsedTime(e) {
    var elapsed = e.target.value;
    this.setState({contractedElapsedTime: elapsed},
      () => this.setState({dilatedElapsedTime: this.calculateTimeDilation(this.state.contractedElapsedTime, this.state.lorentzFactor)}));
  }

  updateElapsedTime(e) {
    var dilatedTime = e.target.value;
    this.setState({ dilatedElapsedTime: dilatedTime },
     () => this.setState({contractedElapsedTime: this.calculateTimeContraction(this.state.dilatedElapsedTime, this.state.lorentzFactor)}));
  }

  calculateLorentzFactor(velocityAsPercentageOfC: number) {
    return 1 / Math.sqrt( 1 - ( Math.pow( velocityAsPercentageOfC / 100, 2) ) );
  }

  calculateVelocityAsPercentageOfC(lorentzFactor: number) {
    return Math.sqrt(-1 * (Math.pow(1/lorentzFactor, 2) -1)) * 100;
  }

  convertToKmh(velocityAsPercentageOfC: number){
    return velocityAsPercentageOfC * c;
  }

  convertToMph(kilometersPerHour: number)
  {
    return kilometersPerHour * 0.621371;
  }

  calculateTimeContraction(contractedElapsedTime: number, lorentzFactor: number)
  {
    return contractedElapsedTime / lorentzFactor;
  }

  calculateTimeDilation(dilatedElapsedTime: number, lorentzFactor: number)
  {
    return dilatedElapsedTime * lorentzFactor;
  }

  roundNumber = (num: number, dec: number) => {
    return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
  }


  renderLeft() {
    return (
      <div>
        <h1>Twin Paradox (Time Dilation under SR) Calculator</h1>
        <p/>
        <TextControl prepend="Relative velocity as % of c" type="number" value={this.state.velocityAsPercentageOfC} append="v" onChange={this.updateVelocity} />
        <TextControl prepend="Lorentz Factor" type="number" value={this.state.lorentzFactor} append="gamma" onChange={this.updateLorentzFactor} />
        <TextControl prepend="Velocity in kph" type="number" value={this.state.velocityInKph} append="kph" readonly="true" />
        <TextControl prepend="Velocity in mph" type="number" value={this.state.velocityInMph} append="mph" readonly="true" />
        <TextControl prepend="Earth Observer Elapsed Time" type="number" value={this.state.dilatedElapsedTime} append="Tb" onChange={this.updateElapsedTime} />
        <TextControl prepend="Spaceship Traveler Elapsed Time" type="number" value={this.state.contractedElapsedTime} append="Ta" onChange={this.updateTravelerElapsedTime}/>
        <p></p>
        <h4>Explanation</h4>
        <p>At {this.roundNumber(this.state.velocityAsPercentageOfC,0)}% of the speed of light (c), the lorentz factor or gamma is {this.roundNumber(this.state.lorentzFactor,4)}. That means a twin traveling through space will age at {this.roundNumber(1 / this.state.lorentzFactor * 100,4)}% the rate of its twin at relative rest on earth. If {this.roundNumber(this.state.dilatedElapsedTime,4)} units of time have passed on earth, {this.roundNumber(this.state.contractedElapsedTime,2)} units of time will pass for the space twin. For this to be realistic, the space twin needs to travel at {this.roundNumber(this.state.velocityInMph/1000,0)}K miles per hour ({this.roundNumber(this.state.velocityInKph/1000,0)}K kilometers per hour).</p>
        <p>Interestingly, the spaceship - and everything in it - will also contract in length to {this.roundNumber(1 / this.state.lorentzFactor * 100,2)}% of its original length.</p>
      </div >
    );
  }

  renderMiddle() {
    return (
      <div>
        <Helmet>
          <title>Time Dilation Calculator (Twin Paradox)</title>
          <meta name='description' content='Calculate the Lorenz factor based on given velocity or percentage of the speed of light to measure time dilation in special relativity.' />
        </Helmet>
        <h3>Calculate Time Dilation (SR)</h3>
        <p>Time Dilation is the time difference between two clocks or observers moving relative to each other. Time Dilation has practical consequences at very fast relative speeds, in particular for GPS and other satelites. The formula to calculate time dilation is Sqrt(1 - v^2 / c^2) where v is relative velocity and c is the speed of light. The result is called the Lorenz factor.</p>
        <p>Time Dilation means that someone traveling at very high speeds will "experience" time at a slower rate than someone in a frame at rest. So at speeds approaching the speed of light a traveler will age more slowly than someone observing from earth. The closer the traveler gets to the speed of light, the more dramatic the effect, so the traveler could experience and age only a year while everyone on earth ages and experiences eight years.</p>
      </div>
    );
  }

  render() {

    return (
      <div>
        <ThreeColumnContainer
          left={this.renderLeft()} middle={this.renderMiddle()}></ThreeColumnContainer>
      </div >
    );
  }
}```


  (1): https://calc-solver.com/twin-paradox-under-special-relativity-calculator

Can anyone help me convert the following python code to node js or javascript code?

def deleteProducts(ids,m): 

    # Creating an empty dictionary 

    freq = {}       #to count frequency of iids

    for item in ids: 

        if (item in freq): 

            freq(item) += 1

        else: 

            freq(item) = 1

    sortedfreq = sorted(freq.items(), key=lambda x: x(1), reverse=False)    #ids are sorted based repetitions

    uniqueids=len(sortedfreq)   # no of unique ids

    delete=0

    for i in sortedfreq:

        if i(1)<=m:

            delete=delete+1

            m=m-i(1)

        else:

            break

    return uniqueids-delete

I have written the code correct previously it was working but now it’s not . it did solve earlier bu why it’s not working now

enter image description hereHere is the code in the image i m not able to write it here .Plz plz plz help me with it as fast as possible .Plz help me .
And if someone knows other program of newtons divided difference formula plz let me know

javascript – Custom CSS AND JS Plugin not working with js code

I have a JS script which loads chatbot User interface. the scripts works everywhere on the internet except in WordPress. I have tried several other plugins but the issue is same…

<script>
    var str = window.location.href;

    var params={};

    window.location.search

    .replace(/(?&)+((^=&)+)=((^&)*)/gi, function(str,key,value) {

      params(key) = value;

    });

    window.CCHAT_CONFIG = {

      EMBED_TOKEN: typeof(params.token) !== "undefined" && params.token !== null ? params.token : "f0a3dc1f865a4b349a11b78282c2ab0f",

      HOST_URL: "http://18.116.204.111/"

    };

    (function() {

      window.business_name = 'Welcome to DentalChat!';

      window.business_ID = '153';

      window.widgetTimeout = 1;
      window.NAME = "DentalChat"


      var scriptTag = document.createElement('script');

      scriptTag.type = 'text/javascript';

      scriptTag.async = true;

      scriptTag.src = window.CCHAT_CONFIG.HOST_URL + 'loader.js?t='+Math.random();

      var s = document.getElementsByTagName('script')(0);

      s.parentNode.insertBefore(scriptTag, s);

    })();
  </script>