« first day (4311 days earlier)      last day (644 days later) » 

5:54 AM
0
Q: ReactJS counter or timer with Start or Stop Button

AmitNeed help to understand in useEffect, if I don't put counter and timerCheck in useEffect dependency then what it will effect here. And if I put timerCheck dependency in useEffect then counter increasing 100 time faster code in codesandbox const [counter, setCounter] = useState(0); const [st...

can anyone help me to resolve this issue
 
 
1 hour later…
7:21 AM
Hello, I am new to Vue. I have a few .vue files, such as "MainPage.vue" etc., inside the "views" subdirectory. I want to integrate a JS library (roslib) with this project. In this regard, I need to instantiate the roslib only once, which will be used later for ros-related functions.
From StackOverflow, I found that my roslib instance can be attached to "Vue.prototype.$ros". This declaration is made in the main.js file. Now, I am trying to use "this.$ros" inside "MainPage.vue" but getting the following error in the Chrome browser console.
TypeError: Cannot read properties of undefined (reading '$ros')
    at eval (MainPage.vue?2140:92:1)
    at ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40[0].rules[0].use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/MainPage.vue?vue&type=script&lang=js& (src_views_MainPage_vue.js:74:1)
    at __webpack_require__ (index.2bc89271e25d4669.js:500:33)
    at fn (index.2bc89271e25d4669.js:756:21)
    at eval (MainPage.vue?vue&type=script&lang=js&:2:232)
Below is the script section of MainPage.vue file
<scrip>
import ROSLIB from "roslib";

var addTwoIntsClient = new ROSLIB.Service({
  ros: this.$ros,
  name: "/add_two_ints",
  serviceType: "rospy_tutorials/AddTwoInts",
});

var request = new ROSLIB.ServiceRequest({
  a: 12,
  b: 34,
});
export default {
  methods: {
    onClickStartPicking() {
      addTwoIntsClient.callService(request, (result) => {
        console.log(
          `Response on ${addTwoIntsClient.name}: ${result.sum}`
        );
      });
    },
  },
};
</script>
Below is a part of main.js file
import ROSLIB from "roslib";

new Vue({
  router,
  beforeCreate: () => {
    // Connect to our rosbridge WebSocket server and make ros available to this Vue instance.
    Vue.prototype.$ros = new ROSLIB.Ros({
      url: "ws://localhost:9090",
    });
  },
  render: (h) => h(App),
}).$mount("#app");
I want to access "Vue.prototype.$ros" inside MainPage.vue file.
Kindly advise.
 
7:37 AM
There is an option of using window object, such as "window.ros = ..." though...
 
 
1 hour later…
8:58 AM
How can I get my figure up the white area?
 
9:22 AM
@OlePetersen I think you should be able to do it simply with CSS. Do you want to use JS instead?
 
The figure is the output from the js.file.
How can I do it in js file?
 
TBH, I am not sure. but can you share more info? For example, which JS library are you using etc.
 
Here is my js.file:
// Just setup, not related to problem.
const svg = d3.select("body")
  .append("svg")
    .attr("width", 50)
    .attr("height", 50);

const circle = svg.append("circle")
    .attr("cx", "15")
    .attr("cy", "15")
    .attr("r", "10")
    .attr("fill", "none")
    .attr("stroke", "black");

const polygon = svg.append("polygon")
    .attr("fill", "none")
    .attr("stroke", "blue");

const circleElement = circle.node();
const ranger = d3.select("#ranger").on("input", update);
const label = d3.select("label");
My html.file:
 
@OlePetersen Please don't post unformatted code - use the up arrow to edit your post, then hit Ctrl + K to format the code in that post. See the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
1 message moved to Trash can
 
			Number of side of the polygon.
<script src="https://d3js.org/d3.v5.js"></script>
	<p>
  <input id="ranger" type="range" min="3" max="32" value="5">
  <label for="ranger"></label>
</p>
 <body>
 <center>
 <div class="centered">

Number of side of the polygon.
<script src="https://d3js.org/d3.v5.js"></script>
	<p>
  <input id="ranger" type="range" min="3" max="32" value="5">
  <label for="ranger"></label>
</p>

</div>
</center>
</body>
As you can see I can center everything but I can't center the output. Ie the figure.
 
 
2 hours later…
11:26 AM
I have two question I hope I can ask here:
1) I want to have a new output that returns the value in a array (for example the alphabet) in the squarre as shown in the picture, how can I do that? So when we drag for number 2 the letter B should appear in the squarre and if we drag to number 3 the letter C should be in the squarre.

2) Is it also possible to make the line (where we drag) longer?
0
Q: Include the output of a js script in the front

Ole PetersenI have this js script // Just setup, not related to problem. const svg = d3.select("body") .append("svg") .attr("width", 500) .attr("height", 500); const circle = svg.append("circle") .attr("cx", "150") .attr("cy", "150") .attr("r", "100") .attr("fill", "none") ...

 
 
3 hours later…
user18363037
1:59 PM
hi
 
@Hawasaki7 Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
user18363037
2:34 PM
can anyone tell me hwo to convert this codepen to vscode ? codepen.io/wyee/pen/eZVBNg
 
copy paste
 
user18363037
doesnt seem to work )
 
user18363037
@KevinB stackoverflow.com/questions/73250570/… her is stack i created if you are interested in helping me figure it out
 
i'd guess you ran the javascript before the element exists
 
user18363037
well u might be right
 
user18363037
2:36 PM
xD
 
The code in your SO question seems to show that to be the case
 
user18363037
yeah thats right how silly of me
 
you should wait for the dom to be ready before you interact with it
 
user18363037
thanks mate
 
6:11 PM
How can I remove the laxcomma warnings in JSFiddle
 
use commas properly
 
I don't see the issue with it, how is it improper
 
6:28 PM
i mean
given taht i can't see it, i can't answer that can i
 
7:18 PM
posted on August 05, 2022 by Ben Mason

The Dev channel has been updated to 106.0.5216.6 for Windows, Mac and Linux. A partial list of changes is available in the Git log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Srinivas Sista Google Chrome

 
7:42 PM
blue,red,black,TEXT,green,red,black,TEXTab,yellow,red,blue,TEXTxyz
how can I split this string into a bunch of 4 elements?

[blue,red,black,TEXT],[green,red,black,TEXTab],[yellow,red,blue,TEXTxyz]
ok got it
let allPens = [];
let tempArr = [];
x.forEach((x,i)=>{
    console.log(x)
    i +=1;
    tempArr.push(x);
    if(i%4 === 0){
        allPens.push(tempArr);
        tempArr = [];
    }

})
I lost like hours on that SH**# what an idiot.. I did a lot fo research how to get an array from a smartcontract... but the JOKE was that I already did everything right, just in my console.log I was doing this:
	console.log(`Transaction restult: ${tx}`);
and this converted tx to string... what a morron haha
so when I just would have done console.log(tx) I would see already a nice json object
never work on 14 different projects on the same time.
 
 
1 hour later…
9:00 PM
 
9:12 PM
posted on August 05, 2022 by Prudhvikumar Bommana

 The dev channel has been updated to 106.0.5216.6 for Windows, Mac & Linux. A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Srinivas Sista Google Chrome

 

« first day (4311 days earlier)      last day (644 days later) »