Posts

Webpack error during vuejs with cypress for e2e test

I am sorry for my bad English skill. I try to write e2e test for vuejs. I am using cypress for that. But there is a problem. This problem is a webpack error. The error occurs after import a thirdy package. My cypress test: import { faker } from '@faker-js/faker'; const username = faker.internet.userName(); const password = faker.internet.password(); it('form elements should be correct', () => { cy.get(userLoginElement.username).type(username).should('have.value', username); cy.get(userLoginElement.password).type(password).should('have.value', password); cy.get(userLoginElement.loginButton).should('exist'); }); My cypress.json file: { "pluginsFile": "tests/e2e/plugins/index.js", "baseUrl": "http://127.0.0.1:8080" } My plugin file of cypress module.exports = (on, config) => { return Object.assign({}, config, { fixturesFolder: 't...

strcmp not working with the same string with file in c

So I have a problem that strcmp not working even the string is same. The cmp between destination and source string is have same string, but when strcmp it, it not working. See the code for explanation: # include <stdio.h> # include <string.h> int main() { FILE *fp; fp = fopen("test.txt", "r"); char namalengkap[100], gender[100], charnamafile[50], tempat[50], temp[1000], tdeeprint[100], gendercheck; int umur, tb, bb, x; int cmp1, cmp2, cmp3, cmp4, cmp5, cmp6, check; float tdeenum; fscanf(fp, "Username : %s\nPassword : %s", tempat, temp); fscanf(fp, "\n\n\n=============================DATA PRIBADI USER===============================\n"); fscanf(fp, "= Nama Lengkap : %52[^\n] =\n", namalengkap); fscanf(fp, "= Jenis Kelamin : %52[^\n] =\n", gender); fscanf(fp, "= Umur : %52d =\n", &umur); fscanf(fp, "= Tinggi Badan (CM) : %...

Context with data from url

I'm trying to make a spotify stats app and I'm trying to make a context to save the token that the app gives you in the url when the user logs in. TokenContext.js: import React, { useEffect, useState } from "react"; // token is the state // logOut and logIn is a function for changing the state. export const TokenContext = React.createContext({ token: "", logOut: () => { }, logIn: () => { } }); function getInitialState() { const token = localStorage.getItem('token') return token ? token : "" } const TokenContextProvider = (props) => { const [token, setToken] = useState(getInitialState); // Use Effect for getting the token form the url and saving it in the local storage useEffect(() => { const hash = window.location.hash let _token = window.localStorage.getItem("token") if (!_token && hash) { _token = hash.substring(1).split("&...

Google Sheet App Script For next LOOP error [closed]

Image
Want to generate a loop for picking next symbols from Table A in Sheet " RANK!R9:S ". Then want to copy every next row symbol to " PF Sheet!B20 " (cell only) for 1st Loop. This is going to generate a new set of values in " PF Sheet!D16:D ", for each value copied to " PF Sheet!B20 " cell. Pl. refer the google Sheet link https://docs.google.com/spreadsheets/d/1r0_oHLTcT9tmTJPgKVgkGwGWhooBM8uluwmWcC92eOk/edit?usp=sharing function permutation() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var rank = ss.getSheetByName('Rank'); var pf_sheet = ss.getSheetByName('PF Sheet'); var symbols = pf_sheet.getRange('B20') var start = rank.getRange('S9'); var end = rank.getRange('S4'); rownum = start.getRowIndex() rowTarget = end.getValue() for (let i = rownum; i <= rowTarget; i++) { var value = rank.getRange(i+1,19,).getValue(); value.getValue().copyTo(symbols()); // wait to...

Functional composition of Optionals

I have 2 Optionals ( potentially containing objects ) that I would like to combine so that I get the following results: || first operand second ++-------------+------------- operand || empty | optional(x) ============||=============|============= empty || empty | optional(x) ------------++-------------+------------- optional(y) || optional(y) |optional(x+y) In other words, a non-empty Optional always replaces/overwrites an empty one, and two non-empty Optionals are combined according to some + function . Initially, I assumed that the standard monadic flatMap() method would do the trick, but (at least in Java) Optional.flatMap() always returns an empty optional when the original Optional was already empty (and I'm not sure if any other implementation would comply with the Monad Laws). Then, as both operands are wrapped in the same monadic type, I figured that this might be a good job for an Applicative Functor. I tried a couple...

Split RDF dataset into two Random datasets

I have an RDF dataset with 100M triples from the watdiv RDF benchmark. How can I split this dataset into two smaller randomly-distributed datasets, each with about 50M triples? While some triples can appear in both datasets. What I can think of, is to order the triples dataset by the predicate, and randomly shuffle and pick out of each predicate triples.

Group By for a Window function

Am stuck in a scenario where I have prices along with date and product id and am running windows functions on top of the prices. What am looking for is that the output should be one row per day with the aggregation and the window functions. Because the source data has multiple rows per day and am using the aggregation and window function to clear that. When am doing group by it says I have to add prices. Why is that? select product_id, DATE(fetch_datetime_utc) AS date, marketplace, source, avg(list_price) OVER( PARTITION by asin, date ORDER BY date ) AS list_price, avg(price) OVER( PARTITION by asin, date ORDER BY date ) AS price, min(price) OVER( PARTITION by asin, date ORDER BY date ) AS min_price, max(price) OVER( PARTITION by asin, date ORDER BY date ) AS max_price from table1 group by productid, DATE(fetch_datetime_utc), market...