[Solved] Dash Pytho...
 
Notifications
Clear all

[Solved] Dash Python how to make multiple updating graphs, how to title

0 Posts
1 Users
0 Likes
4 Views
0
Topic starter
Dan Muller Asks: Dash Python how to make multiple updating graphs, how to title
new coder here, I'm trying to make 4 graphs that share the same random data (although I plan on splitting them apart later). When it was just the one graph it took the random data fine and automatically scaled. In the go.layout there's no way to put which graph you're labeling. Now that I've added multiple none of them have any titles, axis labels, or data. Please help!

Code:
import dash
from dash.dependencies import Output, Input
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import random
import plotly.graph_objs as go
from collections import deque
#setting first points
X = deque(maxlen = 20)
X.append(1)
Y = deque(maxlen = 20)
Y.append(1)
#app settings, html layout
app = dash.Dash(__name__)
  
app.layout = html.Div(children=[
    html.H1([
        html.H1(children='Graphs'),
        dcc.Graph(id = 'Battery Voltage', animate = True),
        dcc.Interval(
            id = 'graph-update',
            interval = 1000,
            n_intervals = 0
        ),
    ],
),
html.Div(
    [
        dcc.Graph(id = 'Signal', animate = True),
        dcc.Interval(
            id = 'graph-update2',
            interval = 1000,
            n_intervals = 0
        ),
    ],
),
html.Div(
    [
        dcc.Graph(id = 'Health', animate = True),
        dcc.Interval(
            id = 'graph-update3',
            interval = 1000,
            n_intervals = 0
        ),
    ],
),
html.Div(
    [
        dcc.Graph(id = 'Prognastics', animate = True),
        dcc.Interval(
            id = 'graph-update4',
            interval = 1000,
            n_intervals = 0
        ),
    ],
)])

#this is what keeps the graph updating 
@app.callback(
    [Output('Battery Voltage', 'figure'),
     Output('Signal', 'figure'),
     Output('Health', 'figure'),
     Output('Prognastics', 'figure')],
    [ Input('graph-update', 'n_intervals'),
      Input('graph-update2', 'n_intervals'),
      Input('graph-update3', 'n_intervals'),
      Input('graph-update4', 'n_intervals')]
)
  
def update_graph_scatter(n):

    X.append(X[-1]+1)
    Y.append(Y[-1]+Y[-1] * random.uniform(-0.1,0.1))
    data = go.Scatter(
            x=list(X),
            y=list(Y),
            name='Scatter',
            mode= 'lines+markers'
    )
  
    return {'data': [data],
            'layout' : go.Layout(title="Battery Voltage",
                                 xaxis_title="Time",
                                 yaxis_title="Voltage",
                                 xaxis=dict(range=[min(X),max(X)]),
                                 yaxis = dict(range = [min(Y),max(Y)])
                                 )
            }

if __name__ == '__main__':
    app.run_server()

When ran with multiple

Just the one

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] fsck returned no errors but badblocks found bad blocks

Ineedadisk Asks: fsck returned no errors but badblocks found bad blocks
Using fsck I have tried sudo fsck /dev/sdc1, sudo fsck -n /dev/sdc1, and sudo fsck -f /dev/sdc1. They all returned archive_0: clean, 11/61054976 files, 4114691/244189952 blocks except when I used the -f flag and instead returned archive_0: 11/61054976 files (0.0% non-contiguous), 4114691/244189952 blocks.

However when I used badblocks sudo badblocks -v /dev/sdc1 > sdc1_bad_sectors I got the output Pass completed, 3264 bad blocks found. (3264/0/0 errors). What steps should I take from here? Should I repair it with e2fsck?

I also want to add that my external drive doesn’t support S.M.A.R.T.

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] cron: send error messages to file, when no MTA is installed

400 the Cat Asks: cron: send error messages to file, when no MTA is installed
I get this message when there is an error in my crontab:

Code:
cron: No MTA installed, discarding output

I don’t want to install a MTA on my system, but I also don’t want to miss these error messages.

Where is it configured, that cron tries to send these by mail? Can I change that, so that these messages are send to a file instead? (perhaps via sysylog).

I don’t want to log all cron messages, just the errors.

I have this in my rsyslog.conf:

Code:
cron.=inf                    stop

*.*                          |/dev/xconsole

Unfortunately, it seems that even error messages have the .info tag

How can I only log cron errors?

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 install mongodb in debian 11 from source without breaking debian?

pong Asks: How to install mongodb in debian 11 from source without breaking debian?
Mongodb isnt available in debian 11. Only 10 and 9 are supported. Install MongoDB Community Edition on Debian

So i want to install it from source, but i want to install mongodb without breaking debian if i upgrade or update.

would you please guide me?

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] Adding microdata using Structured Data Markup Helper HTML

Desislava Angelova Asks: Adding microdata using Structured Data Markup Helper HTML
I am trying to add schema microdata to a wordpress website. I have tried to insert some microdata directly in the wp editor (text mode) but every time i save the page it does not save the code.

I tried a few plugins but when I check with the structured testing tool it doesn’t seem like they are working.

I generated the microdata using this tool, but I am not able to edit the html. Can I do it via cpanel? I cannot find how i can edit the html under the cpanel.

How can I add the generated data to the home page?

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] 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.

 

 


 

Share: