ReactJS Time between dates in real time Ask Programming |
- ReactJS Time between dates in real time
- Botnet to order pizza on Silicon Valley?
- Scaffolding vs manually configuring your app (Spring + Angular)
- Need to create a bot that tweets new website posts
- Help trying to figure spacing of Cumulative Trapezoidal integration (MatLab help)
- multi-threading help
- (Testing) Could someone review whether I am doing this right or not?
- [C#] Issues with trying to do maths with some VERY big numbers. Any help would be appreciated.
- I need to connect a DB table to 2 other tables with a relationship, do I need 2 relationships?
- Advice on animating an object using a 'move' method?
- Task-Based Parallelism
- When to check if file is empty before reading from said file?
ReactJS Time between dates in real time Posted: 28 Apr 2018 07:32 PM PDT I'm trying to figure out how I can make a real-time counter that will increment the seconds without having to refresh my page. Here is my code below. I'm quite new to using ReactJS any hints/help will be greatly appreciated. Thanks. import './Home.css'; import React, { Component } from 'react'; import Moment from 'react-moment'; [link] [comments] |
Botnet to order pizza on Silicon Valley? Posted: 28 Apr 2018 09:02 AM PDT Is that actually possible without obtaining a massive amount of working credit card numbers? In the show it looked like it was a pure programming feat. [link] [comments] |
Scaffolding vs manually configuring your app (Spring + Angular) Posted: 28 Apr 2018 11:59 AM PDT Recently, I've started experimenting with Spring and Angular. Now I have two choices: What would be best for learning? [link] [comments] |
Need to create a bot that tweets new website posts Posted: 28 Apr 2018 11:13 AM PDT Hello everyone, thanks in advance for reading/advising. How would I go about making a bot that scans certain websites, and tweets a URL when there is a new post to that website (think a new news article) If there's already a free/paid version of this software that exists, I'd appreciate a link to that as well! Thank you! [link] [comments] |
Help trying to figure spacing of Cumulative Trapezoidal integration (MatLab help) Posted: 28 Apr 2018 01:14 PM PDT I'm using cumtrapz given a list of voltage v and I'm trying to find the equivalent I(t) using this formula. integral(vdt) =KI(t) +Cintegration. K is a known constant. The voltages come from a rogoski coil. I'll be taking 10,000 samples of v per second. Does that mean X in cumtrapz(X,Y) is 1/10000th of a second also while ideally it would be 10ksps in actuallity it might vary is there a way to handle that or will it probably not be an issue? I know this is a pretty electronics heavy programming question if there is a better subreddit I would be willing to move it but it seemed programming specific enough I decided to post here instead of in /r/askelectronics [link] [comments] |
Posted: 28 Apr 2018 12:49 PM PDT Can any one tell me how to make each thread compute a different slice? Am assuming I need to use task queues. But am not quite sure how to implement that. .... ..... void slicer(double right, double left, int slices) { } [link] [comments] |
(Testing) Could someone review whether I am doing this right or not? Posted: 28 Apr 2018 10:27 AM PDT Hey, I'm fairly new to testing. I wrote a simple client, which can open a connection via a WebSocket and gather system informations (for now only read system env. variables). This works all fine, however I really struggle with the tests. To be honest, writing the test (doing it with the Test Driven Development approach) took me much more time than writing the productive code. Sure, I'm new to testing so I will learn with time, but I still wanted to mention that. So far I have written the folloing two class: ConfigurationProvider.java Configuration.java I only used the ConfigurationProvider class to pass the test (see the testClass below), if not for that, I would have never implemented an Interface, and would have wrote the code in a single class. My point here is: I create a lot of productive code (overhead?), just to pass my written tests. At this point I am asking myself: are my written tests maybe bad or inefficient, so they force me to write more code? ConfigurationTest Could someone review the above code and tell me how I could to better? Following up is another case, where I have some questions regarding it. The class WebSocket creates a connection, to communicate with another system. WebSocket.java Given that for testing this class I would need an integration test (since the WebSocket needs a backend), I used Mockito to mock the backend, like this: Am I doing this right? Given that I mock(fake) the backend, I consider this not really a test...but how could I test this otherwise? Besides that, the class WebSocket.java overrides methods like onOpen(line 16) - should I test these? If yes, how would I do that? Thank you for your time! [link] [comments] |
[C#] Issues with trying to do maths with some VERY big numbers. Any help would be appreciated. Posted: 28 Apr 2018 05:38 AM PDT TL;DR: This: https://pastebin.com/r7SyamF4 code isn't working, pls help :( So the numbers I am using are the factorials of 365 (and eventually the factorial of 32,768 if I can get this code working). I used wolfram alpha originally, but due to being in an environment with crap internet (I think), wolfram alpha never actually finished calculating. The formula I originally calculated is what is known as the 'Birthday Paradox'. And aims to find the probability that out of n people in a room, at least 2 share a birthday. The formula is as follows: P(n) = 1 - (365! / ((365n) * (365-n)!)) In code, this looks like this (semicolons and Console.WriteLine not included): The Factorial() is my own function which seems to work for all of my other calculations. The link to the function is here: https://pastebin.com/yKgxSxQN I intend to change the '365' and 'n' constants to considerably larger: '32768' and '500' constants so it would be ace if I could get the smaller examples working first. When I compile my current code (beware for there are an ungodly amount of brackets): https://pastebin.com/bbqe8g6j it returns NaN. So I started using the BigInteger variable thing (sorry I can't really think of what to call it in my time of need), and the code started returning '0'. I know for a fact the answer is approximately 0.501, and am confused as to why I am getting 0. I ended up just calculating the numerator and denominator on their own and got these outputs: https://pastebin.com/03RHbS04 . ... So as of half way through this post WolframAlpha started working again and I was able to calculate the equation even after substituting the 365 and n with 32768 and 500. However, I am still curious as to why my code isn't working so I will continue. My current code after a bit of fiddling looks like this: https://pastebin.com/r7SyamF4 . Note that I found what looked like a cleaner Factorial function online and used that, if someone could comment on whether or not it is actually better than the for loop I was using before, that would be great. Thanks for reading, and thanks for anyone who offers their help. [link] [comments] |
I need to connect a DB table to 2 other tables with a relationship, do I need 2 relationships? Posted: 28 Apr 2018 08:11 AM PDT I have 3 tables called: Tournament Sponsor Team a Sponsor can sponsor a team a Sponsor can sponsor a tournament both relationships are many to many, so do i need two relationships with almost identical meaning? [link] [comments] |
Advice on animating an object using a 'move' method? Posted: 28 Apr 2018 02:53 AM PDT Hi There, I need help on animating an object to move right across the screen around 35 pixels at a time every 10 seconds (this could be in one smooth movement or move all at once every 10 seconds) before moving up the screen once three times. I want to run this using a method called 'void move()' that I have already created. [link] [comments] |
Posted: 28 Apr 2018 03:02 AM PDT Hi, I am trying to implement task based parallelism in my Mandelbrot program. I was just wondering if any one knows of a good tutorial explaining how to do this and/or a sample code which is easy to understand? [link] [comments] |
When to check if file is empty before reading from said file? Posted: 28 Apr 2018 02:26 AM PDT Hi! I have a function that calls another function which reads information from a file. I'm wondering, at which point should I call Here's what I mean: Calling it in the first function which calls the second function: (FileHandler is the class the function and json file are in) Or calling it in the second function: Or should it be included in both? If so, why? [link] [comments] |
You are subscribed to email updates from AskProgramming. To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google, 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
No comments:
Post a Comment