most recent 30 from stackoverflow.com 2026-03-01T08:05:04Z https://stackoverflow.com/feeds/user/887103 https://creativecommons.org/licenses/by-sa/4.0/rdf https://stackoverflow.com/q/45390338 17 Nicolas S.Xu https://stackoverflow.com/users/887103 2017-07-29T14:24:32Z 2025-11-26T22:06:39Z <p>Below is the request I received from server log. I am worried this may trigger some crash. The server is a simple express dev server.</p> <pre><code>&quot;GET login.cgi HTTP/1.0&quot; </code></pre> <p>How do I use curl to duplicate the above exact request?</p> <ul> <li>no path</li> <li>login.cgi</li> <li>HTTP 1.0</li> </ul> https://stackoverflow.com/q/29887088 47 Nicolas S.Xu https://stackoverflow.com/users/887103 2015-04-27T04:14:39Z 2025-09-26T11:55:08Z <p>When I close a java program in intellJ, the following log appears in the console: "Process finished with exit code 130"</p> <p><img src="https://i.sstatic.net/CA9Po.png" alt="screenshot of java program exit code"></p> <p>Some times, the code is "1". </p> <p>I know this is the very basic, but I googled Internet and still couldn't find the explanation for the exit code. </p> <p>What does the code mean? Where can I find the explanation? </p> https://stackoverflow.com/q/31228788 2 Nicolas S.Xu https://stackoverflow.com/users/887103 2015-07-05T09:10:21Z 2025-07-25T20:23:33Z <p>I am plotting a line chart using <a href="http://www.jfree.org/jfreechart/" rel="nofollow noreferrer">jFreeChart</a>, which is a series of (x, y) value connected by a straight line. </p> <p>But the problem is the shape, a circle or a rect that represents a data point is too big, since I have a lot of values in one series. You can see how it looks like in this screenshot:</p> <p><img src="https://i.sstatic.net/mWFLO.png" alt="enter image description here"></p> <p>Also, I learned the shapes that represent data point do not scale as the rest of the plot does when I resize the chart panel. </p> <p><strong>Question</strong>:</p> <p>How to make the shape(the circles and rects that represent data point) smaller so that they won't clog together? </p> <p>Here is my code to generate the chart, and I used a customized renderer to draw different color for different part of the line in one data series. </p> <pre><code> private JFreeChart createChart(XYDataset dataCollection) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart( fileName, // chart title "Count", // x axis label "Price", // y axis label dataCollection, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // customize chart XYPlot plot = (XYPlot) chart.getPlot(); // find out the max and min value for price series XYSeriesCollection collection = (XYSeriesCollection)plot.getDataset(); XYSeries priceSeries = collection.getSeries(0); double maxY = priceSeries.getMaxY(); double minY = priceSeries.getMinY(); // set max and min for range axis (y axis) NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis(); rangeAxis.setRange(minY, maxY); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer() { public Color getItemColor(int series, int item) { // modify code here to change color for different part of the line in one serie line if(series == 1) { System.out.println("getting color at: " + item); int isBuy = 0; if(item &lt; kFilter.buySellSignal.size()) { isBuy = kFilter.buySellSignal.get(item); } if(isBuy == 1) { return Color.red; } else { return Color.green; } } else { return Color.yellow; } } @Override protected void drawFirstPassShape(Graphics2D g2, int pass, int series, int item, Shape shape) { super.drawFirstPassShape(g2, pass, series, item, shape); //g2.setStroke(getItemStroke(series, item)); Color c1 = getItemColor(series, item - 1); Color c2 = getItemColor(series, item); GradientPaint linePaint = new GradientPaint(0, 0, c1, 0, 300, c2); g2.setPaint(linePaint); g2.draw(shape); } }; plot.setRenderer(renderer); return chart; } </code></pre> https://stackoverflow.com/q/75177952 1 Nicolas S.Xu https://stackoverflow.com/users/887103 2023-01-19T20:30:29Z 2025-04-23T16:32:28Z <pre><code>import { useQuery } from &quot;vue-query&quot;; const { isLoading, data /* read only */, error, isError, refetch } = useQuery(&quot;todo&quot;, todo) </code></pre> <p>I just found out data returned by vue-query is read only. Vue-query is similary project to React-query. You can <a href="https://tanstack.com/query/latest/docs/vue/guides/queries" rel="nofollow noreferrer">find it here</a>.<br /> If I do <code>data.todoList.push(newTodo)</code> then I got the following warning</p> <blockquote> <p>[Vue warn] Set operation on key &quot;xxx&quot; failed: target is readonly</p> </blockquote> <p>My question is 1) How do I change the value returned by vue-query? 2) If I need to change the returned data, what is the best way to do it?</p> https://stackoverflow.com/q/36363692 3 Nicolas S.Xu https://stackoverflow.com/users/887103 2016-04-01T18:46:46Z 2025-04-07T05:54:45Z <p>I've learned Java language features in the past 3 months and compiled many projects using IntelliJ. The experience was great! But when I trying to learn Java Spring, I couldn't even get it running.</p> <p>To run Spring, they introduce a new thing called Gradle. Why do we need it? I just couldn't figure out what Gradle is AFTER READING document on Gradle official site.</p> <p>My previous Java projects, class, packages was running perfectly. Why they invented Gradle? What is this thing?</p> https://stackoverflow.com/q/24596629 1 Nicolas S.Xu https://stackoverflow.com/users/887103 2014-07-06T14:01:26Z 2024-01-22T18:01:00Z <p>I am writing spec for testing RESTful api. The module I use to make http request is <a href="http://nodejs.org/api/http.html" rel="nofollow">standard http module</a> in nodejs. </p> <p>If I don't specify the 'Content-Length' in header, then the request is made successfully, but I specify the length by </p> <blockquote> <p>options.headers['Content-Length'] = post_data.length;</p> </blockquote> <p>, then it is a bad request with 400 error code. I searched stackoverflow for Content-Length related question, but got no inspiration so far. I tried length +1, and just 100, all ending with same bad request. </p> <p>Below is my code. Can you tell me what is the problem? </p> <pre><code>var options = { hostname: hostname, port: port, headers: { 'Content-Type': 'application/json', 'Cache-Control': 'no-cache' // 'Content-Length': post_data.length } }; describe('API Testing Function', function () { db.bind('user'); describe('POST /api/user', function () { it('should return 400 when password is not present', function (done) { options.method = 'POST'; options.path = '/api/user'; var post_data = JSON.stringify({email:'111@email.com'}); options.headers['Content-Length'] = post_data.length; // error here // if I delete above line, then it is totally good request. var req = http.request(options, function(res){ res.on('data', function(chunk){ // console.log('BODY:' + chunk); var result = JSON.parse(chunk); assert.equal(400, result.code); done(); }); }); req.write(post_data, 'utf8'); req.end(); }); }); }); </code></pre> https://stackoverflow.com/q/51715616 9 Nicolas S.Xu https://stackoverflow.com/users/887103 2018-08-06T21:05:05Z 2023-10-27T16:41:57Z <p>Below is my code. I don't think there is any problem. </p> <p>How can I fool codacy? If I can't use <code>obj[key]</code>, then what the hell is this thing? There is no way I can avoid <code>[]</code>.</p> <pre><code>handleClick = (e, titleProps) =&gt; { const { index } = titleProps const newVal = this.state.activeIndexObj[index]? false: true let activeIndexObj = {...this.state.activeIndexObj} activeIndexObj[index] = newVal // Generic Object Injection Sink (security/detect-object-injection) </code></pre> https://stackoverflow.com/q/39622778 64 Nicolas S.Xu https://stackoverflow.com/users/887103 2016-09-21T17:17:44Z 2023-07-18T18:04:18Z <p>I encountered <code>new()</code> in the official document <a href="https://www.typescriptlang.org/docs/handbook/generics.html" rel="noreferrer">here</a> about generics. </p> <p>Here is the code context:</p> <pre><code>function create&lt;T&gt;(c: { new(): T; } ): T { return new c(); } </code></pre> <p>The above code is transpiled to the following JavaScript code:</p> <pre><code>function create(c) { return new c(); } </code></pre> <p><code>new()</code> is illegal syntax in JavaScript. What does it mean in TypeScript? </p> <p>Furthermore, what does <code>{new(): T; }</code> mean? I know it must be a type, but how? </p> https://stackoverflow.com/q/76672023 1 Nicolas S.Xu https://stackoverflow.com/users/887103 2023-07-12T15:05:06Z 2023-07-12T15:37:08Z <pre><code>type Activity = { activity: string type: string participants: number price: number link: string key: string accessibility: number } async function fetchOne(): Promise&lt;Activity&gt; { const url = &quot;https://www.boredapi.com/api/activity&quot; const res: Activity = await fetch(url).then(res =&gt; (res.json())) // Unsafe assignment of an `any` value.eslint@typescript-eslint/no-unsafe-assignment // how to fix this? return res } </code></pre> <p>I got :</p> <blockquote> <p>Unsafe assignment of an <code>any</code> value.eslint@typescript-eslint/no-unsafe-assignment</p> </blockquote> <p>Any suggestion on how to fix this?</p> https://stackoverflow.com/q/25460574 138 Nicolas S.Xu https://stackoverflow.com/users/887103 2014-08-23T09:38:56Z 2023-06-20T19:05:52Z <p>I'd like to find all *.html files in src folder and all its sub folders using nodejs. What is the best way to do it? </p> <pre><code>var folder = '/project1/src'; var extension = 'html'; var cb = function(err, results) { // results is an array of the files with path relative to the folder console.log(results); } // This function is what I am looking for. It has to recursively traverse all sub folders. findFiles(folder, extension, cb); </code></pre> <p>I think a lot developers should have great and tested solution and it is better to use it than writing one myself. </p> https://stackoverflow.com/q/21084020 0 Nicolas S.Xu https://stackoverflow.com/users/887103 2014-01-13T04:42:42Z 2023-06-02T20:03:20Z <p>In the Express generated code:</p> <pre><code>... app.use(express.urlencoded()); app.use(express.methodOverride()); app.use(express.cookieParser('my secret cat')); ... </code></pre> <p>The method <strong>express.methodOverride()</strong> is unfamiliar to me. I read the doc Connect document <a href="http://www.senchalabs.org/connect/methodOverride.html" rel="nofollow noreferrer">here</a>, but I still miss the whole picture.</p> <p>My question is:</p> <p>In what situation do we need to override a method (GET, POST, PUT, and DELETE) using <strong>express.methodOverride()</strong>?</p> <p>I found an relevant answer <a href="https://stackoverflow.com/questions/8378338/what-does-connect-js-methodoverride-do">here</a>, but my follow up question is:</p> <p>If no <strong>express.methodOverride()</strong>, I can't use app.put(), app.delete(), app.get(), app.post() in Express. Is this correct?</p> https://stackoverflow.com/q/50180381 21 Nicolas S.Xu https://stackoverflow.com/users/887103 2018-05-04T17:37:37Z 2023-06-01T21:56:08Z <p>Consider:</p> <pre><code>const GET_DOGS = gql` { dogs { id breed } } `; </code></pre> <p>I found this new syntax from <a href="https://www.apollographql.com/docs/react/essentials/queries.html" rel="nofollow noreferrer">here</a>.</p> <p>What is the explanation for this syntax? Where can I find detail about it?</p> https://stackoverflow.com/q/38030519 90 Nicolas S.Xu https://stackoverflow.com/users/887103 2016-06-25T16:25:33Z 2023-03-01T14:02:32Z <p>I am learning JSP programing which requires Tomcat. I followed <a href="https://wolfpaulus.com/journal/mac/tomcat8/" rel="noreferrer">some tutorials</a> but failed to install successfully(Probably some step is not clear match to my situation)</p> <p>Then I found out you can install easily by this command line:</p> <pre><code>brew install tomcat </code></pre> <p>It looks install is successful, </p> <p><a href="https://i.sstatic.net/7lpyx.png" rel="noreferrer"><img src="https://i.sstatic.net/7lpyx.png" alt="enter image description here"></a></p> <p>My challenge is after install, I don't know where it is on my hard drive. Therefore, can't configure it in IntelliJ. </p> <p><a href="https://i.sstatic.net/BBa2z.png" rel="noreferrer"><img src="https://i.sstatic.net/BBa2z.png" alt="enter image description here"></a></p> <p>My question is:</p> <p>How do I find out where Tomcat is installed by brew on MacOS? </p> <p>Thanks!</p> https://stackoverflow.com/q/40061263 59 Nicolas S.Xu https://stackoverflow.com/users/887103 2016-10-15T16:05:04Z 2023-02-28T14:25:30Z <p>I've just read <a href="https://web.archive.org/web/20161213142308/https://www.instantssl.com/ssl-certificate-products/https.html" rel="noreferrer">this article</a> about what is HTTPS service, and understand the basic of https.</p> <p>When requesting https content, the server will send a public key to browser, so that every time, the browser receive data will decrypted with the public key.</p> <p>My question is what is CA certificate for? Why do we need it?</p> https://stackoverflow.com/q/60119026 1 Nicolas S.Xu https://stackoverflow.com/users/887103 2020-02-07T18:17:36Z 2023-01-25T05:12:23Z <p>I've read the document <a href="https://threejs.org/docs/index.html#api/en/core/BufferGeometry.index" rel="nofollow noreferrer">here</a>, and from <a href="https://stackoverflow.com/questions/45123977/three-js-correct-way-to-setindex-indices-for-buffergeometry">previous question</a>, I can see</p> <blockquote> <p>The setIndex function is used to specify triangle indices that reference the vertex attribute buffers on the BufferGeometry.</p> </blockquote> <p>I think I understand 50% of these concepts, but in this <a href="https://threejs.org/examples/?q=interleave#webgl_buffergeometry_instancing_interleaved" rel="nofollow noreferrer">interleaved example</a>, (<a href="https://github.com/mrdoob/three.js/blob/dev/examples/webgl_buffergeometry_instancing_interleaved.html" rel="nofollow noreferrer">code is here</a>) What is the purpose of setting index (I know it is specifying triangle indices)? but why?</p> <pre class="lang-js prettyprint-override"><code>var indices = new Uint16Array( [ 0, 1, 2, 2, 1, 3, 4, 5, 6, 6, 5, 7, 8, 9, 10, 10, 9, 11, 12, 13, 14, 14, 13, 15, 16, 17, 18, 18, 17, 19, 20, 21, 22, 22, 21, 23 ] ); geometry.setIndex( new THREE.BufferAttribute( indices, 1 ) ); </code></pre> <p>My understanding is there are 24 vertexes, and the set index tells the renderer to use vertex at a specific index (not natural order) to arrange a triangle. But why is a new arrangement needed? Do I have to do setIndex every time in my own code?</p> https://stackoverflow.com/q/42866098 51 Nicolas S.Xu https://stackoverflow.com/users/887103 2017-03-17T19:56:37Z 2022-12-28T22:06:29Z <p>I've read <a href="https://v2.vuejs.org/v2/guide/transitions.html" rel="nofollow noreferrer">this official</a> document about Vuejs animation. But using it css hooks, I can only make element appear/disappear with fade and different duration.</p> <pre><code>&lt;div id=&quot;demo&quot;&gt; &lt;button v-on:click=&quot;show = !show&quot;&gt; Toggle &lt;/button&gt; &lt;transition name=&quot;fade&quot;&gt; &lt;p v-if=&quot;show&quot;&gt;hello&lt;/p&gt; &lt;/transition&gt; &lt;/div&gt; .fade-enter-active, .fade-leave-active { transition: opacity .5s } .fade-enter, .fade-leave-to /* .fade-leave-active in &lt;2.1.8 */ { opacity: 0 } </code></pre> <p>How to use Vuejs Animation to create a sliding effect? Like the one <a href="http://www.jssor.com/demos/full-width-slider.slider" rel="nofollow noreferrer">here</a>. Is it possible? Please provide some sample code.</p> https://stackoverflow.com/q/44444099 33 Nicolas S.Xu https://stackoverflow.com/users/887103 2017-06-08T19:29:33Z 2022-12-05T05:32:03Z <p>My Jenkins is not run in Docker container, just tradional install to VPS. I got the following error when executing a simple <a href="https://github.com/mikegcoleman/hello-jenkins" rel="noreferrer">test project</a>. I am using Ubuntu 14, java 7, and stable Jenkins. I tried all methods I can find on google, but can't get it work. </p> <p>I am trying to execute this shell</p> <pre><code>docker build --pull=true -t nick/hello-jenkins:$GIT_COMMIT . </code></pre> <p>After code change. </p> <p>Here is error: </p> <pre><code>Got permission denied while trying to connect to the Docker daemon socket at unix: .... </code></pre> <hr> <pre><code>Started by user nicolas xu Building in workspace /var/lib/jenkins/workspace/hello-Jenkins &gt; git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository &gt; git config remote.origin.url https://github.com/nicolasxu/hello-nick-jenkins.git # timeout=10 Fetching upstream changes from https://github.com/nicolasxu/hello-nick-jenkins.git &gt; git --version # timeout=10 &gt; git fetch --tags --progress https://github.com/nicolasxu/hello-nick-jenkins.git +refs/heads/*:refs/remotes/origin/* &gt; git rev-parse refs/remotes/origin/master^{commit} # timeout=10 &gt; git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 Checking out Revision d94ae21a8a2cf58ffc790dcad15bd851fb17df5a (refs/remotes/origin/master) &gt; git config core.sparsecheckout # timeout=10 &gt; git checkout -f d94ae21a8a2cf58ffc790dcad15bd851fb17df5a &gt; git rev-list d94ae21a8a2cf58ffc790dcad15bd851fb17df5a # timeout=10 [hello-Jenkins] $ /bin/sh -xe /tmp/hudson5076309502904684976.sh + docker build --pull=true -t nick/hello-jenkins:d94ae21a8a2cf58ffc790dcad15bd851fb17df5a . Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.27/build?buildargs=%7B%7D&amp;cachefrom=%5B%5D&amp;cgroupparent=&amp;cpuperiod=0&amp;cpuquota=0&amp;cpusetcpus=&amp;cpusetmems=&amp;cpushares=0&amp;dockerfile=Dockerfile&amp;labels=%7B%7D&amp;memory=0&amp;memswap=0&amp;networkmode=default&amp;pull=1&amp;rm=1&amp;shmsize=0&amp;t=nick%2Fhello-jenkins%3Ad94ae21a8a2cf58ffc790dcad15bd851fb17df5a&amp;ulimits=null: dial unix /var/run/docker.sock: connect: permission denied Build step 'Execute shell' marked build as failure Finished: FAILURE </code></pre> <p>I can run 'docker' in console as root no problem, why jenkins can't try a shell command which runs 'docker'? What is going on? Totally confused.......</p> https://stackoverflow.com/q/74406480 0 Nicolas S.Xu https://stackoverflow.com/users/887103 2022-11-11T18:01:27Z 2022-11-11T18:47:38Z <p>Below is official example in <a href="https://reactjs.org/docs/hooks-faq.html#what-can-i-do-with-hooks-that-i-couldnt-with-classes" rel="nofollow noreferrer">React document</a>. The official explanation is</p> <blockquote> <p>The problem is that inside the setInterval callback, the value of count does not change, because we’ve created a closure with the value of count set to 0 as it was when the effect callback ran.</p> </blockquote> <p>Can you show me where is the closure? I don't understand why the closure making the counter only reaches 2. I know closure, useEffect(), ()=&gt; {} will not create a closure, but I don't understand how those concepts play together in this example to make the counter bug.</p> <pre><code>import React, { useEffect, useState } from &quot;react&quot;; function Counter() { const [count, setCount] = useState(1); useEffect(() =&gt; { const id = setInterval( () =&gt; { console.log(&quot;interval callback triggered&quot;); setCount(count + 1); // This effect depends on the `count` state }, 1000); return () =&gt; clearInterval(id); }, []); // 🔴 Bug: `count` is not specified as a dependency return &lt;h1&gt;{count}&lt;/h1&gt;; } export default Counter; </code></pre> https://stackoverflow.com/q/47602091 19 Nicolas S.Xu https://stackoverflow.com/users/887103 2017-12-01T22:01:40Z 2022-06-02T08:55:49Z <p>'react-router-dom' has refresh function <a href="https://github.com/ReactTraining/react-router/blob/v0.13.3/modules/createRouter.js#L435-L437" rel="noreferrer">here</a>, but I don't know how to call this method, also their <a href="https://reacttraining.com/react-router/core/api/Route/location-object" rel="noreferrer">well formatted document</a> doesn't bother to explain this. </p> <p>window.location.reload() doesn't work for me, because it wipes out the app store as well. I changed some data, and then need to reload the route with updated data. </p> <p>I also read this: <a href="https://github.com/ReactTraining/react-router/issues/1982" rel="noreferrer">https://github.com/ReactTraining/react-router/issues/1982</a> <a href="https://github.com/ReactTraining/react-router/issues/2243" rel="noreferrer">https://github.com/ReactTraining/react-router/issues/2243</a></p> <p>this thread is exactly discussing my question: <a href="https://github.com/ReactTraining/react-router/issues/4056" rel="noreferrer">https://github.com/ReactTraining/react-router/issues/4056</a></p> <p>and still clueless how to do it. This basic function should not require too much effort, but after spending huge amount of effort, I can't reload current route. </p> <p>here is my code: </p> <pre><code>@inject('store') @observer export default class PasswordInput extends Component { constructor (props) { super(props) this.setPwd = this.setPwd.bind(this) this.submit = this.submit.bind(this) } componentWillMount() { this.case = this.props.store.case this.setState({refresh: false}) } setPwd(e) { // console.log(e) this.case.pwd = e.target.value } submit() { console.log(this.props.caseId) this.setState({refresh: true}) } render() { return ( &lt;Container&gt; &lt;div&gt;{this.state.refresh}&lt;/div&gt; { (this.state.refresh) &amp;&amp; &lt;Redirect refresh={true} to={'/cases/' + this.props.caseId}&gt;&lt;/Redirect&gt;} &lt;br /&gt; &lt;Grid columns="three"&gt; &lt;Grid.Row&gt; &lt;Grid.Column key={2}&gt; &lt;Form&gt; &lt;label&gt;Enter Password&lt;/label&gt; &lt;input placeholder="empty" type="text" onChange={this.setPwd} value={this.case.pwd}&gt;&lt;/input&gt; &lt;Button name="Save" color="green" size="mini" style={{marginTop:'1em'}} onClick={this.submit}&gt; Submit &lt;/Button&gt; &lt;/Form&gt; &lt;/Grid.Column&gt; &lt;/Grid.Row&gt; &lt;/Grid&gt; &lt;/Container&gt; ) } } </code></pre> https://stackoverflow.com/q/20753930 2 Nicolas S.Xu https://stackoverflow.com/users/887103 2013-12-24T02:08:54Z 2022-05-08T06:21:59Z <p>I am confused about /\w\b\w/. I think it should match "e w" in "we we", since:</p> <p>\w is word character which is "e"</p> <p>\b is word broundary which is " " (space)</p> <p>\w is another word which is "w"</p> <p>So the match is "e w" in "we we". But...</p> <blockquote> <p>/\w\b\w/ will never match anything, because a word character can never be followed by both a non-word and a word character.</p> </blockquote> <p>I got this one from MDN: </p> <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions?redirectlocale=en-US&amp;redirectslug=JavaScript%2FGuide%2FRegular_Expressions" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions?redirectlocale=en-US&amp;redirectslug=JavaScript%2FGuide%2FRegular_Expressions</a></p> <p>I can't understand their explanation. Can you help me explain it in baby step? Thank you!</p> <ul> <li>Nick</li> </ul> https://stackoverflow.com/q/38019094 33 Nicolas S.Xu https://stackoverflow.com/users/887103 2016-06-24T17:32:11Z 2022-04-01T22:27:47Z <p>I have very good pure Java basic knowledge. As long as there are no XML config and no project management tools involved, I am very good. </p> <p>The things that really confused me are the project management tools, e.g.: Maven, Gradle. </p> <p>I am learning Spring, and it is so confusing to me since it involves many XML files and there is no clear explanation for it. </p> <p>I am learning Spring from <a href="https://www.udemy.com/javaspring/" rel="noreferrer">this set</a> of video tutorials, Lecture 6<br> Spring "Hello World". </p> <p>I couldn't get a Spring hello world done because it requires a xxxxx.xml file to config the beans (Java object). To generate the XML files, I need to generate an XML file using a plugin on IntelliJ 2016. </p> <p>The question is I can't find the plugin to generate a XML file for the bean by following <a href="https://www.jetbrains.com/help/idea/2016.1/enabling-spring-support.html" rel="noreferrer">this official tutorial</a>. There is no such plugin called " Spring Support". </p> <p>What should I do to generate the beans.xml? (The file to manage beans for Spring)</p> https://stackoverflow.com/q/44441935 23 Nicolas S.Xu https://stackoverflow.com/users/887103 2017-06-08T17:14:46Z 2022-02-23T22:52:31Z <p>Here are my jenkins config:<a href="https://i.sstatic.net/FKoTT.png" rel="noreferrer"><img src="https://i.sstatic.net/FKoTT.png" alt="enter image description here"></a></p> <p><a href="https://i.sstatic.net/a9zI9.png" rel="noreferrer"><img src="https://i.sstatic.net/a9zI9.png" alt="enter image description here"></a></p> <p>Error message:</p> <pre><code>/var/jenkins_home/.ssh/known_hosts [SSH] No Known Hosts file was found at /var/jenkins_home/.ssh/known_hosts. Please ensure one is created at this path and that Jenkins can read it. </code></pre> <p>No matter how much I tried it doesn't work. I've read <a href="https://issues.jenkins-ci.org/browse/JENKINS-42959" rel="noreferrer">this post</a>, but still no solution.</p> https://stackoverflow.com/q/27772432 9 Nicolas S.Xu https://stackoverflow.com/users/887103 2015-01-05T01:53:15Z 2022-01-30T21:07:56Z <p>I use javascript often, and find <strong><a href="http://underscorejs.org/" rel="noreferrer">underscorejs</a></strong> is very handy for manipulating data set, such as array or object. </p> <p>I am very new to Java, and wonder if there is similar lib for Java? </p> https://stackoverflow.com/q/24723374 104 Nicolas S.Xu https://stackoverflow.com/users/887103 2014-07-13T13:53:09Z 2021-09-25T11:03:13Z <p>I have a callback function in <code>before()</code> which is for cleaning database. Is everything in <code>before()</code> guaranteed to finish before <code>it()</code> starts? </p> <pre><code>before(function(){ db.collection('user').remove({}, function(res){}); // is it guaranteed to finish before it()? }); it('test spec', function(done){ // do the test }); after(function(){ }); </code></pre> https://stackoverflow.com/q/51885554 6 Nicolas S.Xu https://stackoverflow.com/users/887103 2018-08-16T21:26:38Z 2021-06-03T02:48:53Z <pre><code>class ProductQuery(graphene.ObjectType): products = graphene.List(Product) def resolve_products(self, info): return get_all_products() </code></pre> <p>Above are my code for query all product with no param. What is I want to query product by manufacture_id? How to do I do the resolver? </p> <p>There is no document on <a href="http://docs.graphene-python.org/en/latest/types/schema/" rel="noreferrer">their official site</a>.</p> https://stackoverflow.com/q/51868132 18 Nicolas S.Xu https://stackoverflow.com/users/887103 2018-08-16T00:31:06Z 2021-05-06T17:20:39Z <p>I am not interested in the stupid lint, which is not workable at all. It can do nothing but waste of my time. </p> <p>I need a way to remove it and make sure ESLint will never appear again. What should I do? Please don't tell me to put a comment in my code to disable one warning. I need a solution to completely get rid of ESLint in vue cli 3 generated project. </p> https://stackoverflow.com/q/66860357 0 Nicolas S.Xu https://stackoverflow.com/users/887103 2021-03-29T19:21:48Z 2021-03-29T20:51:44Z <p>Caching request is a feature provided by browser itself. You can find the document here: <a href="https://developer.mozilla.org/en-US/docs/Web/API/Request/cache" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/Request/cache</a></p> <pre><code>// Download a resource with cache busting, to bypass the cache // completely. fetch(&quot;some.json&quot;, {cache: &quot;no-store&quot;}) .then(function(response) { /* consume the response */ }); // Download a resource with cache busting, but update the HTTP // cache with the downloaded resource. fetch(&quot;some.json&quot;, {cache: &quot;reload&quot;}) .then(function(response) { /* consume the response */ }); </code></pre> <p>Is there a way to use browser built-in cache feature to cache Javascript AWS SDK result in browser?</p> <p>For example, I want to use above MDN request object to cache the following AWS SDK api request:</p> <pre><code> // Function invoked by button click function speakText() { // Create the JSON parameters for getSynthesizeSpeechUrl var speechParams = { OutputFormat: &quot;mp3&quot;, SampleRate: &quot;16000&quot;, Text: &quot;&quot;, TextType: &quot;text&quot;, VoiceId: &quot;Matthew&quot; }; // Create the Polly service object and presigner object var polly = new AWS.Polly({apiVersion: '2016-06-10'}); var signer = new AWS.Polly.Presigner(speechParams, polly) // Create presigned URL of synthesized speech file signer.getSynthesizeSpeechUrl(speechParams, function(error, url) { if (error) { document.getElementById('result').innerHTML = error; } else { document.getElementById('audioSource').src = url; document.getElementById('audioPlayback').load(); document.getElementById('result').innerHTML = &quot;Speech ready to play.&quot;; } }); } </code></pre> <p>You can find the above code in <a href="https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-started-browser.html" rel="nofollow noreferrer">AWS official tutorial here</a>.</p> https://stackoverflow.com/q/60066577 6 Nicolas S.Xu https://stackoverflow.com/users/887103 2020-02-04T22:39:07Z 2021-03-21T19:34:21Z <p>Here are the documents for them:</p> <p><strong>InstancedMesh</strong>: <a href="https://threejs.org/docs/#api/en/objects/InstancedMesh" rel="noreferrer">https://threejs.org/docs/#api/en/objects/InstancedMesh</a></p> <p><strong>InstancedBufferGeometry</strong>: <a href="https://threejs.org/docs/#api/en/core/InstancedBufferGeometry" rel="noreferrer">https://threejs.org/docs/#api/en/core/InstancedBufferGeometry</a></p> <p>There are also some examples here: <a href="https://github.com/mrdoob/three.js/blob/dev/examples/webgl_buffergeometry_instancing.html" rel="noreferrer">https://github.com/mrdoob/three.js/blob/dev/examples/webgl_buffergeometry_instancing.html</a></p> <p>I know the basic concept about "instanced" in threejs and WebGL in general. My current understanding is Mesh is made of <code>Geometry</code> and <code>Material</code> (e.g. <code>const plane = new THREE.Mesh(geometry, material)</code>). Geometry does not contain color, but material does. </p> <p>From the example above, I see they put color attribute in <code>InstancedBufferGeometry</code>, which is very confusing... geometry should not have color, right? Am I wrong?</p> <pre class="lang-js prettyprint-override"><code>geometry.setAttribute( 'offset', new THREE.InstancedBufferAttribute( new Float32Array( offsets ), 3 ) ); geometry.setAttribute( 'color', new THREE.InstancedBufferAttribute( new Float32Array( colors ), 4 ) ); geometry.setAttribute( 'orientationStart', new THREE.InstancedBufferAttribute( new Float32Array( orientationsStart ), 4 ) ); geometry.setAttribute( 'orientationEnd', new THREE.InstancedBufferAttribute( new Float32Array( orientationsEnd ), 4 ) ); </code></pre> <p>My question is if I want to render 1000s of square planes with different color and move independently, should I use <code>InstancedMesh</code> or <code>InstancedBufferGeometry</code>? Why? Can they be used together? </p> https://stackoverflow.com/q/66507446 -3 Nicolas S.Xu https://stackoverflow.com/users/887103 2021-03-06T15:37:08Z 2021-03-06T18:33:12Z <pre><code>aaa = { :one =&gt; &quot;eins&quot;, :two =&gt; &quot;zwei&quot;, :three =&gt; &quot;drei&quot; } bbb = { one: &quot;eins&quot;, two: &quot;zwei&quot;, three: &quot;drei&quot; } </code></pre> <p>above are valid ruby code. at line 1, why there is &quot;:&quot; before &quot;one&quot;? What's the meaning?</p> https://stackoverflow.com/q/66341555 1 Nicolas S.Xu https://stackoverflow.com/users/887103 2021-02-23T21:46:07Z 2021-02-24T03:11:09Z <p>There are hundreds of jest test files, and in each unit test files there could be mutiple <code>describe</code> block.</p> <p>Is there a config or method to automatically run a block of code to do mock and setup before each <code>describe</code> block?</p> <p>I know a brutal method which is to put beforeAll() in each describe block in hundreds of files, but it is too much editing. I tried the <a href="https://jestjs.io/docs/en/configuration" rel="nofollow noreferrer">jest config object</a>, but didn't find any useful option.</p> https://stackoverflow.com/questions/58211880/uncaught-syntaxerror-cannot-use-import-statement-outside-a-module-when-import/64655153?cid=138521497#64655153 Nicolas S.Xu https://stackoverflow.com/users/887103 2024-06-03T22:46:52Z 2024-06-03T22:46:52Z does not work, it only produces more error https://stackoverflow.com/questions/66492412/how-to-run-jest-tests-with-coverage-for-one-file/66492413?cid=137952059#66492413 Nicolas S.Xu https://stackoverflow.com/users/887103 2024-03-30T21:45:55Z 2024-03-30T21:45:55Z My coverage is alway 0 by running your above yarn command. https://stackoverflow.com/questions/42182577/is-it-possible-to-use-dotenv-in-a-react-project/78099839?cid=137911770#78099839 Nicolas S.Xu https://stackoverflow.com/users/887103 2024-03-26T16:18:32Z 2024-03-26T16:18:32Z you didn&#39;t load dotenv. How could this work? https://stackoverflow.com/questions/66672232/twilio-conversation-with-chatbot/66695433?cid=137785901#66695433 Nicolas S.Xu https://stackoverflow.com/users/887103 2024-03-13T17:38:10Z 2024-03-13T17:38:10Z is Autopilot still available? I can&#39;t find Autopilot in twilio console. https://stackoverflow.com/questions/64239685/twilio-an-error-occurs-when-deploying-with-plugin/64254095?cid=137481057#64254095 Nicolas S.Xu https://stackoverflow.com/users/887103 2024-02-12T19:40:18Z 2024-02-12T19:40:18Z It does not work for me. https://stackoverflow.com/questions/13385436/renaming-xcode-header-and-implementation-files/13386106?cid=136622519#13386106 Nicolas S.Xu https://stackoverflow.com/users/887103 2023-11-16T17:00:03Z 2023-11-16T17:00:03Z this is wrong answer https://stackoverflow.com/questions/27864774/why-is-the-android-emulator-screen-blank/74376544?cid=136449243#74376544 Nicolas S.Xu https://stackoverflow.com/users/887103 2023-10-31T20:57:42Z 2023-10-31T20:57:42Z oh my god... I this issue troubled me for hours! What stupid power buttion is it? https://stackoverflow.com/questions/76672023/how-to-type-normal-fetch-return-value?cid=135176951 Nicolas S.Xu https://stackoverflow.com/users/887103 2023-07-12T15:12:45Z 2023-07-12T15:12:45Z @jcalz yes! You are right https://stackoverflow.com/questions/75177952/vue-query-returned-data-is-read-only-how-to-make-it-mutable?cid=132662001 Nicolas S.Xu https://stackoverflow.com/users/887103 2023-01-19T20:42:27Z 2023-01-19T20:42:27Z [...data.todoList, newTodo] does not work, same warning, no effect. I am not familiar with correct pattern for vue-query. Why they make the returned data read only? https://stackoverflow.com/questions/32545632/how-can-i-download-a-file-using-window-fetch/59940621?cid=132640446#59940621 Nicolas S.Xu https://stackoverflow.com/users/887103 2023-01-18T21:00:34Z 2023-01-18T21:00:34Z It does not work! it refreshes my page. https://stackoverflow.com/questions/74406480/why-setinterval-creates-a-closure-in-the-reactjs-counter/74406611?cid=131353860#74406611 Nicolas S.Xu https://stackoverflow.com/users/887103 2022-11-11T18:20:03Z 2022-11-11T18:20:03Z So arrow function will create a closure, but not creating its scope. is this right? My previous statement &quot;arrow function will not create closure&quot; is wrong, right? https://stackoverflow.com/questions/45291506/what-is-the-meaning-of-double-at-sign-before-a-symbol-name/45291553?cid=130979282#45291553 Nicolas S.Xu https://stackoverflow.com/users/887103 2022-10-24T18:16:13Z 2022-10-24T18:16:13Z I still don&#39;t understand what is well know symbol. It is so badly named. https://stackoverflow.com/questions/7738117/html-text-overflow-ellipsis-detection/10017343?cid=122469268#10017343 Nicolas S.Xu https://stackoverflow.com/users/887103 2021-09-22T20:03:51Z 2021-09-22T20:03:51Z My offsetWidth is always 0 during elipsis. what is going one? https://stackoverflow.com/questions/65862554/why-spread-operator-converts-object-param-to-one-item-array?cid=116450560 Nicolas S.Xu https://stackoverflow.com/users/887103 2021-01-23T19:13:22Z 2021-01-23T19:13:22Z @Pointy I see... it is called &quot;spread syntax&quot; in MDN. Thanks! https://stackoverflow.com/questions/65862554/why-spread-operator-converts-object-param-to-one-item-array?cid=116449217 Nicolas S.Xu https://stackoverflow.com/users/887103 2021-01-23T17:59:28Z 2021-01-23T17:59:28Z @Syder Can you explain more?