[Solved] Trying to ...
 
Notifications
Clear all

[Solved] Trying to change background color based on checkbox value on Razor page

0 Posts
1 Users
0 Likes
1 Views
0
Topic starter
JustJohn Asks: Trying to change <td> background color based on checkbox value on Razor page
I would like this to turn red whenever the checkbox inside it is checked. The Html.DisplayFor makes things a little more complicated. The Inactive field in SQL server table is boolean, zero or one.

Code:
<td align="center">

        @Html.DisplayFor(modelItem => item.Inactive)

</td>

When looking at the table, the value is either 0 or 1. The page shows a checkbox which is desired but I am stuck trying to reference it's value and set the background-color of the surrounding table cell.

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] Downloaded WP but Nginx home page still showing

Daniel Asks: Downloaded WP but Nginx home page still showing
I am trying to install a second WP site on an Ubuntu 16 server running Nginx. I have successfully installed WordPress according to my server results, but I still only get the Nginx home page. I thought it might be the fact that the Group Owner was the User, so I changed group owner on web files to www-data:

Code:
microurb@vps148370:/var/www/dancortes.press/public_html$ ls -l
total 192
-rw-r--r--  1 microurb www-data     0 Oct  5 15:36 index.html
-rw-rw-r--  1 microurb www-data   418 Oct  8 17:07 index.php
-rw-rw-r--  1 microurb www-data 19935 Oct  8 17:07 license.txt
-rw-rw-r--  1 microurb www-data  7413 Oct  8 17:07 readme.html
-rw-rw-r--  1 microurb www-data  5447 Oct  8 17:07 wp-activate.php
drwxrwxr-x  9 microurb www-data  4096 Oct  8 17:07 wp-admin
-rw-rw-r--  1 microurb www-data   364 Oct  8 17:07 wp-blog-header.php
-rw-rw-r--  1 microurb www-data  1627 Oct  8 17:07 wp-comments-post.php
-rw-rw-r--  1 microurb www-data  2599 Oct  8 17:17 wp-config.php
-rw-rw-r--  1 microurb www-data  2853 Oct  8 17:07 wp-config-sample.php
drwxrwxr-x  5 microurb www-data  4096 Oct  8 17:19 wp-content
-rw-rw-r--  1 microurb www-data  3286 Oct  8 17:07 wp-cron.php
drwxrwxr-x 18 microurb www-data 12288 Oct  8 17:07 wp-includes
-rw-rw-r--  1 microurb www-data  2422 Oct  8 17:07 wp-links-opml.php
-rw-rw-r--  1 microurb www-data  3301 Oct  8 17:07 wp-load.php
-rw-rw-r--  1 microurb www-data 34327 Oct  8 17:07 wp-login.php
-rw-rw-r--  1 microurb www-data  8048 Oct  8 17:07 wp-mail.php
-rw-rw-r--  1 microurb www-data 16200 Oct  8 17:07 wp-settings.php
-rw-rw-r--  1 microurb www-data 29924 Oct  8 17:07 wp-signup.php
-rw-rw-r--  1 microurb www-data  4513 Oct  8 17:07 wp-trackback.php
-rw-rw-r--  1 microurb www-data  3065 Oct  8 17:07 xmlrpc.php

Still, I get only Nginx home page. I restarted Nginx a couple times.

I checked access and error logs and all I get is an error about code on the first site.

I checked the nginx access logs:

Code:
73.197.81.232 - - [08/Oct/2017:19:10:55 -0400] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"
73.197.81.232 - - [08/Oct/2017:19:10:56 -0400] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"

The error logs have an error regarding code on my first site:

Code:
PHP message: PHP Notice:  Undefined index: success in /var/www/microurb.com/public_html/index.php on line 295" while reading upstream, client: 71.168.149.103, server: microurb.club, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "microurb.club"
2017/10/08 19:10:01 [alert] 22798#22798: *25 open socket #11 left in connection 3
2017/10/08 19:10:01 [alert] 22798#22798: aborting
2017/10/08 19:10:52 [alert] 23108#23108: *3 open socket #3 left in connection 3
2017/10/08 19:10:52 [alert] 23108#23108: aborting

I really do not know what to look for next. Why can I not see the WP site?

I decided to do an nginx -t and got this:

Code:
microurb@vps148370:/etc/nginx/sites-available$ nginx -t
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2017/10/08 19:41:25 [warn] 23341#23341: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
2017/10/08 19:41:25 [emerg] 23341#23341: open() "/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed

I am not that much more enlightened now as to what is going on.

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] Will WordPress updates remove Gutenberg Additional Classes?

chrisova Asks: Will WordPress updates remove Gutenberg Additional Classes?
I’m attempting to customize Gutenberg column blocks on my front page. I’ve added a custom class name to a column block using the blocks Additional CSS class feature.


Gutenberg additional classes image

In my child theme style sheet, I’ve added my custom CSS declarations to the block element that has the custom class I created. And this works fine.

My question is if a new WordPress update is issued, will the update remove all my Gutenberg additional classes?

Thanks in advance for any help with this question.

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] two issue about install web3.js through and invoke web3.eth.methods

Allen Kris Asks: two issue about install web3.js through and invoke web3.eth.methods
First, I install type to the code like npm install web3 in the terminal while the first issue occurs (Environment1).Second, I change the version of nodenpm (like Envirnment 1=> Environment2) and type to the same code npm install web3 is OK (version of web3 is 0.20.6 ). Last, when I invoke web3.eth.methods in my project(Environment2 ),I found the second issue is occuring that this.web3 is defined but the this.web3.eth.methods is undefined in despite of I configure the environment 2 through npm install web3 or yarn add web3 .

Environment1 system:Ubuntu16.04; node:8.9.0; npm:5.6.0;

Issue 1 as fellow the issue describe like /.npm/_cache/tmp/git-clone-da91fc96/.git:permission denied
enter image description here

Environment2 system:Ubuntu16.04; node: 6.11.0; npm: 3.11.0; web3: 0.20.6;

Issue 2 as fellow I type to the code like console.log(this.web3) in project and test through developer tool in Google ,the picture as fellow:


enter image description here

I invoke the contract through var Contract = new this.web3.eth.contract(artifacts.abi,'contract_address'); print the contract in project and test through developer tool in Google ,the picture as fellow:


enter image description here

And I invoke a method like getValue() is undefined and I type to the code console.log(window.escrowContract.methods); display the methods is undefined as fellow:


enter image description here

I don’t know whether relationship has between two issue and I look through some articles and tutorials ,their methods don’t work on me .And I know the version of web3 under the version1 (web3.eth — web3.js 1.0.0 documentation) ,the method of invoke contract should be var Contract = new this.web3.eth.Contract(artifacts.abi,'contract_address'); .But a new issue occurs as fellow ,so I change the C into c .


enter image description here

What’s the method can resolve it ?

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 I send BNB and BEP20 token in the same web3 sendTransaction?

AlexAcc Asks: Can I send BNB and BEP20 token in the same web3 sendTransaction?
I’m trying to develop a javascript function to send BNB and a BEP20 token, at the same time, in one transaction, with web3.

let decimals = web3.utils.toBN(18); let bnb_amount = web3.utils.toBN(bnbinput); let bep20_amount = web3.utils.toBN(bep20input);

Code:
  // Get BEP20 Token contract instance
  let contract = new web3.eth.Contract(minABI, tokenAddress);

  // calculate token amount
  let bnb_value = web3.utils.toWei("1", "ether");
  let bep20_value = bep20_amount.mul(web3.utils.toBN(10).pow(decimals));

It works if I only try to send BNB, without the tokens (msg.value & no msg.data)

Code:
var rawTransaction = {
        "from": fromAddress,
        "to": toAddress,
        "value": bnb_value,
        "chainId": web3.utils.toHex(97)
      };

      web3.eth.sendTransaction(rawTransaction, function(log) {
        console.log(log)
      })

It also works if I only try to send tokens, without BNB (msg.data & no msg.value)

Code:
var rawTransaction = {
        "from": fromAddress,
        "to": toAddress,
        "data": contract.methods.transfer(toAddress, bep20_value).send({from: fromAddress}),
        "chainId": web3.utils.toHex(97)
      };

      web3.eth.sendTransaction(rawTransaction, function(log) {
        console.log(log)
      })

…but it don’t work if I try to put everything together. Any idea?

My complete code is the following (not working):

Code:
var rawTransaction = {
        "from": fromAddress,
        "to": toAddress,
        "value": bnb_value,
        "data": contract.methods.transfer(toAddress, bep20_value).send({from: fromAddress}),
        "chainId": web3.utils.toHex(97)
      };

      web3.eth.sendTransaction(rawTransaction, function(log) {
        console.log(log)
      })

Is there any rule that states that is not possible to set msg.data and msg.value in a web3.eth.sendTransaction()?

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] ‘brownie’ is not recognized as an internal or external command on Windows 10

AngelDev Asks: ‘brownie’ is not recognized as an internal or external command on Windows 10
I downloaded eth brownie via

Code:
pipx install eth-brownie

and got

Code:
'eth-brownie' already seems to be installed. Not modifying existing installation in 'C:\Users\HP\.local\pipx\venvs\eth-brownie'. Pass '--force' to force installation.

when I type Brownie for confirmation I get

Code:
'brownie' is not recognized as an internal or external command, operable program or batch file.

tried to do

Code:
C:\Users\HP\.local\pipx\venvs\eth-brownie Pass --force

but got

Code:
The system cannot find the path specified.

I’m on windows if that makes any difference any help would be amazing thx

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] Approval Comments Mandatory for all approvals

VPY Asks: Approval Comments Mandatory for all approvals
My use case is to make approval comments mandatory regardless of “Approved” or “Rejected”.

I went through this thread (How do I make approval comments mandatory?) and I was able to make the comments mandatory only in the case of rejected by following that example.

But as earlier said my use case is to make approval comments mandatory for all approvals.

Code:
trigger ApprovalTrigger on Approval__c (before update,after update) {

  System.debug('~~~ Trigger Started ');




 Map<Id, Approval__c> ApprovalsMap = new Map<Id, Approval__c>{};

  for(Approval__c app: trigger.new)
  {

  System.debug('~~~ Inside Second For Loop');

    Approval__c oldApproval = System.Trigger.oldMap.get(app.Id);

    //if (oldApproval .Approval_Status__c != 'Rejected' && app.Approval_Status__c == 'Rejected')


    if(oldApproval.Approval_Status__c != app.Approval_Status__c) //All Status change
    { 
        ApprovalsMap .put(app.Id, app);
    }

    System.debug('~~~ ApprovalsMap '+ApprovalsMap);

  }
  for (ProcessInstance pi : [SELECT TargetObjectId, 
                              (  
                                 SELECT Id, StepStatus, Comments 
                                 FROM Steps
                                 WHERE StepStatus IN ('Rejected','Approved')
                                 ORDER BY CreatedDate DESC
                                 LIMIT 1 
                              )
                               FROM ProcessInstance
                               WHERE TargetObjectId In 
                                 :ApprovalsMap.keySet()
                               ORDER BY CreatedDate DESC
                              ])
  {    

  System.debug('~~~ Inside Third For Loop');
  System.debug('~~~ Pi Instance Size '+pi.Steps.size());
  System.debug('~~~ Pi Instance 0'+pi.Steps);

      if (pi.Steps.size() > 0 && (pi.Steps[0].Comments == null || pi.Steps[0].Comments.trim().length() == 0))
      {
          ApprovalsMap.get(pi.TargetObjectId).addError(
          'Please provide approval comments');
      }
  }
}

This is what the debug log is printed when I approved the record successfully without any approval comments.

Code:
09:54:38.0 (24721169)|USER_DEBUG|[3]|DEBUG|~~~ Trigger Started 
09:54:38.0 (43421464)|USER_DEBUG|[21]|DEBUG|~~~ Inside Second For Loop
09:54:38.0 (45165790)|USER_DEBUG|[33]|DEBUG|~~~ ApprovalsMap {***Map Data***}}
09:54:38.0 (52125727)|USER_DEBUG|[51]|DEBUG|~~~ Inside Third For Loop
09:54:38.0 (52298722)|USER_DEBUG|[52]|DEBUG|~~~ Pi Instance Size 0
09:54:38.0 (52397392)|USER_DEBUG|[53]|DEBUG|~~~ Pi Instance 0()

Can someone help me out with whats going on ?

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] Field not seen in the Matching Rules

Dana Asks: Field not seen in the Matching Rules
I have a custom object called Campaign Prospects. Contacts can be a Prospect in more than one Campaign. I want to make sure we don’t put the same people in the same campaign as prospects. In the matching rule, I can find the Person(Contact) field but campaign field is not available. Both Campaign and Contact have lookup relationships. Is there a way around it?

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] Using python to export from pardot when pypardots won’t do

Henrietta Martingale Asks: Using python to export from pardot when pypardots won’t do
I finally got authentication to work and I can get the access token and the reset token which I knwo got pypardotsf to work. However pypardot doesn’t seem to support export. So, I tried it au naturel like this:

Code:
uri = f'https://pi.pardot.com/api/export/version/4/do/create'
params = {
    "object": 'visitorActivity',
    #"fields": [string, string, ....],
    "procedure": {
        "name": 'filter_by_created_at',
        "arguments": {
            "created_after": "2020-09-30 10:00:00",
            "created_before": "2021-09-30 24:59:59"
        }
    }
}
headers = {'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': f'Bearer {access_token}',
'Pardot-Business-Unit-Id': business_unit_id}
x = requests.post(uri, headers = headers, data = params)

as only visitorActivity seems to work with the export API. A pity since it lists so many other objects for no reason then. Anyway, I get:

Code:
<?xml version="1.0" encoding="UTF-8"?>n<rsp stat="fail" version="1.0">n   <err code="46">This API user lacks sufficient permissions for the requested operation</err>n</rsp>n

I have the full api privilege. Does this mean my entire attempt to access pardot failed or that I succeeded but there is yet another setting I need to click to get the access to export this object. I can read 200 records at a time with pypardotsf, but if there are a million visits, that’s 50k calls before I can get all the data. Not the greatest.

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] Progress bar advances, operations does nothing

Smos Asks: Progress bar advances, operations does nothing
I’m trying to create a batch to import users. I used this (Drupal 7 Batch API example – Pastebin.com) as an example, but somehow it’s not working. I see the progress bar advancing and It’s showing the right number of rows I’m processing. But what I’m trying to do in the operation function isn’t executed.

Here’s my code:

Code:
function form_submit($form, &$form_state) {
  batch_import_users();
}

function batch_import_users() {
  db_set_active('mysqldb');

  $result = db_query("SELECT * FROM {users}");

  db_set_active('default');

  $batch = array(
    'title' => t('Importing users ...'),
    'operations' => array(),
    'init_message' => t('Commencing'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('An error occurred during processing'),
    'finished' => 'batch_import_users_finished',
    'progressive' => FALSE,
    'file' => 'users.inc',
  );

  foreach ($result as $row) {
    $batch['operations'][] = array('batch_create_user', array($row));
  }

  batch_set($batch);

  batch_process();
}

function batch_create_user($row, &$context) {
  // Here I'm just trying to get some output so I know the operation is called, I'm not actually importing the users yet.

  drupal_set_message($row->uid . ' : ' . $row->login);
  dd($row->uid . ' : ' . $row->login);

  $context['results']['processed']++;
  $context['message'] = $row->login;
}

function batch_import_users_finished($success, $results, $operations) {
  if ($success) {
    drupal_set_message('Importing users has finished.');
  }
  else {
    drupal_set_message('Some error.');
  }
}

Am I missing something or doing something wrong? Any help is very much 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] Using xterm to open a new console: How to while the current console is printing, to print on the new console also

Yuki Asks: Using xterm to open a new console: How to while the current console is printing, to print on the new console also
I’m using python right now. I have a thread that represents my entire program. I want to open another console window using os.system(xterm&) as a thread which works. The only thing is, is it possible to print to the new window while the other thread is printing to the older window?

Code:
import sys
import os

def my_fork():
    child_pid = os.fork()
    if child_pid == 0:

        function=open('SMITH747.txt','r')
        f=function.readlines()
        fd = open("output", "w")
        # Open xterm window with logs from that file
        p = subprocess.Popen(["xterm", "-e", "tail", "-f", "output"])
        # Do logging


        while(True):
            for i in range(1):
                fd.write("Hello, world!")
                time.sleep(2)

            if f==[]:
                pass
            else:
                bud=False

            fd.flush()

    else:
        function=open('SMITH747.txt','w')
        var=input('Enter ')
        if var=='q':
            function.write('yo')

if __name__ == "__main__":
    my_fork()

this is what I have right now: It works except I can’t get it to read my file and terminate if f is not []. I would appreciate it so much if someone can help me debug this part. Then it will be perfect!

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: