TypeScript: Removing then statements and switching .catch statements to try/catch Ask Programming |
- TypeScript: Removing then statements and switching .catch statements to try/catch
- What Are Some of the Greatest Examples of Modular Software In Existence?
- R Studio Why does data<-mydata[XXdata$Var, ] Work, but not data<-mydata[!XXdata$Var, ]
- E/MediaPlayerNative: error (1, -2147483648) when I play a video
- How can I make binaries in Python?
- How could I automate multiple interdependent equations solving?
- How to return multiple index values in an array (Java) ?
- How do I use librairies in C?(Without using any ide)
- An idea for a collaborative app
- What conferences/talks are fun to watch when you have extra free time?
- How can I integrate my Python backend code to my tkinter GUI?
- Help!
- Need help with a coding assignment
- Are there any good guidelines or examples for designing simple byte-stream packet protocols?
- How to program Mini Rambo?
- How can I optimize my properFractions function for Long value types [Scala]
- Can blockchain solve Coronavirus contact history?
- Python PyQt5 - Change label text dynamically based on user Input
- Stuck Between Loop and Tuple Error
- How can i find time complexity of this code ?
- Simple RNG with output to CSV
- Suggestions on a tool/service to run integration tests on a schedule?
- ELI5: GraphQL, Express/Koa, Redux and Middleware (in frontend/backend)
- Conclusions on a project
TypeScript: Removing then statements and switching .catch statements to try/catch Posted: 19 Mar 2020 03:49 PM PDT Hi everyone,I am trying to remove all of the then statements from the following block of code.. so that it reads more like this.. As well as replacing any .catches with try/catch, I'm having some trouble though. [link] [comments] |
What Are Some of the Greatest Examples of Modular Software In Existence? Posted: 19 Mar 2020 04:40 PM PDT I'm looking for examples of programs where virtually every aspect of the program can be extended or replaced in some way. While I'm equally happy to see architectures or frameworks, I'm most interested in seeing examples of actual programs. While not essential to the discussion, I'm especially interested in examples that (at least partially) involve modules written in native code, though that's just my personal interest. I'm interested in learning about designing modular software, so I would love to see some of the best examples of what has already been done. I didn't have much luck finding anything when I searched, so I thought I would ask here. Best to everyone! [link] [comments] |
R Studio Why does data<-mydata[XXdata$Var, ] Work, but not data<-mydata[!XXdata$Var, ] Posted: 19 Mar 2020 07:14 PM PDT Why does data<-mydata[XXdata$Var, ] work but not data<-mydata[!XXdata$Var, ] gives error invalid argument type? I want to filter the opposite of [XXdata$Var, ], True vs False. Thank yoU! [link] [comments] |
E/MediaPlayerNative: error (1, -2147483648) when I play a video Posted: 19 Mar 2020 07:10 PM PDT I am trying to build an app that encrypts a video file, and then decrypts it too. For this, I convert the video to a byte array, and then to a String. I then convert the String back to a byte array and then try to create a .mp4 I am also not able to open the video via the file manager. You can find the code at: https://stackoverflow.com/questions/60767619/e-mediaplayernative-error-1-2147483648-when-i-play-a-video note that the file has been created successfully, and there is no issue regarding read/write permissions [link] [comments] |
How can I make binaries in Python? Posted: 19 Mar 2020 10:36 PM PDT I´m looking for a way where I can destribute my programs! [link] [comments] |
How could I automate multiple interdependent equations solving? Posted: 19 Mar 2020 12:25 PM PDT Hey guys! I was just messing around with some simple eletronic circuits and exercises and I wanted to automate the process of finding the current, voltage, resistance and power of a couple dozen resistors organized in series and parallel. For this I would use the ohm's law (Voltage = Resistance*Current), the formulas for Power (P=VxC, P=RxC² and P=V²/R) and for resistor in series and parallel (R equivalent in series = R1 + R2 + R3...; R parallel= (1/R1 + 1/R2...)-1. However, I tried to make a table in Excel and correlate each voltage, resistance, current and power cell box for each resistor using these formulas as guidelines and I soon discovered the limitations of using these standart Excel operations to solve these tables, as I don't know (or it is impossible) to assign specific variables for each value and it is impossible to make multiple equalities for each cell (like P=VxC=V²/R=RxC²). Could it be possible to solve this equations in Excel by building a table and putting values in the table or would it be more appropriate use another program or program with some language? Do someone have any guess to how to do it? Sorry for my very poor english, I am not a native speaker. Thanks in advance!! [link] [comments] |
How to return multiple index values in an array (Java) ? Posted: 19 Mar 2020 04:07 PM PDT I am trying to write a program that returns the values of the "scores" array at the odd index values (the elements at index 1,3,5,7, and 9). I used scores.length in order to return the length of the array, and work my way to returning the odd indexes from there, but I cannot figure it out. I assume I can do something similar to the charAt method, but I believe that method cannot be used for arrays. I put in a comment at the method that contains the for loop, as there is an error there that I cannot figure out (I used different data types in place of double to fix this error, but it still wont work). public class ReturnOdd { public static void main (String [] args) { int [] scores = {60,50,40,92,95,76,100,85,67,69} ; int arrayLength = scores.length ; System.out.println ("The number of scores is : " + arrayLength) ; } public static double returnOdd (int scores []) ; //error here { int count = 1 ; for (int i = 1 ; i < scores.length ; i ++) { if (scores [i] == 50) count ++; } return (double) count+scores.length ; } } [link] [comments] |
How do I use librairies in C?(Without using any ide) Posted: 19 Mar 2020 04:30 PM PDT |
An idea for a collaborative app Posted: 19 Mar 2020 06:37 PM PDT People who are quick to develop applications, could come together to create an application where: - People could offer / order supplies during quarantine (toilet paper, alcohol, food) and whoever has left, could give some - People could find apartment neighbors who offered to shop for her, she could find them through the app without knocking on doors. (That wouldn't just be for the elderly, it could be for sick people who can't get out) I don't know, I just wanted to use our knowledge and time, to create something that helps everyone at that moment [link] [comments] |
What conferences/talks are fun to watch when you have extra free time? Posted: 19 Mar 2020 06:03 PM PDT Most of us have a lot of extra free time now and I though watching confs would be a fun way to spend it. I just recently started going through some of the keynotes from past RubyConf and realized there's probably a bunch of other talks out there. What conference, keynotes, or talks would you recommend? Anyone who hasn't watched any of the RubyConf ones, I highly recommend this one where this hack writes ruby code that also compiles as javascript code (viewer discretion is advised). [link] [comments] |
How can I integrate my Python backend code to my tkinter GUI? Posted: 19 Mar 2020 02:17 PM PDT I am a learning frontend development with tkinter and I am trying to connect a backend program I wrote in Python(separate from the frontend program) to the GUI I created with tkinter. This is the backend: And this is the GUI: What gives this: GUI window I would appreciate some advice or a thread that gives a good rundown on how to do this. Thank you in advance. (For those wondering, the language is Dutch) [link] [comments] |
Posted: 19 Mar 2020 05:09 PM PDT I need help. I have an assignment due tomorrow and I didn't know how I could do it or how I could. I was out alot of the previous classes because I was having a bad reaction to my medicine so I don't have any previous work done. I just found out my teacher had the chronavirus so I have to get tested, I just don't have the time to do it. We're working with Java and I need code if you can provide it. Please help people of reddit, you're my last hope. Please. Here's the instructions. array2d_1 MultiDimensional Arrays - Create a project folder named Unit 11: 2D Arrays - Create a file named array2d_1.java Follow the directions below: // Part 1 // Create an integer multidimensional array 'evenArray' with five rows // and five columns // Populate each element with an even number using nested for loops // Write a loop to print the array // Create a method 'printMdArray' that will take in an int array, and // print it out with each rows data on its own line USING TABS // Part 2 // Create an integer 2D array 'multFive' with five rows and five // columns // Populate each element with a number that is a multiple of five // using nested for loops // Print the array using printMdArray // Write code that locates an index containing a value of 25 and print // Write code that locates an index containing a value of 30 and print // Write code that locates an index containing a value of 35 and print // Part 3 // Create an integer array 'quickArray' and populate with numbers of // your choice inside array initializers // The array must have at least two rows, but no more than 5 // Print the array by creating/using a method that handles 2D arrays // Create a String multidimensional array 'dashArray' // Instantiate dashArray with 5 rows and 5 columns // Populate the array with dashes // Print the array using printMdArray // Part 4 // Create a String 2D array 'classroom' // Populate the array with students names in this room, leaving dashes // for blanks // This array may be populated with array initializers // Print your seat location /* BONUS Create a method 'markX' that takes in two integers This method will mark an "X" at the element location of the methods' arguments and fill in a dash inside the rest This method will also print the array Eg: markX(2, 1); Output: - - - - - - - - - - - X - - - - - - - - - - - - - */ Files to Submit:
[link] [comments] |
Need help with a coding assignment Posted: 19 Mar 2020 04:00 PM PDT So basically my teacher gave me the assignment to control and RGB LED with three buttons. I did the circuitry correctly (according to him) although I don't know what I'm missing in my code. No syntax errors are present, but the problem is that a button is being registered as pressed when it's not being pressed. Here's the circuit: Code: const int LED=3; const int BUTTON=11; boolean wasButton = LOW; boolean isButton = LOW; boolean ledOn = false; void setup() { pinMode (LED, OUTPUT); pinMode (BUTTON, INPUT); Serial.begin(9600); } boolean debounce(boolean last) { boolean current = digitalRead(BUTTON); if (last != current) { delay(5); current = digitalRead(BUTTON); } return current; } void loop() { isButton = debounce(wasButton); Serial.println(isButton); if (wasButton == LOW && isButton == HIGH) { ledOn = !ledOn; } wasButton = isButton; digitalWrite(LED, ledOn); } Any thing helps. Thanks!! [link] [comments] |
Are there any good guidelines or examples for designing simple byte-stream packet protocols? Posted: 19 Mar 2020 03:58 PM PDT At work I am tasked with developing a client-server system to send requests/commands and get responses back. Normally I would use some sort of JSON stream or something web based, but this application is for embedded hardware, so it is at a low level making that difficult. I want to design a simple byte stream protocol, based on packets, but I would like some pointers on structure. I've worked with systems that had sort of an [opcode][length][crc][data] type structure, but I am wondering if that is a good way to go about it, or if there are any decent guidelines for the structure of stuff like that. Thanks in advance! [link] [comments] |
Posted: 19 Mar 2020 02:37 PM PDT Hello, I am new to programming boards. I am unsure how to refer to the pins on my board, as most examples/tutorials are for Arduino's. Is int sensorValue = analogRead(A0); the equivalent of int sensorValue = analogRead(96); According to this( https://reprap.org/wiki/MiniRambo_development), pin 96 is an Analog pin, and should have identical functionality of A0 from a standard Arduino? [link] [comments] |
How can I optimize my properFractions function for Long value types [Scala] Posted: 19 Mar 2020 10:38 AM PDT I'm working on the codewars problem Number of Proper Fractions with Denominator d. I've tried different approaches to optimizing the solution but none of which can solve for very large numbers in the allotted time. Does anyone have any tips for how to optimize the code? Code: https://scastie.scala-lang.org/t0KvxqGuTMKj6zsiiEzn5Q [link] [comments] |
Can blockchain solve Coronavirus contact history? Posted: 19 Mar 2020 06:05 PM PDT With every diagnosis linked on a blockchain we could track the spread at the individual level and find out what the most risk behaviors are for spreading this virus. [link] [comments] |
Python PyQt5 - Change label text dynamically based on user Input Posted: 19 Mar 2020 01:40 PM PDT Hi, The second creates the gui that has 2 labels and two buttons and takes the variable passed from the first file and changes the labels based on this variable (the buttons are used for data insert in a later step in a database). I have created the gui and the python script that reads the input, but I am struggling on passing this variable to the second script and on changing the label dynamically. read_user_input.py gui.ui gui.py The ui window is shown in the attached link. I searched it and didn't find a solution. Any help is appreciated. [link] [comments] |
Stuck Between Loop and Tuple Error Posted: 19 Mar 2020 12:48 PM PDT I'm trying to code a projectile that shoots from the player's position when the spacebar is pressed. On line 32 where the projectile is drawn, I get the error "an integer is required (got type tuple)", but when I change the datatype to int I get the same error. Then when I place the int command outside of the parentheses I get "int() base must be >= 2 and <= 36, or 0," however the int base error doesn't occur anywhere else that uses the values that are getting the error. Anybody know what I'm doing wrong here? My code: Thanks in advance [link] [comments] |
How can i find time complexity of this code ? Posted: 19 Mar 2020 11:47 AM PDT Hey, i was trying to find the number of primitive operations in details (i'm not sure what's called but it's something like finding an equation of n) using O notation . I'd be glad if someone helped me with this :) for (int i = 0; i < list.length - 1; i++) { if (list[i] > list[i + 1]) { swap list[i] with list[i + 1]; i = -1; } } [link] [comments] |
Posted: 19 Mar 2020 05:54 AM PDT I'm sorry if this question is super elementary. I'd like a large sampling of random 0s and 1s and its been like 20 years since I produced any code. Does anyone here know of a RNG out there that can send its output to a CSV without much hassle. I just checked github for RNG's but they all seemed to be a little more complicated than I anticipated. I have machines running windows, mac, and various flavors of linux so OS compatibility shouldn't be an issue. Again. Thank you for your help and sorry for what I assume is a very very basic question [link] [comments] |
Suggestions on a tool/service to run integration tests on a schedule? Posted: 19 Mar 2020 09:36 AM PDT I have an app that is scraping a website and extracting data from the html. I would like to set up integration tests that run on a schedule, so that if/when the target page's html changes, I am notified of it relatively soon thereafter. Does anyone have any recommendations on services to use to run tests on a schedule? We're using Travis for CI/CD, but as far as I can tell Travis doesn't support running tests on a fixed schedule. [link] [comments] |
ELI5: GraphQL, Express/Koa, Redux and Middleware (in frontend/backend) Posted: 19 Mar 2020 08:02 AM PDT I have been learning/know Vue and django. I think with that you have everything you need to get up and running more or less. I don't understand what is graphql or graphene. Don't even have the slightest clue. I am slightly confused about what is koa or express is. I thought nodejs itself was a server side language or web framework. I don't understand why people have to separately mention redux when mentioning react. State management is a essential part of front end. It is not that special to be mentioned separately. Like nobody mentions Vuex separately when talking about Vuem I have no clue what is middleware. I have googled all of them. But If you help me break it down to ELI5 level it would be very helpful. [link] [comments] |
Posted: 19 Mar 2020 07:09 AM PDT I'm finally finished final year project and am currently writing about my conclusions of the project. if you could give me some broad topics I could talk about that would be much appreciated. If knowing the project would help you recommend topics, my project is making a game using just OpenGL without any game engines or frameworks, I am using java and eclipse. [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