mercredi 1 novembre 2017

Redirect to 400 on xmlhttprequest

I am posting using xmlhttprequest as follows

// xhr response handler
xhr.onreadystatechange = function () {
    if (xhr.status == 200 && xhr.readyState == 4) {


        handleSuccess(xhr.responseText);

    } else if (xhr.status == 400) {
        console.log("400000000000000000000");
        // alert("Unable to process data");
        // window.location.reload();
        sendRequestSimple("400.html");
        // fetch("/400")
        //     .then(function() {
        //         console.log("ok");
        //     }).catch(function() {
        //     console.log("error");
        // });
    }
    else {
        console.trace("status: " + xhr.status);
        console.trace("readystate: " + xhr.readyState);
    }
};

// Send the Data.
xhr.send(formData);

I am unable to get it to redirect to 400 error page in an error scenario. What is the correct way? As coded above..it will not redirect.

Many thanks in advance




What 'includes' folder is for?

I've noticed that a lot of websites have 'includes' folder. What is this folder for? I've tried to google it, but it always points to WordPress includes folder.




What is the work of '?' in PHP? [duplicate]

This question already has an answer here:

$firstname = !empty($_POST['firstname'])?$_POST['firstname']:'';

In This code what is the work of '?'.




Device Detection via hardware model name/identifier

We have some model numbers of devices. We need to resolve this names to usable device names. e.g. SM-G950F is Samsung Galaxy S4 and iPhone9,3 is iPhone 7

Ist there a list or service available which provides something like this. We checked 51 degress and deviceAtlas but the result isn't that good.




Is there a configuration on IIS to avoid showing "A potentially dangerous Request.Path value was detected from the client (:)."

I also searched the exception message on StackOverflow and the returned answers were not my cases.

Let's see my cases.

  1. I access to a direct URL which ":." (without quotes) symbols are appened to my web application name: http://localhost/mywebapp:.

  2. Access to *.aspx pages appended ":." symbols and the URL does not include the web application name http://localhost/Default.aspx:.

In this cases, the exception occurs before entering my web application. (I did debug my web application at Application_Start, Application_Error and the debugger did not hit to it)

So, guys, is there any configuration that I can apply for IIS server to avoid this exception. I don't want to show the yellow exception page like this to the end users. I want to show a general message instead of it.

enter image description here




How to Populate A Web-Based Application Form from Excel with VBA?

Current Situation: I have a very repetitive job for almost 8 years, processing hundreds and thousands of applications every single day. Every morning I will be handled with an Excel Sheet with about 10 variables (ex: First Name, Last Name, DOB, Address etc) and I am required to open a web-based application form with Google Chrome, fill in and submit the form based on the Excel sheet 1 by 1. I have no life! :'(

VBA Skill Level: Beginner - Able to understand simple commands and fundamentals of VBA.


My question is: Is it possible to create a macro that will automatically pull data from my excel sheet and populate related fields in the web-based application form?

If Yes, how many programming languages required to make this happen and is it realistic for me to create it in 2 weeks time?

Thank you so much for your time. Appreciate it....!




I have both freelancer & regular job work experiences, so how can I mention this in my resume?

I have 3 years of experience as a freelance web developer as well as I have 6 months of experience in a regular job too, so how can I mention this in my resume?