ECMAScript EvaluateCall

If we have the following code block, when we call obj.getX(), which step does this correspond to according to the spec?

How does the js engine evaluate obj.getX() when it comes to setting the this value to the context object on the left hand side?

const obj = {
  x: 1,
  getX() {
    return x
  }
}

The spec states in EvaluateCall

13.3.6.2 EvaluateCall ( func, ref, arguments, tailPosition )

The abstract operation EvaluateCall takes arguments func (an ECMAScript language value), ref (an ECMAScript language value or a Reference Record), arguments (a Parse Node), and tailPosition (a Boolean) and returns either a normal completion containing an ECMAScript language value or an abrupt completion. It performs the following steps when called:

1. If ref is a Reference Record, then
  a. If IsPropertyReference(ref) is true, then
    i. Let thisValue be GetThisValue(ref).
  b. Else,
    i. Let refEnv be ref.[[Base]].
    ii. Assert: refEnv is an Environment Record.
    iii. Let thisValue be refEnv.WithBaseObject().
2. Else,
  a. Let thisValue be undefined.
3. Let argList be ? ArgumentListEvaluation of arguments.
4. If func is not an Object, throw a TypeError exception.
5. If IsCallable(func) is false, throw a TypeError exception.
6. If tailPosition is true, perform PrepareForTailCall().
7. Return ? Call(func, thisValue, argList).

I am having a bit of trouble with this one, I would assume obj.getX() corresponds to 1.a. but the spec associates this step with IsSuperReference. I do not understand what a tail call is, the spec is also not explaining much about where a Reference Record comes from.

Unable to find an element in react test

I have this failing test in my React application but I’ve no idea what it means:

FAIL src/containers/Drivers/Drivers.test.tsx (13.442s)
● Drivers › select values for occupation and relationship

Unable to find an element by: [data-testid="driver-firstName0"]

[36m<body>[39m
  [36m<div>[39m
    [36m<h1[39m
      [33mclass[39m=[32m"a-heading a-heading--1 u-text--center"[39m
      ...
  [36m</div>[39m
[36m</body>[39m

  102 |     fireEvent.click(yesOrNoQuestions[0]);
  103 | 
> 104 |     const firstName = getByTestId('driver-firstName0');
      |                       ^
  105 |     fireEvent.change(firstName, {
  106 |       target: { value: 'Name' }
  107 |     });

  at getElementError (node_modules/dom-testing-library/dist/query-helpers.js:40:10)
  at getAllByTestId (node_modules/dom-testing-library/dist/queries.js:289:45)
  at firstResultOrNull (node_modules/dom-testing-library/dist/query-helpers.js:44:18)
  at getByTestId (node_modules/dom-testing-library/dist/queries.js:296:46)
  at Object.getByTestId (src/containers/Drivers/Drivers.test.tsx:104:23)

Can anyone advise what I might have dome wrong?

How to print a document with the same template per page web asp.net vb

I am new in asp.net using vb.net.

How can i print a document with the same template or header per page?

If the gridview count > 10 then the remaining gridview will be at the 2nd page with the template/header from the first page

Protected Sub PrintGridView(ByVal sender As Object, ByVal e As EventArgs)
        Dim dataGrid As New System.Web.UI.WebControls.GridView
        dataGrid.DataSource = (From lst In _lstPrint Select New With {.Item = lst.Item, .Descricao = lst.TipoComponente, .Certificado = lst.Certificacao, .Corrida = lst.Corrida, .Qtd = lst.Qtd, .UnidMedida = lst.UnidadeMedida})

        Dim obj As New eLVM()
        obj.Id = Integer.Parse(Request.QueryString("id"))
        'Disable Paging if all Pages need to be Printed.
        'Disable Paging.
        dataGrid.AllowPaging = False

        'Re-bind the GridView.
        dataGrid.DataSource = (From lst In _lstPrint Select New With {.Item = lst.Item, .Descricao = lst.TipoComponente, .Certificado = lst.Certificacao, .Corrida = lst.Corrida, .Qtd = lst.Qtd, .UnidMedida = lst.UnidadeMedida})
        dataGrid.DataBind()

        'For Printing Header on each Page.
        dataGrid.UseAccessibleHeader = True
        dataGrid.HeaderRow.TableSection = TableRowSection.TableHeader
        dataGrid.FooterRow.TableSection = TableRowSection.TableFooter
        dataGrid.Attributes("style") = "border-collapse:separate"
        For Each row As GridViewRow In dataGrid.Rows
            If (row.RowIndex + 1) Mod dataGrid.PageSize = 0 AndAlso row.RowIndex <> 0 Then
                row.Attributes("style") = "page-break-after:always;"
            End If
        Next


        Using sw As StringWriter = New StringWriter()
            'Render GridView to HTML.
            Dim hw As HtmlTextWriter = New HtmlTextWriter(sw)
            dataGrid.RenderControl(hw)

            'Enable Paging.
            dataGrid.AllowPaging = True
            'dataGrid.DataSource = _lstPrint
            'dataGrid.DataBind()

            'Remove single quotes to avoid JavaScript error.
            Dim gridHTML As String = sw.ToString().Replace(Environment.NewLine, "")
            Dim gridCSS As String = gridStyles.InnerText.Replace("""", "'").Replace(Environment.NewLine, "")


            'Print the GridView.
            Dim script = "window.onload = function() { PrintGrid('" & gridHTML & "', '" & gridCSS & "'); }"
            ClientScript.RegisterStartupScript([GetType](), "GridPrint", script, True)
        End Using

enter image description here

I want that black part to be at the 2nd page with the continuity of the gridview result

How can I make a program that reads the photo and make an excel for it?

I’m kind of new at these things, so I need your help guys
I want to make a program that reads the places I scribbled in black in the photo and placing them into the scribbled places in excel. It’s going to be like, I will take the photo of the document like in that photo and the scribbled places will go to that excel and I want this excel to be created on my computer. I hope you understood me. What are your advices? which sources are you recommending to me? Is Python enough for this?

**thanks in advance!
**
the document

the excel

How to create a 360 image with clickable (touch) points of interest with a-frame

I have a 360 image where you have to look around to find an element and click on it using your finger on a mobile device.
Is it possible to have a 360 image with clickable interests using A-frame?
I’m aware of this tutorial: https://aframe.io/docs/0.7.0/guides/building-a-360-image-gallery.html
But it’s not exactly the desired effect.

  • There should be no “cursor” in the center
  • A point of interest should be clickable using your finger (or mouse on the computer) even if the point of interest is not in the middle of the screen.

This seems like a basic functionality, but I just can’t seem to get this.
Thanks ahead!

I’ve done multiple tutorials, started from scratch, but I can’t seem to get this to work exactly as described.

How to solve error about execution time in google sheets apps script

I have a code that gets text from an image (URL). it worked perfectly when I tried it with 50 rows, but now I need it to work with over 6500 rows and it stops on number 200 aprox. because of excecution time.

is there a way to make the code work for all 7000 rows?

thanks


function validar() {
  var sh1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("GetTextFromImage");
  var lrow = sh1.getLastRow();
  
  try {
    for(var i = 3;i<=lrow;i++){
    var url = sh1.getRange(i,7).getValue();
    var imageBlob = UrlFetchApp.fetch(url).getBlob();
    var resource = {
      title : imageBlob.getName(),
      mimType : imageBlob.getContentType(),

    }
    var options = {
    ocr : true
    }
    
    var docFile = Drive.Files.insert(resource,imageBlob,options);
    var doc = DocumentApp.openById(docFile.id);
    var text = doc.getBody().getText();
    var newText = text.replace(/ /g, "");
    var finalText = newText.replace (/n/g,"")
       

    sh1.getRange(i,8).setValue(finalText);
  
   

    Drive.Files.remove(docFile.id);
    }
  } catch(error) {
  return;
}

I tried diving the DDBB on less rows, and it worked. buy I expect to do it in online one file.

How to prevent PDF.js CORS?

I am building a web app, and was surprised by the fact that I can’t render almost any pdf from other domains than mine. Is there any way to solve this problem without having to edit the PDF.js files?

I looked into the console, to see a CORS error. I tried to use AllOrigins to proxy the pdf request, but it won’t respond back. It probably doesn’t support it, even if I specify to return the data raw.

react native: floating button in with bottom Navigation?

I’m working on a project were I have to mix bottom navigation with a circular button in the middle of two bottom tab navigation in react native

here’s an Image to describe how I want it to look like:

enter image description here

my code so far:

const { Navigator, Screen } = createBottomTabNavigator<WalletBottomTabNavigatorParamList>();

const BottomTabBar = ({ navigation, state, referralRequest }: any) => (
  <BottomNavigation
    selectedIndex={state.index}
    onSelect={(index) => navigation.navigate(state.routeNames[index])}
    style={{ display: (state.routeNames[state.index]) === "AddReferral" ? 'none' : 'flex' }}
  >
    <BottomNavigationTab
      title={i18n.t("bottomNavigation:requests")}
      icon={IconComponent(evaIcons.team, Colors.black900)}
    />
    <BottomNavigationTab
      title={i18n.t("bottomNavigation:sentRequest")}
      icon={IconComponent(evaIcons.plus, Colors.black900)}
    />
  </BottomNavigation>
);


export const WalletBottomTabNavigator = () => {
  const navigation = useNavigation();


  return (
    <Navigator
      backBehavior="history"
      initialRouteName={'Home'}
      tabBar={(props) => <BottomTabBar {...props}/>}
    >
      <Screen name='Transactions' component={WalletScreen} options={{
        headerTitle: "",
        headerLeft: () => <HeaderRight />,
        headerRight: () => <ProductsButton />,
        title: i18n.t("bottomNavigation:team"),
      }} />
      {/* <Screen name="AddReferral" component={AddNewReferralScreen} options={{
        headerShown: false,
      }}
      /> */}
      <Screen name="Transfer" component={InvitationsScreen} options={{
        headerTitle: "",
        headerLeft: () => <HeaderRight />,
        headerRight: () => <ProductsButton />,
        title: i18n.t("bottomNavigation:requests"),
      }} />
    </Navigator>
  );
};

I want to draw a path on the given image using @shopify/reactnative-skia and then save the drawn part into an image

I want to draw a path on the given image using @shopify/reactnative-skia and then save the drawn part into an image as a clip but its not getting the correct clip image, here is the sample code;

 const surface = Skia.Surface.MakeOffscreen(
            canvasSize.width,
            canvasSize.height
        );

        const currentCanvas = surface?.getCanvas();

        const bounds = path.getBounds();
        const paint = Skia.Paint();
        paint.setAntiAlias(false);

        currentCanvas?.drawImageRect(
            image,
            Skia.XYWHRect(0, 0, image.width(), image.height()),
            Skia.XYWHRect(0, 0, canvasSize.width, canvasSize.height),
            paint
        );

        currentCanvas?.save();

        const clipImage = surface?.makeImageSnapshot(bounds);

canvasSize.width and canvasSize.height is the screen width and height.

And here is the base image:

enter image description here

And cut part size:

enter image description here

Facing issue Is word document read base64 image format

I tried to export HTML content to a Word document, and except for images everything worked fine. Please can you assist to export the base64 image to a Word document?

How to export the base64 image string to a Word document? Is the Word document read in base64 format?

How do I convert the base64 image string to word-read format? or else what can we do.

            
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAFoCAYAAADHMkpRAAAAAXNSR0IArs4c6QAAIABJREFUeF7t3QuYFNWZmore...',

  exportToWord(element, filename = '', removeElement) {
    const body = document.getElementById(element);
    const clone = body.cloneNode(true);
    const removeChildElement = clone.querySelectorAll(removeElement);
    new DocumentFragment().append(...removeChildElement);
    const header =
      "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns='http://www.w3.org/TR/REC-html40'><head><meta charset='utf-8'><title>Export HTML to Word Document</title></head><body>";

    const footer = '</body></html>';

    const html = header + clone.innerHTML + footer;

    const blob = new Blob(['ufeff', html], {
      type: 'application/msword',
    });

    // Specify link url
    const url = ` data:application/vnd.ms-word;charset=utf-8,  ${encodeURIComponent(
      html
    )}`;
    /* eslint-disable no-param-reassign */
    // Specify file name
    filename = filename ? `${filename}.doc` : 'document.doc';

    // Create download link element
    const downloadLink = document.createElement('a');

    document.body.appendChild(downloadLink);

    if (navigator.msSaveOrOpenBlob) {
      navigator.msSaveOrOpenBlob(blob, filename);
    } else {
      // Create a link to the file
      downloadLink.href = url;

      // Setting the file name
      downloadLink.download = filename;

      // triggering the function
      downloadLink.click();
    }

    document.body.removeChild(downloadLink);
  },

Conversion of revieText for movie sentiment analysis

I am converting a ‘reviewText’ column of a dataset using tfidf_vectorizer and countVectorizer but the problem is when i am concatenating thr transformed review column with my dataset, the notebook is getting crashed due to full usage of memory, what should i do?

I tried to fit trAnsform tfidf and countvectorizer

How to keep Main window active while iFrame is focused

In the main window we have an application (that has inactivity time-out in seconds), Main application launches another application inside iFrame. While user is working in the application inside iFrame, Main application window becomes inactive (because focus is on iFrame) and logs-out.

To prevent this from happening, we need to check if there’s a way to manage the session active using javascript.

FYI, we have used Post-message (*) to close iFrame and navigate back on main Window (this shouldn’t be disrupted either).
I thought of using document.getElementById("myText").focus(); with a time-out and loop this way (**). I’m yet to test if this works, but is there a better way to achieve the requirement?

(*)
iFrame window

postMessage("foo", targetOrigin)

Main window

window.addEventListener(   "message",   (event) => {
    if (Message == "foo") //navigate to next page

    // … 


},   false );

(**)

var myVar = setInterval(myTimer, 10000);

      function myTimer() {
        document.getElementById("txt").focus() = true;
      }

FYI, the main application is Siebel. And it has session time-out.

How can I overlay two div using javascript

using a javascript code I can add a script into document that will load a feedier widget into my page.
This widget is into a

<div class = 'feedier-widget__container'></div>

I would like to put this div upon another div

<div class = 'btn_dwld_1'></div>

Is there some code I could use to authomatically overlay these two divs instead of using CSS?
Thank you

HttpServletRequest parameters empty

I can’t understand why in my servlet on my tomcat server, i can print out the parameters taken from a request but when check user == null || user.isEmpty() it gives me true.
This is the code for the servlet class.

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/Login")
@MultipartConfig
public class login extends HttpServlet {
    private static final long serialVersionUID = 1L;
    private Connection conn = null;
    
    public void init() {
        ServletContext ctx = getServletContext();
        
        final String DB_URL = ctx.getInitParameter("dbUrl");
        final String USER = ctx.getInitParameter("dbUser");
        final String PASS = ctx.getInitParameter("dbPass");
        final String DRIVER = ctx.getInitParameter("dbDriver");
        
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            conn = DriverManager.getConnection(DB_URL, USER, PASS);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
        
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String user = request.getParameter("username");
        String password = request.getParameter("password");
        
        if(user == null || password == null || user.isEmpty() || password.isEmpty()) response.getWriter().write("missing fields");
    }
    
    public void destroy() {
        try {
            conn.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    

}

I use javascript XMLHttpRequest to send the post request, and the formdata which contains the parameters.

What do these weird arrays and function do in React Native (JavaScript)? [duplicate]

I am currently building a project for fun , but I am only experienced in Java/Python/C/C++ and languages like that, not front end. I have been looking at other React Native projects and I just want to understand what is going on here.

const [username, setUsername] = useState([]);

const joinResponse = await meteredMeeting.join({

            name: username,

            roomURL: METERED_DOMAIN + "/" + roomName,
        })

setUsername(username)

I am confused about what kind of array is created with

const [username, setUsername] = useState([]);

and how a set function is called. What is going on here ?