Categories
Cryptocurrency Ethereum Mastering Development

Escrow smart contract. I dont know why i alwasy got error when I call withdraw function

I checked the buyerchocie and sellerchoice. Both of them are not empty but it still shows error and I have to wait seller and buyer to make a choice. Here is my code. Thanks a lot. function withdraw () selleronly dorefund { require(keccak256(abi.encodePacked(trade[sellerorder[msg.sender].buyer].buyerchoice))!=keccak256(abi.encodePacked(""))&& keccak256(abi.encodePacked(trade[sellerorder[msg.sender].buyer].sellerchoice))!=keccak256(abi.encodePacked("")), "Please wait buyer and seller to make choice!"); var amount = […]

Categories
Mastering Development

can’t change python version from visual studio code interpreter

I am trying to change python version from 3.9.0 to 3.7.6 from visual studio code interpreter. But when I checking python version from terminal it’s showing me 3.9.0. see the picture how to switch from 3.9.0 to 3.7.6 in visual studio. see the second picture. it showing notification 3.7.6 at the bottom but when checking […]

Categories
Mastering Development

Python/SqlAlchemy – How to Try Multiple Hostnames in Connection String?

I am trying to establish a connection to our HANA database using SQLAlchemy. We have 3 different hostnames (hostname1, hostname2, and hostname3). If hostname1 connection fails, then I’d like to try hostname2 and if that fails, then try hostname3. I can’t figure out the cleanest way to do this without having embedded try and except […]

Categories
Mastering Development

Writing _.Memoize from underbar in Javascript

I am currently studying Javascript and am doing the underbar project(re-writing the _underbar library). I have solved all of them but one, as I am stuck on _.memoize This is my current code _.memoize = function(func) { var cache = {}; var slice = Array.prototype.slice; return function() { var args = slice.call(arguments); if (args in […]

Categories
Mastering Development

How can I use scanner to read in a user inputted file then read that file into an Array? [duplicate]

public static void main(String[] args) throws IOException{ System.out.println("Please enter the text file:"); FileInputStream inputStream = new FileInputStream("lanky.txt"); Scanner input = new Scanner(inputStream); String file = input.nextLine(); String file2 = input.nextLine(); String file3 = input.nextLine(); String file4 = input.nextLine(); String file5 = input.nextLine(); String file6 = input.nextLine(); String file7 = input.nextLine(); String[] array = null; array […]

Categories
Mastering Development

I am trying to design a password check in C where the user only has 5 attempts to enter the correct password [closed]

I am beginning to learn C for one of my classes and I am just trying to develop a password check that only allows the user five password attempts other wise the code completely stops. So far I have designed the for loop that only allows the user to enter five attempts but I don’t […]

Categories
Mastering Development

Module parse failed: Unexpected character ‘�’ (1:0) You may need an appropriate loader to handle this file type when added jpeg or mp3

I am working on a rails app with vue on front end. I am getting this error when try to add any image or mp3 file to my project. Please help me resolve this issue. Below is my environment.js file. I am using webpack version @rails/webpacker": "^3.2.0" Below is the home.vue file which is causing […]

Categories
Mastering Development

Random Array of Objects & Properties

so I have an array in my code below but one of my requirements for the assignment is to have a very LARGE array of objects around like 10,000 objects. My teacher was saying that the computer can just keep generating random objects for you given how many you want so in my case like […]

Categories
Mastering Development

Compute sets of size n given an array

I’m not sure if my question title makes sense or even if I completely know what I’m trying to get at, but say you are given some letters in an array, and a number n: char[] arr = [‘a’,’b’], n = 4 How can you compute all the permutations of size n? aaaa bbbb abab […]

Categories
Mastering Development

Java code section not working now that it’s in a method: for loop ++i unreachable and if statement not executing

The removeHome code section was working before I moved it into a method. Now it’s saying the ++i is not reachable, and the if statement is not matching when it should. Rather, even though the string should match (123 Sesame St vs 123 Sesame St), they aren’t and the else statement is executing. Both the […]