Approval Process error : MANAGER_NOT_DEFINED

I have an approval process in place for object K__c.
In this approval process Next Automated Approver Determined By : Manager of Record Submitter

Now I want to set the Approver to a particular user u1 so i’m executing the following piece of code from developer console :

List requests = new List();Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();

            req.setComments('Approving KOL.');
            req.setObjectId('a4b2400000001eu');
            req.setNextApproverIds(new List{'00524000001SdlVAAS'});
            requests.add(req);List results = Approval.process(requests);

When this code is getting executed, the record enters into the approval process, but the Approver is set to some different user, ux, not in any connection with the role hierarchy of desired user u1.

Then I deactivated the user ux and executed the same code and error comes out:

System.DmlException: Process failed. First exception on row 0; first error: MANAGER_NOT_DEFINED, Manager undefined.: []

Please suggest.

ERC-20 Token Transfer Error (Unable to locate Corresponding Transfer Event Logs), Check with Sender when…

I am trying to transfer ERC721 tokens from one account to another on Ropsten network. I do this by creating raw transaction, signing and broadcasting transactions

I created the transaction this way

{
    "nonce": "0x4",
    "gasPrice": "0x3b9aca00",
    "gasLimit": "0x29110",
    "to": "0x6a19c61345a7ba6231fec3f6265b9313d0ee8d3f",
    "value": "0x00",
    "data": "0xa9059cbb000000000000000000000000e59c1bf4dae87b492b7580ccbb063781cf6f10e90000000000000000000000000000000000000000000000000000000000000001",
    "chainId": "0x3"
}

I constructed data in this manner.

var abi = require('human-standard-token-abi');
var contract = this.web3.eth.contract(abi).at(contractAddress);
var txdata =  contract.transfer.getData(toAddress,tokenId);

When I sign this raw transaction and broadcast it and send it to the same address, the transaction is successful. But, when I send it to a different address, I see this error etherscan

ERC-20 Token Transfer Error (Unable to locate Corresponding Transfer Event Logs), Check with Sender. 

I understand this means the contract execution failed. But

1. Why does it say `ERC-20` tokens when I am actually trying to send `ERC-721` tokens.
2. I have made sure that the sending account has enough ether and the tokens which I am trying to send. What could be the cause of this issue?

(Remix IDE) Getting VM error: invalid opcode in Javascript VM,

I’m creating an ERC20 token that will have 9 separate funding rounds. When I call the startNextRound function in the JavaScript VM, I get the following error:

transact to browser/SatanCoin.sol:SatanCoin.startNextRound errored: VM error: invalid opcode.
    The constructor should be payable if you send value.
    The execution might have thrown.
    Debug the transaction to get more information. 
creation of browser/SatanCoin.sol:SatanCoin pending... 

When I deployed the same contract on Rinkeby through Remix and called the same function, the transaction ran out of gas:

transact to browser/SatanCoin.sol:SatanCoin.startNextRound errored: Gas required exceeds limit: 3000000.  An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that's also the reason of strong gas estimation)

When I use the Remix debugger, it tells me the function is stopping at require(msg.sender == owner);. What exactly is going wrong here?

Here’s the code. I’m inheriting StandardToken from openZepplin.

contract TestCoin is StandardToken {


  uint256 public rate = 0.0666 ether; //Each Testcoin will be worth .0666 ETH, Must be bought in exact increments
  address public owner = msg.sender;

  bool public roundActive = false; //only allows buying during a round
  uint public roundNum = 0;//current round number out of 9
  uint public roundMax = 74;//max number of tokens to be issued every round
  uint public roundIssued;//number of tokens issued during current or previous round
  address[] roundBuyers; //buyer address is recorded for every token issued

  modifier onlyOwner {
      require(msg.sender == owner);
      _;
  }

  event Raffled(uint roundNumber, address winner, uint amount);
  event RoundStart(uint roundNumber);


  function name() constant returns (string) { return "TestCoin"; }
  function symbol() constant returns (string) { return "TEST"; }
  function decimals() constant returns (uint8) { return 0; }


  function startNextRound()
    public
  {
      require(msg.sender == owner);
      assert(endPreviousRound()); //end the previous round before starting the next
      require(roundNum<9); //only 9 rounds may occur

      roundActive = true;
      roundBuyers = new address[](74);
      roundIssued = 0;
      roundNum++;

      RoundStart(roundNum);
  }

  function endPreviousRound()
    private
    returns (bool)
  {
      //raffles off remaining tokens if any are left
      if(roundIssued < roundMax) assert(raffle(amountRemaining()));
      roundActive = false;
      return true;
  }

  //raffles off remainig tokens to a random buyer from the previous round
  //the more tokens a buyer has, the greater their chance to win
  function raffle(uint raffleAmount)
    private
    returns (bool)
  {
    uint randomIndex = uint(block.blockhash(block.number))%(roundMax-raffleAmount)+1;
    mint(roundBuyers[randomIndex], raffleAmount);

    Raffled(roundNum, roundBuyers[randomIndex], raffleAmount);
  }

  function mint(address receiver, uint amount) 
    private
  {

    totalSupply = safeAdd(totalSupply, amount);
    balances[receiver] = safeAdd(balances[receiver], amount);

    for(uint i = 0; i < amount; i++) {
      roundBuyers[roundIssued+i] = receiver;
    }

    roundIssued = safeAdd(roundIssued, amount);

    // This will make the mint transaction apper in EtherScan.io
    Minted(receiver, amount);
   }

  //This function is called when Ether is sent to the contract address
  //Even if 0 ether is sent.
  function () payable {
    //If value is zero or not multiple of the rate, refund user. 
    if (msg.value <= 0 || (msg.value % rate) != 0) revert(); 

    uint tokenAmount = safeDiv(msg.value, rate);

    //Make sure there is an active round
    if(roundActive == false) revert();
    //Make sure a buyer can't buy more than round amount availible.
    if (tokenAmount > amountRemaining()) revert();
    //Make sure that no more than 666 TestCoins can be issued.
    if ((tokenAmount+totalSupply) > 666) revert();
    //Extra precaution to contract attack
    if (tokenAmount < 1) revert();  

    mint(msg.sender, tokenAmount);
    owner.transfer(msg.value);          //Send the ETH
  }  

  //returns number of tokens left to be issued in current round
  function amountRemaining()
    public
    constant
    returns (uint)
  {
    return (roundMax-roundIssued);
  }

}

WordPress Dashboard Error [on hold]

My site working well. Suddenly when I clicked on admin side dashboard link i got there two errors.

Please help me how to remove it.

Warning: require(/home/qnfx7li6j0v5/public_html/rajasthanevent.com/wp-admin/wp-blog-header.php): failed to open stream: No such file or directory in /home/qnfx7li6j0v5/public_html/rajasthanevent.com/wp-admin/index.php on line 18


Fatal error: require(): Failed opening required ‘/home/qnfx7li6j0v5/public_html/rajasthanevent.com/wp-admin/wp-blog-header.php’ (include_path=’.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php’) in /home/qnfx7li6j0v5/public_html/rajasthanevent.com/wp-admin/index.php on line 18

Time Machine stops after a few gigabytes, without any visible error message

I had to reinstall macOS recently, and ever since, I am not able to back up. After a Prepare phase, it gets to backing up some 5-6 Gigabytes (if I am lucky), then it stops (“Stopping…” as seen in preferences). It was working perfectly before.

  • I am using High Sierra 10.13.3.
  • I am on APFS
  • I am trying to backup to a Time Capsule (firmware version 7.6.9) over wi-fi
  • I am using a MacBook Air from 2012
  • I have tried restarting Time Capsule (which triggers an fsck)
  • I have tried to reuse same backup as before, or create an entirely new backup
  • I am trying to use an encrypted backup (backing up without encryption is not an option for me)
  • I have tried excluding system folders from backup so that only /Users remains

As I said, there are no visible errors. In the system log I see some messages, although I am not sure what to do with them (there is no problem reading mentioned file, and I am not sure why it wants to copy to (null), maybe it has lost connection or something, but the situation is not clear).

Error: (-36) SrcErr:YES Copying /Volumes/com.apple.TimeMachine.localsnapshots/Backups.backupdb/R'lyeh/2018-02-08-110642/R'lyeh/Users/zsszatmari/projects/servehome/node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-es2015-classes/node_modules/babel-template/node_modules/lodash/function/rearg.js to (null)
Failed to unmount disk mounted at '/Volumes/com.apple.TimeMachine.localsnapshots/Backups.backupdb/R'lyeh/2018-02-08-094426/R'lyeh', error: {
    Action = Unmount;
    Target = "file:///Volumes/com.apple.TimeMachine.localsnapshots/Backups.backupdb/R'lyeh/2018-02-08-094426/R'lyeh";
}
Failed to delete APFS snapshot with name 'com.apple.TimeMachine.2018-02-08-094426' on volume '/', error: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"

Also:

$ log show --predicate 'subsystem == "com.apple.TimeMachine"' --info | grep 'Backup failed'
2018-02-07 09:45:49.644125+0100 0x8da43    Error       0x41fd0              10549  14   backupd: (TimeMachine) [com.apple.TimeMachine:TMLogError] Backup failed because a backup source disk was ejected or disconnected unexpectedly!
2018-02-07 09:45:49.678109+0100 0x8da43    Error       0x41fd0              10549  14   backupd: (TimeMachine) [com.apple.TimeMachine:TMLogError] Backup failed with error 37: 37
2018-02-07 10:01:14.923986+0100 0x95f8f    Error       0x450cc              11759  14   backupd: (TimeMachine) [com.apple.TimeMachine:TMLogError] Backup failed with error 50: 50
2018-02-07 10:37:38.571642+0100 0xa06e0    Error       0x0                  12807  14   backupd: (TimeMachine) [com.apple.TimeMachine:TMLogError] Backup failed with error 19: The backup disk could not be resolved, or there was a problem mounting it.
2018-02-07 13:26:23.305069+0100 0xa5320    Error       0x0                  13003  14   backupd: (TimeMachine) [com.apple.TimeMachine:TMLogError] Backup failed with error 18: The backup disk could not be found.

I am not sure why would it think that the backup source (the boot drive) is ejected, or why would there be a problem mounting the backup drive.

Thank You.

“device not accepting address X, error -32” when connecting webcam

When trying to plug in a USB webcam (Logitech QuickCam Pro 3000) to my Raspberry Pi, I’m getting some wonky errors:

[    3.073211] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
[    3.593168] usb 1-1.2: device not accepting address 4, error -32
[    3.693183] usb 1-1.2: new full-speed USB device number 5 using dwc_otg
[    4.223146] usb 1-1.2: device not accepting address 5, error -32
[    4.333124] usb 1-1.2: new full-speed USB device number 6 using dwc_otg
[    4.783152] usb 1-1.2: device not accepting address 6, error -32
[    4.903162] usb 1-1.2: new full-speed USB device number 7 using dwc_otg
[    5.363167] usb 1-1.2: device not accepting address 7, error -32
[    5.388312] usb 1-1-port2: unable to enumerate USB device

Everything works great when I plug it into my Linux laptop:

[ 7730.081964] usb 3-3: new full-speed USB device number 2 using ohci-pci
[ 7730.308214] usb 3-3: New USB device found, idVendor=046d, idProduct=08b0
[ 7730.308227] usb 3-3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 7730.408153] pwc: Logitech QuickCam Pro 3000 USB webcam detected.
[ 7730.779493] pwc: Registered as video1.
[ 7730.779684] input: PWC snapshot button as /devices/pci0000:00/0000:00:12.0/usb3/3-3/input/input14
[ 7730.783717] usbcore: registered new interface driver Philips webcam
[ 7730.918441] usbcore: registered new interface driver snd-usb-audio

The Pi should be fully upgraded, and is hooked up to a 2A USB charger.

$ uname -a
Linux raspberry01 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux

Also tried upgrading the kernel manually, same problem:

$ uname -a
Linux raspberry01 4.4.31+ #922 Mon Nov 14 15:31:57 GMT 2016 armv6l GNU/Linux

The port works, I tried it with a USB keyboard earlier and also swapped the camera and the WiFi dongle around. So, how can I go about getting my Pi to accept this 10+ years old camera?

Error Converting circular structure to JSON

Al listar los elementos en la base de datos me aparece el error “Converting circular structure to JSON”, como lo puedo solucionar?

Modelo BD

const mongoose = require('mongoose');
const {Schema} = mongoose;

const PostSchema = new Schema({
    text: { type: String, required: true},
    created_at: Date,
});

module.exports = mongoose.model('Post', PostSchema);

Listar los datos

 import express from 'express';
 const router = express.Router();
 const Post = require('../model/post');


  //todos los post
 router.get('/posts', function (_req, res) {
        const mini = Post.find();
        res.json(mini);
    });
 module.exports = router;

How to fix “The link you followed has expired” error after creating a new site on WordPress Mutlisite?

I am using a VPS that hosts a WordPress Multisite (subdomains) instance.

Everything seems to be working apart from the fact I can’t add a new site.

After I fill in the required details and press “add site” I am presented with a page that states “The link you followed has expired.” and a link to try it again.

I can’t seem to find anything about this topic.

Here is the config file:

server {
        listen 80;
        server_name www.domain.name domain.name *.domain.name;

        return 301 https://www.domain.name$request_uri;
}

server {
        listen 443 ssl;
        server_name domain.name;

        ssl_certificate /etc/letsencrypt/live/domain.name/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/domain.name/privkey.pem;
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

        return 301 https://www.domain.name$request_uri;
}

server {
        listen 443 ssl;
        server_name www.domain.name;

        root /var/www/wordpress;

    access_log /var/log/nginx/domain.name.access.log;
    error_log /var/log/nginx/domain.name.error.log;

        ssl_certificate /etc/letsencrypt/live/domain.name/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/domain.name/privkey.pem;
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    include global/common.conf;

    # WORDPRESS : Rewrite rules, sends everything through index.php and keeps the appended query string intact
    location / {
            try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    # SECURITY : Deny all attempts to access PHP Files in the uploads directory
    location ~* /(?:uploads|files)/.*.php$ {
            deny all;
    }
    # REQUIREMENTS : Enable PHP Support
    location ~ .php$ {
        # SECURITY : Zero day Exploit Protection
            try_files $uri =404;
            # ENABLE : Enable PHP, listen fpm sock
            fastcgi_split_path_info ^(.+.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.2-fpm-www.sock;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    # PLUGINS : Enable Rewrite Rules for Yoast SEO SiteMap
    rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
    rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
}

Here’s global/common.conf:

# Global configuration file.
# ESSENTIAL : Configure Nginx Listening Port
listen 80;
# ESSENTIAL : Default file to serve. If the first file isn't found, 
index index.php index.html index.htm;
# ESSENTIAL : no favicon logs
location = /favicon.ico {
    log_not_found off;
    access_log off;
}
# ESSENTIAL : robots.txt
location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
}
# ESSENTIAL : Configure 404 Pages
error_page 404 /404.html;
# ESSENTIAL : Configure 50x Pages
error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/www;
    }
# SECURITY : Deny all attempts to access hidden files .abcde
location ~ /. {
    deny all;
}
# PERFORMANCE : Set expires headers for static files and turn off logging.
location ~* ^.+.(js|css|swf|xml|txt|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
    access_log off; log_not_found off; expires 30d;
}

WordPress Dashboard Error

My site working well. Suddenly when i clicked on admin side dashboard link i got there two errors.
Please help me how to remove it.

Warning: require(/home/qnfx7li6j0v5/public_html/rajasthanevent.com/wp-admin/wp-blog-header.php): failed to open stream: No such file or directory in /home/qnfx7li6j0v5/public_html/rajasthanevent.com/wp-admin/index.php on line 18

Fatal error: require(): Failed opening required ‘/home/qnfx7li6j0v5/public_html/rajasthanevent.com/wp-admin/wp-blog-header.php’ (include_path=’.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php’) in /home/qnfx7li6j0v5/public_html/rajasthanevent.com/wp-admin/index.php on line 18

How to reproduce Rails unit tests in the Rails console (error about routes)

I’m an experienced programmer, but brand new to Ruby and Rails. I want to try building new tests for an existing project, so I thought a good way to start would be to reproduce existing tests line by line in the Rails console. However, I haven’t been able to make it work.

As this question suggests, I went to the main directory of the project and did this:

$ rails console -e test
Loading test environment (Rails 5.2.0)
irb(main):001:0> require './test/test_helper'
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's 'rails' settings.
   (1.0ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
=> true

So far so good. But I still couldn’t load the actual test modules:

irb(main):002:0> require './test/controllers/users_controller_test'
Traceback (most recent call last):
        2: from (irb):2
        1: from test/controllers/users_controller_test.rb:1:in `'
LoadError (cannot load such file -- test_helper)

So then I tried adjusting the $LOAD_PATH as follows, which seems to work:

irb(main):003:0> $LOAD_PATH.unshift '/{{absolute path to project}}/test'
{{irb now prints the new $LOAD_PATH which is really long}}
irb(main):004:0> require './test/controllers/users_controller_test'                         
=> true

But when I try to run the actual tests, it’s still not working. It looks like some kind of unloaded “routes”:

irb(main):008:0> my_test = UsersControllerTest.new("My Test")
=> #
irb(main):009:0> my_test.test_routes
Traceback (most recent call last):
        2: from (irb):9
        1: from test/controllers/users_controller_test.rb:11:in `test_routes'
NoMethodError (undefined method `recognize_path' for nil:NilClass)
irb(main):010:0> my_test.test_new_view
Traceback (most recent call last):
        2: from (irb):10
        1: from test/controllers/users_controller_test.rb:191:in `test_new_view'
RuntimeError (@routes is nil: make sure you set it in your test's setup method.)

Is there an easier way to run tests from the console? How can I resolve the missing “routes” so I can run the tests from the rails console? Or is my goal inadvisable to begin with?