[Solved] Strap mode...
 
Notifications
Clear all

[Solved] Strap model object property is empty, but debugging the entire object shows many properties

0 Posts
1 Users
0 Likes
5 Views
0
Topic starter
Steven Matthews Asks: Strap model object property is empty, but debugging the entire object shows many properties
So I have a strapi cron job, and this is part of it:

Code:
const entity = await strapi
  .query("registration")
  .model.query((qb) => {
    qb.where("created_at", ">", emailSendDate);
  })
  .fetch();

strapi.log.debug("entity", entity);
strapi.log.debug("entity type", typeof entity);
strapi.log.debug("entity email", entity["email"]);
strapi.log.debug("entity email", entity.email);

And then I get this response:

Code:
[2021-10-05T03:49:01.012Z] debug entity {"id":98,"email":"example_email@domain.com" ...
[2021-10-05T03:49:01.012Z] debug entity type object
[2021-10-05T03:49:01.012Z] debug entity email undefined
[2021-10-05T03:49:01.012Z] debug entity email undefined

Maybe I am not understanding something here, but shouldn't this be a plain Javascript object? Why am I getting undefined when trying to access the properties?

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

Unreplied Posts

[Solved] File upload server responded with 0 code

Katie Asks: File upload server responded with 0 code
I’ve made a file upload form. When testing it, it keeps saying ‘server responded with 0 code’ and won’t upload the files. How can I get this form to work? Any help is appreciated.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.
 
 
 

[Solved] stuck with nginx config installing wpmu on subdir

Sam Asks: stuck with nginx config installing wpmu on subdir
I want to install WordPress on wp.mydomain.tld/site1 or wp.mydomain.tld/site2 and I have created such record in cloudflare. The fact is that , i’ve successfully installed WordPress, running it. However, after changing the nginx config file i see a blank page.
I ssh into the server, changed /etc/hosts file, did a curl -v, the response status is 200, but the response body is empty.
It seems that nothing is passed to php-fpm.
Here’s my sites-enabled/wordpress $uri $blogname{ ~^(?P/[^/]+/)files/(.) $blogpath ; } map $blogname $blogid{ default -999; #Ref: Nginx Helper #include /var/www/wordpress/wp-content/plugins/nginx-helper/map.conf ; } server { server_name example.com ; root /var/www/example.com/htdocs; index index.php; location ~ ^(/[^/]+)?/files/(.+) { try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2 ; access_log off; log_not_found off; expires max; } #avoid php readfile() location ^~ /blogs.dir { internal; alias /var/www/example.com/htdocs/wp-content/blogs.dir ; access_log off; log_not_found off; expires max; } if (!-e $request_filename) { rewrite /wp-admin$ $scheme://$host$uri/ permanent; rewrite ^(/[^/]+)?(/wp-.) $2 last; rewrite ^(/[^/]+)?(/.*.php) $2 last; } location / { try_files $uri $uri/ /index.php?$args ; } location ~ .php$ { try_files $uri =404; include fastcgi_params; fastcgi_pass php; } #add some rules for static content expiry-headers here }

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Powering 9216 leds @5V, @24V with converters

mrblack Asks: Powering 9216 leds @5V, @24V with converters
I am struggling with a power supply question. I would like to power up and control 9216 LEDs — strips of 144 LEDs/meter (WWA SK6812 – just like the RGB kind). These are powered at 5V and draw 43.2 watts per meter at most (when the three leds are lit up)

Right now I have two solutions to solve this but I am not sure if are OK. My concerns are the following :

  • I don’t want to risk my life. There will be a lot of current in the cables and I want to know what to expect if I get electrocuted, and therefore equip myself with the right gear to avoid any accident. Or maybe I am just too careful and I misunderstood my old physics courses :).
  • I am concerned about cable heating. Which kind of cable should I use for the two different scenarios if one or both are correct?
  • Should I need shielded cables to avoid any data corruption because of powering cable passing nearby the data one?
  • If the lengths of the cables are to big, could I be seeing voltage drops?

You will find attached the schematics of the two solutions I came up with. I am really not an expert in this subject and don’t want to make any mistakes. I hope it’s ok to ask for a question that is probably not that complicated. If you have a simpler solution for this please feel free to share! :)

Cheers!


Circuit powered with 5v


Circuit powered with 24v


EDIT
Improvements after Phil G’s answer

Thank you very much Phil G, I really appreciate your help, and this has helped me A LOT.

I rethought the design of this power supply yesterday. Based on what you were saying about the problems that might occur when daisy chaining the strips, I ran a calculation for the 5v power supplies feeding the strips in parallel.

The project has changed a little and I chose to use 30m of 60 led/m instead. These led strips draw 18w per meter. I need 4 meters between the power supplies and the farthest away strip.

I am not comfortable with AWG since I am in France so I found this formula which works for low voltage :

S = 0.017 x L x I / PT

S = cable section (in mm2) L = length of the cable (back and forth, in meters) I = intensity (in amperes) PT = acceptable voltage drop (in volts)

So for 5 volts, each of the lines carry 18w / 5v = 3.6A I want to loose maximum 2.5% of the voltage. This gives 5 x 0.025 = 0.125V For each power lines : S = 0.017 x (4m x 2) x 3.6A / 0.125V =~ 3,9mm2

This is not possible as the cables would be way to expensive and hardly manageable. Besides, I want to keep things lightweight to be able to reuse the gear. The 5 volts power supplies are to big.

So I went back to the converters solution using two 24v 500w power supplies. This involves longer cables but lower current. I would need 9m cables maximum from the power supplies to the led strips. This way I also need a terminal block that connects all of the lines together. The converters are about 4cm x 3cm x 2cm, so really not that big. They can be put right next to the led strips and power two of them at the time.

For 24 volts, each of the lines carry 18w * 2 / 24v = 1.5A I want to loose maximum 2.5% of the voltage. This gives 24 x 0.025 = 0.6V For each power lines : S = 0.017 x (9m x 2) x 1.5A / 0.6V =~ 0.765mm2

From the power supplies to the terminal blocks : At most, I plug 16 led strips on one power supply -> 16 * 18w / 24v = 12A For each cable -> 0.017 x (0.3m x 2) * 12 / 0.6 = 0.204 mm2

From the converters to the led strips, I use one cable per strip. S = 0.017 x (0.5m x 2) x 3.6A / 0.125V =~ 0.48mm2

I could use 0.75mm2 section cables, but because I want to keep the voltage drops as low as possible I will probably use 1mm2 cables.

Here are the schematics as a sum up.

Do you think that it would work?

Thank’s again!


Schematics of the better power circuit

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] MySqldump Error 2013: Lost Connection MySQL During create database backup

Sayyed Yusuf Raza Asks: MySqldump Error 2013: Lost Connection MySQL During create database backup
I am use Prestashop. am create a script for auto backup of whole database of my site but from last few given this error and backup terminate at this table.

mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table ps_layered_filter_block at row: 107002

am change some value in my.cnf file but not work for me my.cnf file

Code:
#Copyright 2019 Bitnami.com All Rights Reserved

#Note: This file will be modified on server size changes

[mysqld]
net_read_timeout = 1200
net_write_timeout = 1900
wait_timeout = 320
long_query_time = 1
query_cache_limit=20M
query_cache_type=1
query_cache_size=512M
innodb_buffer_pool_size=4096M
innodb_force_recovery = 1
innodb_log_file_size=128M
tmp_table_size=64M
max_connections = 2500
max_user_connections = 2500
innodb_flush_method=O_DIRECT
key_buffer_size=64M

[mysqladmin]
user=root

[mysqld]
sql_mode=NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION
basedir=/opt/bitnami/mysql
datadir="/opt/bitnami/mysql/data"
port=3306
socket=/opt/bitnami/mysql/tmp/mysql.sock
tmpdir=/opt/bitnami/mysql/tmp
max_allowed_packet=512M
bind-address=127.0.0.1
skip-name-resolve=1
default-authentication-plugin=mysql_native_password

character-set-server=UTF8
collation-server=utf8_general_ci
[client]
port=3306
socket=/opt/bitnami/mysql/tmp/mysql.sock

default-character-set=UTF8
[manager]
port=3306
socket=/opt/bitnami/mysql/tmp/mysql.sock
pid-file=/opt/bitnami/mysql/tmp/manager.pid
default-mysqld-path=/opt/bitnami/mysql/bin/mysqld.bin

!include /opt/bitnami/mysql/bitnami/my.cnf

but Problem Stil Same.

mysqldump -u root -p bitnami_prestashop > /home/{username}/dbbackup/db_13_07_2020.sql also try mysqldump -u root -p –extended-insert bitnami_prestashop > /home/{username}/dbbackup/db_13_07_2020.sql

our database size

Code:
| bitnami_prestashop | Size in (MB) |
+--------------------+--------------+
| bitnami_prestashop | 8515.77 |
|
| information_schema | 0.16 |
| mysql | 3.82 |
| performance_schema | 0.00 |
| sys | 0.02 |
+--------------------+--------------+```

**on-disk** size

11G /opt/bitnami/mysql/data/bitnami_prestashop
21M /opt/bitnami/mysql/data/mysql
11G /opt/bitnami/mysql/data

Please Provide solution as soon as posibal thanks

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Can someone verify this answer: gasLimit vs. minGasLimit

stone.212 Asks: Can someone verify this answer: gasLimit vs. minGasLimit
I would have thought that these are the upper and lower bounds of how much gas can be used in any one transaction. But the mainnet file has the same value for each of these. Can someone explain what these values actually mean?

(Hint: please don’t provide the same link to the same thread that fails to explain these. I mean this one: What does each genesis.json parameter mean?)

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] How can a DAO manage a domain, Twitter account, Github commit rights in a trustless manner?

Mars Robertson Asks: How can a DAO manage a domain, Twitter account, Github commit rights in a trustless manner?
With managing on-chain assets the Vault / Tresury controlled by DAO works.

With other digital assets, such as WWW domain, there is still a single human who uses GoDaddy.

Is there any technical feasibility for DAO to control the domain, ensuring that not a single human (rogue admin) can destroy the existing brand?


I was thinking about putting some bond system.

Whoever controls an important function that is not compatible with DAO, posts a 1000 DAI to keep them accountable.

(don’t trust, verify)

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Link a library to a smart contract only with Solidity and bytecode

Alireza Asks: Link a library to a smart contract only with Solidity and bytecode
I work in Truffle development environment and use Windows PowerShell. My Solidity code is a test code and is simple. There is a library called Alireza that just compares two uint values. There is a contract called B that just uses the library function to compare two uint values. Now, i need to link Alireza to B. For that

  1. I embedded using-for command in B.
  2. I deployed Alireza and got its address.
  3. I tried to deploy B to create its bytecode. As one expects, the deplyoment failed.
  4. I embedded Alireza‘s address to B‘s bytecode. Because, as i searched, it is a way to link.
  5. I tried to deploy B again and it failed again.

Is this work flow correct? i don’t know. So, i intent to try another way that here mentioned:

  1. I tried to embed the hash of Alireza‘s title or directory to B‘s bytecode. Just like:

    Code:
     --$12b85d948918b1e5773c9bc099694fc73b$--

  2. I tried to deploy B again and again the deployment failed.

Even, before all ways i mentioned, i deployed B without deployment of Alireza before that. Because i thought maybe, by this way, the compiler would create the link. But, the below error emerges:

Code:
Error: B contains unresolved libraries. You must deploy and link the following libraries before you can deploy a new version of B: Alireza

Am i in a correct way? Where is my problem? How can i link a library to a contract just by Solidity and contract’s bytecode and without node-js? How should i alter my work flow to link?

My whole code:

Code:
pragma solidity ^0.5.12;

library Alireza{

    function comparison(uint a, uint b) view public returns(bool){  
        if(a==b){
            return true;
        }else{
            return false;
        }
    }
}

contract B{

    using Alireza for uint;

    function assessment(uint m, uint n) view public returns(bool){
        return m.comparison(n);
    }
}

Thank you.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] What does this parameter mean in this curve fi function?

DeviousDev Asks: What does this parameter mean in this curve fi function?
I am trying to add 22 dai to a polygon curve pool. Here is the function I am using:
enter image description here

If I am trying to add 22 dai into the pool, what do I put for the parameters? Thanks!

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] How to implement HArmony VRF?

Kiro Bash Asks: How to implement HArmony VRF?
First post. I am wondering how can I implement VRF into my code below. I am not too sureIF I can do IT I added the function but I dont know how to tie in the randomness to the info I provided.

Code:
pragma solidity ^0.8.0;

import “@openzeppelin/contracts/token/ERC721/ERC721.sol”;

contract Halos { enum Zodiac {Aries, Taurus, Gemini, Cancer, Leo, VIrgo,Libra, Scorpio, Sagittarius, CapriCorn, Aquarius, Pisces} enum Abilities {Sword, Axe, Wand, Gun, Hammer, Fist}

Code:
struct Halo {string name;
                  bool isCharacter;
                  uint dna;
                  Zodiac[] power; 
                  Abilities[] ability;                  
    }

mapping(address => Halo) public halos;
address[] public characters;

modifier onlyIfRegistered() {
    require(halos[msg.sender].isCharacter);
    _;
}

function register() public returns(bool success) {
    require(!halos[msg.sender].isCharacter);
    characters.push(msg.sender);
    halos[msg.sender].isCharacter = true;
    return true;
}

function addPower(Zodiac a) public onlyIfRegistered returns(bool success) {
    halos[msg.sender].power.push(a);
    return true;
}

function getPower(address player, uint row) public view returns(Zodiac power) {
    return halos[player].power[row];
}

function vrf() public view returns (bytes32 result) {
    uint[1] memory bn;
    bn[0] = block.number;
    assembly {
      let memPtr := mload(0x40)
      if iszero(staticcall(not(0), 0xff, bn, 0x20, memPtr, 0x20)) {
        invalid()
      }
      result := mload(memPtr)
    }
  }

}

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] TypeError: Type tuple() is not implicitly convertible to expected type uint256. userStructs[userAddress].index = userIndex.push(userAddress)

Raman Asks: TypeError: Type tuple() is not implicitly convertible to expected type uint256. userStructs[userAddress].index = userIndex.push(userAddress) – 1;

Code:
pragma solidity ^0.6.0;

contract UserCrud{
    struct userStruct{
        uint userAge;
        uint index;
        bytes32 userName;
        bytes32 userEmail;
    }
    mapping(address => userStruct) private userStructs;
    address[] private userIndex;

    function insertUser(
    address userAddress,
    uint userAge,
    bytes32 userName,
    bytes32 userEmail) public returns (uint index) {
        require(!isUser(userAddress));
        userStructs[userAddress].userAge = userAge;
        userStructs[userAddress].userName = userName;
        userStructs[userAddress].userEmail = userEmail;
        userStructs[userAddress].index = userIndex.push(userAddress) - 1; //error in this line
}

I got this code from an article regarding Solidity CRUD and was doing some modifications, but I’m facing an error as follows:

TypeError: Type tuple() is not implicitly convertible to expected type uint256. userStructs[userAddress].index = userIndex.push(userAddress) – 1;

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

Share: