Coding practices/ patterns for better code quality Ask Programming |
- Coding practices/ patterns for better code quality
- Forming a Small Group to Learn C Together
- resources/books on unit testing/mock testing and TDD ?
- How are algorithms written before being put into code, and how do you define what the algorithm is within the code itself?
- Given a set of points on a plane, how do I find the points that are within of a given distance?
- Windows API - How do I get the state of SetThreadExecutionState without setting anything?
- Computer Algebra System (symbolic algebra)/Yacas
- Help with my programming path
- What is something you wish you'd known before starting to collaborate with other developers on a project?
- How to use BFS to check if a graph is 3 colorable?
- I am trying to clone my own github repository and pass all of its contents to another repository. How to properly do that
- Problem with this auto gmail messages sender /w JavaScript
- It is flutter worth?
- Help understanding Single Responsibility Principle
- Error attempting to access database and pull from table. (Java w/SQLite)
- How can I run a computationally intense simulation in Python (via Jupyter notebooks) without crashing the program?
- Trying to spice up my python code
- Prime numbers consecutives - Python
- How to go about creating a browser extension for google chrome
- Newbie question about Visual Studio WPF .cs and xaml.cs
- finding second best MST
- Finding the longest cycle in a graph.
- (Java) Can't remove element from List/ArrayList, always gives NullPointerException or ConcurrentModificationException.
Coding practices/ patterns for better code quality Posted: 22 Mar 2020 08:43 AM PDT Hi Everyone, I have 2 years of experience but I have realised that I don't follow good coding/ programming practices, So I am trying to start from basics and learn all good practices/ patterns, I our organisation many people don't follow even the simple things like SOLID principles, naming conventions etc , But i want to learn those things , So can someone list down resources like Books, Articles, Topics, Thanks. [link] [comments] |
Forming a Small Group to Learn C Together Posted: 22 Mar 2020 06:37 PM PDT Hello Redditors, I am Casey, a 27 year old male interested in learning about computers and programming. I have already read my way through Code: The Hidden Language of Computer Hardware and Software and I am now trying to learn programming. My goal is to form a group of six people to learn with that can dedicate an average of 1 hour per day to study C (the ANSI version). I understand some days people will be to busy, and by no means will this be enforce in any harsh fashion. I believe forming a group will help me stay motivated to learn and be of value if I face any problems that feel like a wall. If you could benefit from the same, please consider joining me in this small group study. My plan is to go through the book: The C Programming Language Second Edition for ANSI C. The book is 8 chapters long and those chapters consist of 189 pages. I picked it because it's highly recommended, relatively short and was in part written by one of the creators of C. It looks to be about 20 dollars on Amazon to buy used (at the time of writing this). Communication will mostly be held through the text chat system of discord. There is a section for each chapter and people can post their solutions/problems for each chapter. There are also general chat rooms if people want to get to know each other. The server also includes 1 on 1 voice chat rooms for helping each other out as needed. While I would prefer the use of the text chat rooms so we can all look at and benefit from them, I also understand just talking it out over chat is simpler. I will be using the gcc command to compile on Fedora (linux), but you are welcome to compile however you like. If you need help learning to compile, I can help you. The book will not cover that. There are many online guides too. Send me a message through Reddit introducing yourself and why you want to learn C to join. I will send you the discord link. Should I get more than 6 people who want to join, I will mention this group is full in an edit at the top. [link] [comments] |
resources/books on unit testing/mock testing and TDD ? Posted: 22 Mar 2020 10:00 PM PDT Hello , i am a self taught programmer working for a startup (java,spring boot) . However with no formal training I never learned about unit tests/ mock testing....I have seen quite a few tutorials on them but these are quite simplistic and rudimentary. I would like to find more resources on complicated unit tests like those used in enterprise development and mock tesing with real world examples. Any resources will be handy . Books specifically on unit/mock tests/TDD will also be quite helpful [link] [comments] |
Posted: 22 Mar 2020 05:49 PM PDT Ok, weird question, but look at it like this.. however, i don't think i have actually written an algorithm. I have done a few small courses on how to use different kinds of mathematical equations, physics equations etc within programming, but yeah, i guess i've never written my own algorithm and i think it would be nice to start trying it lol. [link] [comments] |
Given a set of points on a plane, how do I find the points that are within of a given distance? Posted: 22 Mar 2020 08:51 PM PDT I'm asked to list all the points that are within the given distance for each of the points, and it has to be programmed in C++. [link] [comments] |
Windows API - How do I get the state of SetThreadExecutionState without setting anything? Posted: 22 Mar 2020 06:08 PM PDT Regarding the Windows API (Win 10, if it matters), I see that for the SetThreadExecutionState function, the return value is the previous thread execution state. However, how do I get the current state without changing it?
Edit: To clarify, if this is not global in nature, then I want to know if any application has set this (i.e. requested suspension of the screensaver). [link] [comments] |
Computer Algebra System (symbolic algebra)/Yacas Posted: 22 Mar 2020 05:41 PM PDT Hey guys! I am very new to R and programming in general, so I ask your pardon for my disturbance. I was just seeking to do a very simple thing in R and that is to create variables,solve somewhat simple equations using these variables and other objects and after create a data table with all with these result. Searching for a symbolic algebra package, I first installed a package called SymPy and did something similar to this: A <- 10 B <- 35 C <- Var("C") But after this I was unable to solve a equation like "A=B+C" for C, so I sought for this other package called Yacas, which featured the Solve function, which apparently could solve problems of these types, so I typed the function and got... solve(B+C-A, C) Error in solve.Sym(B + C - A, C) : missing(b) is not TRUE I know I am fairly new to programming and R and probably should be learning the basics, but I kinda need to learn how to do these basic symbolic algebra now, so could anyone help me? Also, for the number of variables I am planning to create and use in my data sets I've found very tiresome to type "n <- Var("n")". Are there faster, more efficient and better ways to do it? Am I on the wrong programming language? Thanks in advance and I wish you a great night! [link] [comments] |
Posted: 22 Mar 2020 05:05 PM PDT So, I have been programming for like 10 years or something, somewhat on and off, so I am far from a newb but I am also far from the skill level of most programmers with 10 years of experience. That being said, I want to start a project. Something I can dedicate a lot of time into, but I have a problem. I cannot decide what I want to do because I have too many interests in too many different areas. On the one hand, I want to do something in the field of game development, make my own little game etc etc, I have done it before and LOVE the feeling of making games. However on the other hand, I want to do something like reverse engineering/hacking etc etc, because I have always loved breaking things apart and seeing how they run on the inside. But also, on a hypothetical third hand, I love the field of artificial intelligence and would love to do something in that field, too, because it is relatively so new and such an exciting field right to be in right now. You may be thinking 'well why don't you just somehow merge the three and get the best of all the worlds?', I have thought long and hard about this and is just something that I don't think I would be able to do, or maybe my creativity simply will not allow that. My mind runs in very vicious circles. I will start programming something, let's say a game, and then a couple of hours in I will see something on Twitter about someone finding a new jailbreak for iOS and then all I want to do is that, and I will be completely turned off from making that game that I had so lovingly started mere hours ago. Please, help. I wonder if anyone else has had this strange and very annoying phenomenon happen to them, and if you have, how did you get over it? Thanks. [link] [comments] |
Posted: 22 Mar 2020 01:04 PM PDT It's going to be my first time working with another developer on a project! I've heard git merges are a pain... [link] [comments] |
How to use BFS to check if a graph is 3 colorable? Posted: 22 Mar 2020 08:21 AM PDT My attempt: Since BFS will output BFS_TREE and a tree is bipartite, therefore it'll be 2 colorable( 1 color for odd levels and 1 color for even levels). The slant edges in BFS_TREE will not create a problem, since it's b/w two levels and adjacent levels have different color anyway. Cross edges will force more colors. Further, I shouldn't have something of the type( A-B cross edge, B_C cross edge and A-C cross edge, essentially a C4) because that will make the graph 4 colorable. But then I realized, you don't necessarily need a C4 for 4 colorability. Furthermore, if there are cross edges in a level, then for the next level I cannot follow the initial coloring scheme(1 color for odd levels and 1 color for even levels) and therefore, slant edges become relevant again. Now, i'm lost. Don't know what to do. [link] [comments] |
Posted: 22 Mar 2020 11:35 AM PDT I have a github repository with a project I have been working on for a while now, full with silly commits that I don't want anybody else to see. I am now going to give access to the code to someone else, and thought I could clone my own repository and then push everything to a new repository in which one cannot see the all of the commits, but only the files as they are now. I have cloned the repo with git clone and have them in a folder in my machie, OK I initialized a new repo with ''git init'' Then followed as is on github I have created another repo and tried to follow github guidelines
I followed the guidelines like this: What am I doing wrong? Can I fix this following what I have been doing or should I take a whole different approach to create a new repo and hide my commits? [link] [comments] |
Problem with this auto gmail messages sender /w JavaScript Posted: 22 Mar 2020 02:22 PM PDT I will gift a reddit Gold-award to the first one to help me fix it, but make sure that no one has already solved it because I posted it in both javascript and askprogramming Here is a part of my code which sends some emails through gmail :
The problem occurs here:
//get idvar toId = document.getElementsByClassName('vO')[0].id; When I execute the mouse down and mouse up, it takes about two seconds for the pop up window to open, and a couple more seconds for it to generate it's unique id. So it returns an error. I thought about many solutions to this error including async/await, functions, timeouts, and spent a lot of hours trying to figure it out. But for some reason there is always one problem which ruins the code. Problems that you may think would work but wouldn't:
I know that it looks basic but for some reason I keep running into stupid errors, would love to get your support. [link] [comments] |
Posted: 22 Mar 2020 02:15 PM PDT Hi im new and i am at the starting point of learning a programming language. It is flutter (dart language) a worth study, or i should avoid it and start study another (what)? I will mostly do Apps and Games (unity) [link] [comments] |
Help understanding Single Responsibility Principle Posted: 22 Mar 2020 01:45 PM PDT I want to create a plugin for the GIS software my team of analysts are using. I would like there to be a button that the analyst can click that will load all required vector files for a project into the viewer. So the button would need to do the following:
Now, I would normally write a function that would look like something like this in Python: I guess I just don't entirely understand how to make this follow the Single Responsibility Principle. This function would clearly be hard to test. But any user-facing tool like this would necessarily need to perform a lot of distinct tasks. Thanks! [link] [comments] |
Error attempting to access database and pull from table. (Java w/SQLite) Posted: 22 Mar 2020 12:34 PM PDT Hi, so I have an sqlite database file which holds two tables: (Albums and Artists). Now, I have a method which is meant to return a list of Strings from after getting the data from the "Artists" table. But, when calling the method I am getting an error: "org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: Artists)". The table does exist so, I'm not sure the issue entirely. Could it be that the database file is not being connected to properly? The db file is contained within the projects folder so, would the dbUrl provided be appropriate? Before I was having an issue with a driver which said: no suitable driver found when attempting to have it automatically get the driver through the dbUrl so, I added the jdbc jar file to the libraries in my project and that seems to of fixed that issue. [link] [comments] |
Posted: 22 Mar 2020 08:10 AM PDT Basically I'm trying to run a relatively simple simulation in Python (via Jupyter notebooks) that is literally just a list (albeit with billions of items) that randomly picks an item in the list, changes it, and repeats a few hundred times. The program works 100% fine with smaller lists (up to 10,000 items), but if I go much higher the program will slowly try to execute and then Jupyter notebooks will crash after about two minutes. I know that it is definitely possible to run computationally intensive programs this way, as I've created neural networks for image classification using JN in the past. It took several hours to train, but the program never crashed. I have two questions: - Is there a way to tell Jupyter notebooks that I'm okay with the program taking a long time to execute (I can wait hours if necessary), and it shouldn't preemptively crash or - Should I bite the bullet and run a VM on AWS? Please help. [link] [comments] |
Trying to spice up my python code Posted: 22 Mar 2020 11:22 AM PDT Looking for a new way to implement my python codes Currently I use sublime text editor. Recently I have been dabbling with MATLAB and I find their IDE very useful. I like the whole idea of using the command window as a shell in MATLAB, where I can create variables and run MATLAB code on those variable to test functions out etc, then just clc it all away. I want to incorporate this functionality into Sublime; in the least I want something in Sublime that lets me print out a variable in the script I am writing and display its content in the command window. Now I know this is 100% possible, I am just having a hard time using the correct syntax in my google searches to find what I am looking for. I recently worked with a flask server through Sublime, and never got around to messing with the environment I code in. I figured I would come here for input before tinkering, any thoughts? [link] [comments] |
Prime numbers consecutives - Python Posted: 22 Mar 2020 10:45 AM PDT Hi guys, I have some difficulties with a college work. I need to make a program that reads a number and checks if it's a combination of prime numbers. Example: 2020 = 17 ^ 2 + 19 ^ 2 + 23 ^ 2 + 29 ^ 2 The prime numbers should be consecutives. It's my code: I think part that cheks the prime is correct. Does anyone have any ideas? [link] [comments] |
How to go about creating a browser extension for google chrome Posted: 22 Mar 2020 10:07 AM PDT For example like Nord VPN offere you secure browsing on the web only but adding the extension to chrome. I'm just curious how something like this can be developed. [link] [comments] |
Newbie question about Visual Studio WPF .cs and xaml.cs Posted: 22 Mar 2020 08:39 AM PDT How do I connect the .cs to .xaml.cs in wpf? Some programs adding .cs in wpf and connecting it to .xaml.cs together like flies.exe and I don't know how did they connect it. Thank you in advance. [link] [comments] |
Posted: 22 Mar 2020 08:38 AM PDT MY ATTEMPT:
Is there a better way of finding second best MST? [link] [comments] |
Finding the longest cycle in a graph. Posted: 22 Mar 2020 08:27 AM PDT MY ATTEMPT: Pseudocode: Int max = -infinity; Run BFS to get BFS_tree. Put all missing edges into a set S. For every edge e(u,v) in set S, check if G-e contains a path b/w (u,v). If yes, using BFS find spath b/w u and v. Length of cycle = spath +1; Update max if current cycle length is larger. Return max; Analysis: (Edges) O(m-n+1) x O(m+n) ( using BFS to find spath) = O(m^2) = O(n^4) Is this a greedy algorithm? It seems incremental design to me. Does there exist a greedy algorithm for this problem? Can I do it in less than O(n^4) time? [link] [comments] |
Posted: 22 Mar 2020 06:31 AM PDT I have an ArrayList that has some elements that should be removed, or not even added in the first place, but it always throws on of the two exceptions mentioned in the title. So I have the following arraylist:
I add elements to it like this (this is all working so far, println prints every single element perfectly):
But I have some repeating elements that I want to remove, these all contain ".lap". So I try to remove it in a for-each loop:
Which give me a ConcurrentModificationException. I looked into it and on StackOverflow they said an Iterator should be used, so I did the following:
This one throws a NullPointerException. So I tried not removing elements, but skipping them all together when reading from the input, so I modified the first block of code like this:
This one also throws a NullPointerException. So how should I remove (or not even add in the first place) some specific lines/elements in an ArrayList? I even looked for an answer on the 2nd Google page and still nothing. [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