Who else can’t wait to see Trump destroy Joe in the first debate?

The Dems are not going to let Biden have a debate..;. They will find or try to find some way to keep the lockdown going so they can be off camera and coach him what to say before he answers. THEY do not want to put him on the same stage as Trump is on because they know he will forget his lines and start running his mouth to  mush when asked a hard question.

front end – Frontend/Backend Integration: Wait for a Google Cloud function to run and then return result

I am trying to create a tool that receives a user input on the front end, uses that input to run a Google Cloud function and then returns a link to the output, hosted on Google cloud as well.

How can you give updates that a process is being performed, and update the page when it is finished?

covid 19 – Should I take any further action to get a refund or is Ryanair telling me I just have to wait?

Follow up on this question of mine.

I have received an e-mail from Ryanair informing me of the cancellation of the flight.

This e-mail, invites me to accept a 12-months valid voucher (which could be however converted to a full refund after those 12 months anyway), but is also reads the following:

If you do not wish to accept this voucher option and wish to move your flight or request a refund, please click here to contact us.

That link, however, only relates to the voucher, and not to the plain refund. (The Chat bot doesn’t help, as it never answers.)

python – I get an IndentationError: wait for an indented block

The error that your function throws at you is due to indentation or bleeding. In python and in other languages ​​like Haskell, they are strictly necessary for the language, in this case Python can be interpreted.

Likewise, your function presents several confusing instructions such as using control structures if-else and the use of print and return. When working with functions, use the instruction to print the instruction on the screen return

Another error that your function has and that resolving the errors mentioned earlier would also not return correct output because you are asking if the type (type) of the two data are identical. In this case, for a input How? 'Or' What: 15 y 42 It will come back that they are the same, when they are not. Indeed, the function evaluates whether the two primitive data types are identical, and in this case, the type is, but the values ​​are not.

Finally, personally, I advise that the variables, classes, methods … that you implement are self-describing (They have a name which we know it refers to reading). You never know if you are going to work with a team of programmers and by analyzing your code you will find variables like a, b, n1 y n2

Full code

def validar_numeros(num1, num2):
  if num1 == num2:
    return "Los valores ingresados son iguales"
  else:
    return "Los valores ingresados no son iguales"

numero1 = int(input("Introduzca un numero entero: "))
numero2 = int(input("Introduzca un segundo número: "))

print(validar_numeros(numero1, numero2))

unit – How can I make one of the agents wait X seconds before starting to move?

Can you do something like that instead?

   //two vars for handling timer
   float timer = 0;
   //notice WaitTime is a float now
   float WaitTime = 10f;       
    void Start()
    {
        agent = GetComponent();

        // Disabling auto-braking allows for continuous movement
        // between points (ie, the agent doesn't slow down as it
        // approaches a destination point).
        agent.autoBraking = false;

        originalPos = transform;
        points.Add(originalPos);

    }

void Update()
{
    // Choose the next destination point when the agent gets
    // close to the current one.
    if (!agent.pathPending && agent.remainingDistance < 1f)
    {
        //if wait to move is true
        if (waitToMove)
        {
            //if timer is less than 10
            if (timer < WaitTime)
            {
                //add Time.deltaTime each time we hit this point
                timer += Time.deltaTime;
            }
            //no longer waiting because timer is greater than 10
            else
            { 

                waitTomove = false;
            }
        } 
        //if we hit here waitToMove is false, so go ahead as usual
        else
        {
            GotoNextPoint();
        }
    }

}

If you want to make the agent wait again after the first time, you will have to set the timer again to 0 and set WaitToMove to true, but you can of course add a little function that handles this, in fact I recommend it .

If you want to randomize the waiting time, you can do something like this

//define min and max WaitTime
float waitMinTime = 1f;
float waitMaxTime = 10f;
void Start()
{
    agent = GetComponent();

    // Disabling auto-braking allows for continuous movement
    // between points (ie, the agent doesn't slow down as it
    // approaches a destination point).
    agent.autoBraking = false;
    //set WaitTime to equal a random number between min and max
    WaitTime = Random.Range(waitMinTime, waitMaxTime);
    originalPos = transform;
    points.Add(originalPos);

}

So you mentioned in the comments that you also want to add the original position of the objects to the end of the list, so once completed, it will return to its starting position, a patrol.

But you don't do that, you add object transformation reference to the list, this transformation is attached to the object so that it is located wherever the object is located, which results in a mini stutter when it comes to the original position AND begins to move between images.

You can test this to see what I mean, leave your code as is, take one of the transformation "points" in your level and move it, the agent moves to where the point is currently correct? Now imagine that this "point" is attached to the agent himself, you might be able to understand why his stuttering!

You must take a snapshot of the position once, and add that I would do something like that.

In addition, because you add a list of transformations and not a list of positions (Vector3), we will have to create a new GameObject (with transformation, they both exist together)

void Start()
{
    agent = GetComponent();

    // Disabling auto-braking allows for continuous movement
    // between points (ie, the agent doesn't slow down as it
    // approaches a destination point).
    agent.autoBraking = false;
    //set WaitTime to equal a random number between min and max
    WaitTime = Random.Range(waitMinTime, waitMaxTime);

    //transforms dont exist without A GameObject and a GameObject doesn't exist without a transform
    //create a new GameObject to hold our position
    GameObject originalPositionObject = new GameObject();
    //set the new gameobjects position equal to where the transform is right now
    originalPositionObject.transform.position = transform.position;
    //add this to the points list instead
    points.Add(originalPositionObject.transform);

}

I hope I understood you correctly!

Conditional wait under independent RV

Let $ X_1, X_2, X_3 $ be independent RVs and $ h: mathbb {R} rightarrow mathbb {R} $ measurable.

Claim: $$ mathbb {E} (h (X_1, X_2) | X_1, X_3) = mathbb {E} (h (X_1, X_2) | X_1). $$

Why?

How long to wait for server statistics?

Basically let's say the server has restarted, the statistics have been reset and count from today. How long do I have to wait before considering the data as "valid" and making decisions based on it? When the data becomes valid for interpretation.

multithreading – Goroutine wait select operation on several channels

I am trying to understand an N / A answer for this question Golang selection statement with channels and waiting group.

The author of the now accepted answer goes on to say that the OP code is almost similar to this, when the function is replaced by the actual code

package main

import (
    "errors"
    "fmt"
)

func main() {
    errs := make(chan error, 1)
    success := make(chan bool, 1)
    errs <- errors.New("Some error")
    success <- true

    select {
    case err := <-errs:
        fmt.Println("error", err)
    case <-success:
        fmt.Println("success")
    }

    select {
    case err := <-errs:
        fmt.Println("error", err)
        // panic(err)
    case <-success:
        fmt.Println("success")
    }
}

What I don't understand is why are there two select wait for operations? I understand that error and bool channels are written at the same time and there could be one managed by the select at all times, but why does OP have two instances select? Would like to understand the reason behind maybe a better way to get the same functionality.

node.js – Mern stack application on error handling, asynchronous wait, capture attempt and SEC avoidance in controller functions

I'm looking for a review of my backend code on how to keep it longer DRY. I see a lot of repetition in the validation part of the email and password, I also need advice if I used the try-catch and async/await correctly. And most importantly, the thing I need to clear is sending the response. Sometimes I get this error from Can't set headers after they are sent to the client. I know this happens when I try to return two responses, but I need a review on how to structure the sending of my response so as not to get this error .

Also, as you can see below, the code that I mainly used:

 catch (error) {
      return next(error)

but when I tried to do the same getUserPosts, I have the same error as that described above. So I had to change it for:

 catch (error) {
      console.log(error)

I don't know if this is a good way to handle errors.


Here is my code with models and controller the functions.

models

User.js

const mongoose = require("mongoose")
const bcrypt = require("bcrypt")
const Schema = mongoose.Schema

const userSchema = new Schema({
    username: { type: String, required: true },
    email: { type: String, reuired: true },
    password: { type: String, required: true },
    posts:({ type: Schema.Types.ObjectId, ref: "Post" })
}, { timestamps: true })


userSchema.methods.confirmPassword = function (password) {
    return bcrypt.compareSync(password, this.password)
}

const User = mongoose.model("User", userSchema)

module.exports = User

Post.js

const mongoose = require("mongoose");
const Schema = mongoose.Schema;
var URLSlug = require("mongoose-slug-generator");

mongoose.plugin(URLSlug);

const postSchema = new Schema({
  title: { type: String, required: true },
  description: { type: String, required: true },
  user: { type: Schema.Types.ObjectId, ref: "User" },
  slug: { type: String, slug: "title" },
}, { timestamps: true }
)

postSchema.pre("save", function (next) {
  this.slug = this.title.split(" ").join("-");
  next();
});

const Post = mongoose.model("Post", postSchema);

module.exports = Post;

usersController.js

const User = require("../models/User")
const auth = require("../utils/auth")
const validator = require("validator")
const bcrypt = require("bcrypt")

module.exports = {
  registerUser: async (req, res, next) => {
    try {
      var { username, email, password } = req.body
      if (password) {
        const salt = bcrypt.genSaltSync(10)
        password = bcrypt.hashSync(password, salt)
      }
      if (!username || !email || !password) {
        return res
          .status(400)
          .json({ message: "Username, email and password are must" })
      }
      if (!validator.isEmail(email)) {
        return res.status(400).json({ message: "Invaid email" })
      }
      if (password.length < 6) {
        return res
          .status(400)
          .json({ message: "Password should be of at least 6 characters" })
      }
      const user = await User.create({ username, email, password })
      if (!user) {
        return res.status(404).json({ error: "No user found " })
      }
      return res.status(200).json({ user })
    } catch (error) {
      return next(error)
    }
  },

  loginUser: async (req, res, next) => {
    try {
      const { email, password } = req.body
      if (!email || !password) {
        return res.status(400).json({ message: "Email and password are must" })
      }
      if (!validator.isEmail(email)) {
        return res.status(400).json({ message: "Invalid email" })
      }
      const user = await User.findOne({ email })
      if (!user) {
        return res.status(404).json({ message: "This email does not exist" })
      }
      if (!user.confirmPassword(password)) {
        return res.status(401).json({ message: "Incorrect password" })
      }
      const token = auth.signToken({ userId: user._id })

      res.status(200).json({ user, token })
    } catch (error) {
      return next(error)
    }
  },

  identifyUser: async (req, res, next) => {
    try {
      const userId = req.user.userId
      const user = await User.findOne({ _id: userId })
      if (!user) {
        return res.status(500).json({ error: "No user found " })
      }
      return res.status(200).json({ user })
    } catch (error) {
      return next(error)
    }
  },

  getUser: async (req, res, next) => {
    try {
      const user = await User.findById(req.params.id)
      if (!user) {
        return res.status(404).json({ message: "User not found" })
      }
      return res.status(200).json({ user })
    } catch (error) {
      return next(error)
    }
  },

  listUsers: async (req, res, next) => {
    try {
      const users = await User.find({})
      if (!users) {
        return res.status(404).json({ message: "No users found" })
      }
      return res.status(200).json({ users })
    } catch (error) {
      return next(error)
    }
  },

  updateUser: async (req, res, next) => {
    try {
      const userData = {
        username: req.body.username,
        email: req.body.email,
        password: req.body.password,
      }
      const user = await User.findByIdAndUpdate(req.params.id, userData, {
        new: true,
      })
      if (!user) {
        return res.status(400).json({ error: "No user found" })
      }
      return res.status(200).json({ user })
    } catch (error) {
      return next(error)
    }
  },

  deleteUser: async (req, res, next) => {
    try {
      const user = await User.findByIdAndDelete(req.params.id)
      if (!user) {
        return res.status(200).json({ error: "No user found" })
      }
      return res.status(200).json({ user })
    } catch (error) {
      return next(error)
    }
  },

  getUserPosts: async (req, res) => {
    try {
      const user = await User.findById(req.params.id).populate("posts")
      if (!user) {
        return res.status(400).json({ error: "No user" })
      }
      return res.status(200).json({ userPosts: user.posts })
    } catch (error) {
      console.log(error)
    }
  }
}

postController.js

const Post = require("../models/Post")
const User = require("../models/User")
const mongoose = require("mongoose")

module.exports = {
  newPost: async (req, res, next) => {
    try {
      const postData = {
        title: req.body.title,
        description: req.body.description,
        user: req.user.userId,
      }
      const post = await Post.create(postData)
      if (!post) {
        return res.status(404).json({ error: "No post found" })
      }
      const user = await User.findById(req.user.userId)
      user.posts.push(post._id) //pushing post document's objectid to the user's posts array
      user.save().then(() => {
        return res.status(200).json({ user })
      })
    } catch (error) {
      return next(error)
    }
  },

  listPosts: async (req, res, next) => {
    try {
      const posts = await Post.find({}).populate("user")
      if (!posts) {
        return res.status(404).json({ error: "No posts found" })
      }
      return res.status(200).json({ posts })
    } catch (err) {
      return next(error)
    }
  },

  getPost: async (req, res) => {
    try {
      const post = await Post.findById(req.params.id)
      if (!post) {
        return res.status(404).json({ message: "No post found " })
      }
      return res.status(200).json({ post })
    } catch (error) {
      return next(error)
    }
  },

  editPost: async (req, res, next) => {
    try {
      const postData = {
        title: req.body.title,
        description: req.body.description,
      }
      const post = await Post.findByIdAndUpdate(req.params.id, postData, {
        new: true,
      })
      if (!post) {
        return res.status(404).json({ message: "No post found " })
      }
      return res.status(200).json({ post })
    } catch (error) {
      return next(error)
    }
  },

  deletePost: async (req, res) => {
    try {
      const post = await Post.findByIdAndDelete(req.params.id)
      if (!post) {
        return res.status(200).json({ error: "No post found" })
      }
      await User.updateOne(
        { _id: mongoose.Types.ObjectId(post.user) },
        { $pull: { posts: mongoose.Types.ObjectId(post._id) } }
      )
      res.status(200).json({ post })
    } catch (error) {
      console.log(error)
    }
  },
}

I would love to learn from mistakes and improve my code. Any help would be appreciated.

Is it normal to wait several days for the manufacturer to contact you?


  1. mfalmog


    Joined:
    Dec 6 2013
    Messages:
    0
    Likes received:
    0

    I'm on the edge of my seat because I finally skipped the wholesaler and had a really good chat with a manufacturer. Their home base is in Hawaii, so the representative took my contact information and told me that another representative who lives in a nearby state would contact me. It's been about two days. I am a virgin at the start of my entrepreneurial journey. Is this a normal phenomenon behind the scenes of the business world? Does it only depend on the company?

    Regards,

    M.M.



  2. marcosa


    Joined:
    Feb 27, 2020
    Messages:
    2
    Likes received:
    0

    It is quite normal to wait for the manufacturer to contact you. This was especially the case for me. But again, make sure that each communication is well secured to avoid losing your hard earned money.