Advertisement Jump to content
  • Advertisement

Pedro Alves

Member
  • Content Count

    166
  • Joined

  • Last visited

Community Reputation

251 Neutral

1 Follower

About Pedro Alves

  • Rank
    Member

Personal Information

Social

  • Twitter
    donthave
  • Github
    dont have
  • Twitch
    dont have
  • Steam
    dont have

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Pedro Alves

    puting data from my charts

    i have to create new post becouse i can´t edit the first the problem is the following I created a graph and now I want to search for data but I can only if i put statict data but i want put with dinamy data I am using angular 7, nodejs and mongodb what i doing wrong how i convert my chart with static data to dinamic data this is my code let TotalSell = function() { var data = { labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], datasets: [{ label: 'My First dataset', fillColor: 'rgba(220,220,220,0.2)', strokeColor: 'rgba(220,220,220,1)', pointColor: 'rgba(220,220,220,1)', pointStrokeColor: '#fff', pointHighlightFill: '#fff', pointHighlightStroke: 'rgba(220,220,220,1)', data: [65, 59, 80, 81, 56, 55, 40, 84, 64, 120, 132, 87] }] }; legendTemplate: '<ul class="tc-chart-js-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>' }; var ctx = $("#TotalSell").get(0).getContext("2d"); var chart1 = new Chart(ctx).Line(data, options); var legend = chart1.generateLegend(); $('#TotalSellLegend').append(legend); }; <div class="col-sm-6"> <h5 class="over-title margin-bottom-15" style="text-align:center;">Total Sell</h5> <canvas id="TotalSell" class="full-width"></canvas> <div class="margin-top-20"> <div class="inline pull-left"> <div id="TotalSellLegend" class="chart-legend"></div> </div> </div> </div>
  2. Pedro Alves

    puting data from my charts

    i try puting some values in my charts from my homepage components and my question for now i want show in charts the values records this my code from records to my chats import { Component, OnInit } from '@angular/core'; declare var $: any; declare var Index: any; declare var Charts: any; @Component({ selector: 'app-homepage', templateUrl: './homepage.component.html', styleUrls: ['./homepage.component.css'] }) export class HomepageComponent implements OnInit { records=[ { codprodut:'1', descricao:'Peras', quantidade:'200', preco:'200€' }, { codprodut:'2', descricao:'Maças', quantidade:'20', preco:'10€' }, { codprodut:'3', descricao:'Merda', quantidade:'20', preco:'5€' }, ] constructor() { } ngOnInit() { $(document).ready(function() { Charts.init(); Index.init(); }); } } chart.js code var Charts = function() {"use strict"; var doughnutChartHandler = function() { var data = [{ value: 300, color: '#F7464A', highlight: '#FF5A5E', label: 'Red' }, { value: 50, color: '#46BFBD', highlight: '#5AD3D1', label: 'Green' }, { value: 100, color: '#FDB45C', highlight: '#FFC870', label: 'Yellow' }]; // Chart.js Options var options = { // Sets the chart to be responsive responsive: false, //Boolean - Whether we should show a stroke on each segment segmentShowStroke: true, //String - The colour of each segment stroke segmentStrokeColor: '#fff', //Number - The width of each segment stroke segmentStrokeWidth: 2, //Number - The percentage of the chart that we cut out of the middle percentageInnerCutout: 50, // This is 0 for Pie charts //Number - Amount of animation steps animationSteps: 100, //String - Animation easing effect animationEasing: 'easeOutBounce', //Boolean - Whether we animate the rotation of the Doughnut animateRotate: true, //Boolean - Whether we animate scaling the Doughnut from the centre animateScale: false, //String - A legend template legendTemplate: '<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>' }; // Get context with jQuery - using jQuery's .get() method. var ctx = $("#doughnutChart").get(0).getContext("2d"); // This will get the first returned node in the jQuery collection. var doughnutChart = new Chart(ctx).Doughnut(data, options); //generate the legend var legend = doughnutChart.generateLegend(); //and append it to your page somewhere $('#doughnutLegend').append(legend); }; return { //main function to initiate template pages init: function() { doughnutChartHandler(); } }; }();
  3. i can´t make work my get two or more methods in same route i have the code 404 i using mysql nodejs and express my code controller alliances what i doing wrong my code const User = require('../models/Alliances') const findAlianca = async (connection, req, res) => { const Allianca = await User.find(connection, req.session.user.username) if (!Allianca) { res.status(404).send('Nenhuma cidade encontrada.'); return; } console.log("dddd"); req.session.Allianca = Allianca res.locals.Allianca = Allianca res.render('Administration/Alliances') } module.exports = { findAlianca } route aliance const express = require('express') const router = express.Router() const connection = require('../../Config/database') const controllerAdmin = require('../../controllers/Administration') const controlleruser = require('../../controllers/Alliances') router.get('/Administration/Alliances', (req, res) => controllerAdmin.findcidade3(connection, req, res)) router.get('/Administration/Alliances/limitado', (req, res) => controlleruser.findAlianca(connection, req, res)) module.exports = app => app.use('/', router) models aliance const find = (connection,username) => { return new Promise((resolve, reject) => { connection.query(SELECT alianca.nome,alianca.N_membros,alianca.TAG FROM user INNER JOIN alianca ON user.cod_alianca=alianca.id WHERE user.username='${username}', (err, result) => { if(err){ reject(err) }else{ resolve(result) } }) }) } module.exports = { find } alliance.jade extends layout block title .col-xs-6.col-xs-offset-3.col-sm-6.col-sm-offset-3 .col-sm-4(style='width:76%') div.panel.panel-primary(style='height:50px') Alliances Page div.panel.panel-primary(style='height:700px') fdssdklfsdklfjskldfjkldsjfl if locals.user.cod_alianca==null p You Dont Have Alliances else br span Your Aliance span= locals.Allianca.nome .col-xs-2.panel-red(style='width:24%;height:100%;text-align:center') my app require('./routes/Administration/Alliances')(app) my connection db const mysql = require('mysql') const config = require( "./config.json" ) const connection =mysql.createConnection({ host:config.host, user:config.user, password:config.password, database:config.database, // port:config.port }); connection.connect((err) =>{ if(err){ console.log(err) process.exit(0) }else{ console.log('database on') } })
  4. i have a problem i can make work the verificay if user existe our not i using nodejs ,express,mysql i put my link to project in github the code its to big https://github.com/Kammikazy/project find the soluction to my problem
  5. Pedro Alves

    Question about add mesh to level

    topic can be close problem as been solve
  6. Pedro Alves

    problem send multiples values in nodejs

    i find the soluction to my problem show all data administration inde route const express = require('express') const connection = require('../../Config/database') const controllerAdmin = require('../../controllers/Administration') const router = express.Router() //router.get('/Administration/', (req, res) => res.render('Administration/index')) router.get('/Administration/',controllerAdmin.findcidade.bind(null, connection)) //router.get('/Administration', (req, res) => res.render('Administration/index',controllerAdmin.findcidade.bind(null, connection))) //*/ module.exports = app => app.use('/', router) Administration controller const Cidade = require('../models/Cidades') const findcidade = async (connection, req, res) => { const cidade = await Cidade.findcidade(connection, req.session.user.username) if(!cidade){ return false } else{ // console.log(cu); // user.password = undefined req.session.cidade = cidade res.locals.cidade = cidade res.render('Administration/') } } extends layout block content b Player: b= locals.user.username block title .col-xs-10.col-xs-offset-2.col-sm-8.col-sm-offset-2 br div.panel.panel-primary(style='height:50px',width='30px') img(width='50px', height='50px', src='../images/recursos/ouro.png') | 10 img(width='50px', height='50px', src='../images/recursos/madeira.png') | 10 img(width='50px', height='50px', src='../images/recursos/metal.png') | 10 img(width='50px', height='50px', src='../images/recursos/pedra.png') | 10 img(width='50px', height='50px', src='../images/recursos/Lampada.png') | 10 img(width='50px', height='50px', src='../images/recursos/comida.png') | 10 img(width='50px', height='50px', src='../images/recursos/petrolio.png') | 10 img(width='50px', height='50px', src='../images/recursos/moeda.png') | 10 .col-sm-4(style='width:85%') div.panel.panel-primary(style='height:50px') dsadsadasdsad div.panel.panel-primary(style='height:700px') fdssdklfsdklfjskldfjkldsjfl .col-sm-4.panel.panel-red(style='width:15%;height:100%') | [1/1] City br - each val in cidade b= val.Nome br b= val.coordenadas b= val.continente br topic can be close
  7. Hello i try retrive data from a table cidades and show in my express with jade const express = require('express') const connection = require('../../Config/database') const controllerAdmin = require('../../controllers/Administration') const router = express.Router() //router.get('/Administration', controllerLogin.FindCidades) router.get('/Administration', (req, res) => res.render('Administration/index',{username:res.locals.user.username ,nome:res.locals.cidade.Nome,coordenas:res.locals.cidade.coordenadas,continente:res.locals.cidade.continente })) module.exports = app => app.use('/', router) const authenticateUser = async (connection, req, res) => { const user = await User.findUser(connection, req.body.username) if(!user){ return res.render('login/login',{error: true}) } if(!await bcrypt.compare(req.body.password, user.password)){ return res.render('login/login', {error: true}) } else{ // user.password = undefined req.session.user = user //const nivel = await User.findnivel(connection, req.body.username) if(user.nivel==1){ const cu = await Cidade.findcidade(connection, req.body.username) // req.session.user.nivel = nivel res.locals.user= user req.session.cidade= cu res.locals.cidade= req.session.cidade // console.log(1); console.log("rewr",cu); res.redirect('/Administration'); }else if(user.nivel==2){ // req.session.nivel = nivel console.log(2); // res.redirect('/Users') }else if(user.nivel==3){ // req.session.nivel = nivel console.log(3); // res.redirect('/Administration') }else if(user.nivel==4){ // req.session.nivel = nivel console.log(4); // res.redirect('/Administration') } else if(user.nivel==5){ // req.session.nivel = nivel console.log(5); // res.redirect('/Administration') } else { console.log("banned"); } } } const findcidade = (connection,username) => { return new Promise ((resolve, reject) => { connection.query(`SELECT cidade.cod_cidade, cidade.Nome,cidade.continente,cidade.coordenadas,cidade.ouro,cidade.madeira,cidade.metal,cidade.pedra,cidade.energia, cidade.comida,cidade.petrolio FROM user INNER JOIN cidade ON user.cod_user=cidade.cod_user WHERE user.username='${username}' `, (err, result) =>{ if(err){ reject(err) }else{ if(result.length>0){ resolve(result) } else{ resolve(false) } } }) }) } give this error what i doing wrong i want show for example user maria have athenas and rome
  8. Pedro Alves

    nodejs problem

    i finaly find the soluction the soluction to my problem const authenticateUser = async (connection, req, res) => { const user = await User.findUser(connection, req.body.username) if(!user){ return res.render('login/login',{error: true}) } if(!await bcrypt.compare(req.body.password, user.password)){ return res.render('login/login', {error: true}) } else{ // user.password = undefined //const nivel = await User.findnivel(connection, req.body.username) if(user.user_type_id==1){ req.session.user = user res.locals.user = user res.redirect('/Administration'); }else if(user.user_type_id==2){ // req.session.nivel = nivel console.log(2); // res.redirect('/Users') }else if(user.nivel==3){ // req.session.nivel = nivel console.log(3); // res.redirect('/Administration') }else if(user.user_type_id==4){ // req.session.nivel = nivel console.log(4); // res.redirect('/Administration') } else if(user.user_type_id==5){ // req.session.nivel = nivel console.log(5); // res.redirect('/Administration') } else { console.log("banned"); } topic can be close
  9. Pedro Alves

    nodejs problem

    i try make a login system with mysql when run de nodejs and open the firefox page is not redirecting correctly Firefox has detected that the server is redirecting the request to this address in a way that will never be completed. This problem can sometimes be caused by disabling or declining to accept cookies.
  10. I can not get my tabs to change the text When I load for example in general he should change to the text of the general but I can not by I'm using nodejs with express news.jade extends layout block content h1 Last News section#page-title h1.mainTitle br .tabbable ul#myTab2.nav.nav-tabs.nav-justified li.active a(href='#All', data-toggle='tab') | All li a(href='#Geral', data-toggle='tab') | General li a(href='#Events', data-toggle='tab') | Events li a(href='#Updates', data-toggle='tab') | Updates li a(href='#Sales', data-toggle='tab') | Sales li a(href='#Community', data-toggle='tab') | Community .tab-content #All.tab-pane.fade.in.active p | Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. p | Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui. #Geral.tab-pane.fade p | Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo. p | Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. #Events.tab-pane.fade p | Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. p | Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui. #Updates.tab-pane.fade p | Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. p | Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui. #Sales.tab-pane.fade p | Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. p | Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui. #Community.tab-pane.fade p | Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. p | Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.  news.js var express = require('express'); var router = express.Router(); /* GET users listing. */ router.get('/', function(req, res, next) { res.render('news', { title: ' Last news' }); $(document).ready(function(){ $(".nav-tabs a").click(function(){ $(this).tab('show'); }); }); });  module.exports = router; what i doing wrong i don´t have any error
  11. Pedro Alves

    Question about add mesh to level

    this how i fix my problem
  12. Pedro Alves

    Question about add mesh to level

    finaly find the problem
  13. Pedro Alves

    Question about add mesh to level

    ok sorry my english is very bad yes i have to spawn a actor from the class i don´t know how to spawn a character bp class to the level
  14. my question is the following I am creating a system to create characters and my doubt is to add to the level a new character that is character type bp I have to use the spawn for example the player chooses a tree puts the name click create in the slot and put the name and in the level it is attached to a tree
  15. Pedro Alves

    newbie question about dedicate server

    problem as been solve i copy all data from the old project to new one its is dedicate server
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!