|
Does anyone have some tips for saving jUnit test results to a CSV? Our clients want failed tests to be written to a CSV and so far the only solutions seem to come from Apache Ant, which doesnt work with Android Studio.
|
# ? Jun 5, 2017 20:13 |
|
|
# ? May 29, 2024 01:24 |
|
nielsm posted:You have to work with mathematical points and lines (i.e. infinitely small/thin) for the usual odd/even rules to work, they can't really work in pixel land as you've realized. That doesn't solve it at all. You need to know where to start your "inside the shape" fill from, which requires you to have an algorithm that tells you whether an individual pixel is inside or outside the shape. leper khan posted:The outside edge of the texture will only ever be outside or an edge. This really isn't a well defined problem. Do you allow non simply connected shapes? "Holes" I think someone else called them. Do you allow non-connected shapes? If you allow the edge of the canvas to define regions as well, sides are bistable. In the image below, given only the boundary how do you know whether the black regions or the white regions are "in"?
|
# ? Jun 6, 2017 04:12 |
|
KernelSlanders posted:That doesn't solve it at all. You need to know where to start your "inside the shape" fill from, which requires you to have an algorithm that tells you whether an individual pixel is inside or outside the shape. How come? It's just recursively flooding to find a path to the limits of the image - any pixel inside the shape will only be connected to other 'inside' pixels or walls, so eventually the algorithm will resolve that - same for the outside ones (limited to that described situation where 'outside' touches the edges of the bitmap of course)
|
# ? Jun 6, 2017 04:59 |
|
what about something like this - start at the top left, flood outwards with some colour until you've marked every pixel that's not a wall. Scan along each row until you find another 'empty' pixel, and do it again with a new colour Each time you flood you can keep track of some statistics for that colour's region - which sides it touches, whether every pixel touches a wall, that kind of thing. You could scan for wall pixels when you're done, check which colours are in their neighbouring pixels, and that way you can determine which regions border each other I mean yeah it really depends exactly what you're doing and how you'd answer KernelSlanders's questions up there, but you could probably build up some useful stats to start categorising things, working out if a region is surrounded etc
|
# ? Jun 6, 2017 05:18 |
|
Tea Bone posted:I have an outline of a shape on a grid. I need to tell if any point on that grid is inside or outside that outline. My initial plan was to move right along the x-axis from that point and count how many times the x-axis crosses the outline. If it crosses an odd number of times it’s inside the outline, if it’s even the point is outside. KernelSlanders posted:That doesn't solve it at all. You need to know where to start your "inside the shape" fill from, which requires you to have an algorithm that tells you whether an individual pixel is inside or outside the shape. You misread the problem. You are given an outline, not blobs.
|
# ? Jun 6, 2017 05:21 |
|
leper khan posted:You misread the problem. You are given an outline, not blobs. The "blobs" are filled outlines. My point was that the outline was not specified to be a simple closed curve that does not touch the edge. You assumed that. In fact, he suggested that it could touch the edge. If so the outline defines two spaces, and which one is "in" and which one is "out" is not defined in the general case.
|
# ? Jun 6, 2017 05:36 |
baka kaba posted:How come? It's just recursively flooding to find a path to the limits of the image - any pixel inside the shape will only be connected to other 'inside' pixels or walls, so eventually the algorithm will resolve that - same for the outside ones True, there are many cases with my algorithm where you have to fix up already inside-painted pixels, specifically pixels covered by some concave shapes and other "shadowing". Red = inside, green = outside. Other colors are areas that have been colored "inside" but should have been "outside". This is filled with a simple single iteration from top left, across rows in the outer loop. This means only pixels above and to the left can already be colored "outside". The purple area has rows that start with an outline to the left and above, so they would initially seem to be inside pixels. But later pixels in the row have outside pixels above, so they get fixed there. The orange area also has rows starting with outline to the left and above, but they never hit another outside pixel. Those two cases can be solved with some simple special casing, but you can make shapes like this that will probably require a full flood-fill algorithm: Overall, if you can solve it at vector level rather than pixel level, it's much cleaner there.
|
|
# ? Jun 6, 2017 07:30 |
|
At first I thought you could just use a state machine INSIDE points to itself for white and points to INBORDER for the border color, then INBORDER points to itself for border color and to OUTSIDE for white, and then OUTSIDE points to itself or OUTBORDER which points to itself or INSIDE. Actually you could have a border go one pixel up and back down and you'd be back inside ___—___ so I guess you do have to fill it
|
# ? Jun 6, 2017 22:53 |
Well I couldn't leave it be so I went ahead and wrote a lovely implementation. C# WPF app source This one makes a new call on the stack for every pixel getting backfilled, so it can easily get unwieldy I think. It gets mitigated by it actually using iterators but if you removed that part (only done to support animating the process) you'd quickly end up with stack pains. Various flood filling strategies should be implemented in a less stack-hungry way, e.g. "fill upwards until a border pixel is hit", "fill left until a border pixel is hit", etc. Edit: Well, after some sleep I had to improve on it, and write a version without (syntactical) recursion. Updated code nielsm fucked around with this message at 10:27 on Jun 7, 2017 |
|
# ? Jun 7, 2017 02:23 |
|
Thanks every one. Like I said before this isn't really for anything in particular I was just messing around with something I thought would be fairly straight forward but turned out to be more complex than I expected. To answer the question about dealing with holes, I hadn't really considered that, but I guess once I could just outline both shapes (the shape itself and the hole) then once I've 'filled' each, just inverse any shape that's inside another?
|
# ? Jun 7, 2017 14:48 |
|
Your original intuition was pretty good. The problem with that corner is resolved if you decompose the shape into separate line segments, and test for crossing against each of those. Then, it will hit that corner twice, and your even-odd algorithm will work. You may also want to consider the non-zero winding rule. There's really only a difference for self-intersecting shapes. https://en.wikipedia.org/wiki/Nonzero-rule
|
# ? Jun 7, 2017 14:56 |
|
Any recommendations for a nice Python library to do simple 3D visualizations that I can move the viewport around in? I need to be able to place vertices (in code, I'll read the vertices in), group vertices together to form a surface, and render these surfaces (solid color is fine). I will have multiple, disconnected surfaces. It'd be good to have the ability to manipulate the rendering viewport so I can check dimensions of surfaces/objects and whatnot. If I can toggle a wire frame mode, that'd be a big plus too. I did this about a year ago with some OpenGL based package and proceeded to throw the code away because "Hey that was easy enough I'll not need this later." and then forgot what library I used.
|
# ? Jun 7, 2017 22:40 |
|
CS newbie here, coding a rock-paper-scissors game for all the learning fun that it entails so I am having a bit of trouble with a print statement that is not going for me - the endstate for a player win does not print for some reason that I can't figure it out (apologies for the conditional spaghetti, I am sure that there are more elegant solutions but hey I am learning the ropes): Python code:
many thanks in advance!
|
# ? Jun 8, 2017 01:02 |
|
dead comedy forums posted:So what happens is that when the player wins the round the victory message doesn't show up, while if the computer wins or the game ties, it doesn't show anything. I am suspecting it has something to do with my use of two different functions, but I have no idea at all. You have a big if-elif-elif-elif-...-else block controlling most of your logic. Python will seek through that block until it finds the first conditional that passes, and it will ignore the others. Your tests for "computer wins" are therefore overshadowing your tests for "player wins" -- Python sees the first "user chose "R"" block and ignores the second one. You should be using "and" statements here instead: code:
|
# ? Jun 8, 2017 01:17 |
|
aha, fantastic - I was trying to make a program like to train conditional work exactly because of stuff like that thanks again!
|
# ? Jun 8, 2017 01:36 |
|
I am trying to round out my self taught education. I have a degree in mechanical engineering so I five semester of Calculus, 2 Intro to Programming classes, and Linear Algebra from that. I'm just wrapping up a data structures and algorithms course. I have several years experience with Python using it on everything from the Raspberry Pi, to building websites, to writing scripts to automate processes. I've programmed Arduino Micro Controllers with C++. I've built websites with HTML, CSS, JS, and associated libraries on the front end. For the back end I've done Flask, Django, WordPress, and MySQL. I also have knowledge of random stuff that fits into all these things like using GIT, JIRA, the command line, Linux OS, etc. Are there any glaring holes in my education that I should be focusing on now? Two gaps I've identified are a lack of a lower level language like C++ or Java and phone apps. Beyond that I'm not really sure. I poked around a university syllabus and nothing immediately jumped out at me.
|
# ? Jun 8, 2017 21:48 |
|
huhu posted:I am trying to round out my self taught education. I have a degree in mechanical engineering so I five semester of Calculus, 2 Intro to Programming classes, and Linear Algebra from that. I'm just wrapping up a data structures and algorithms course. I have several years experience with Python using it on everything from the Raspberry Pi, to building websites, to writing scripts to automate processes. I've programmed Arduino Micro Controllers with C++. I've built websites with HTML, CSS, JS, and associated libraries on the front end. For the back end I've done Flask, Django, WordPress, and MySQL. I also have knowledge of random stuff that fits into all these things like using GIT, JIRA, the command line, Linux OS, etc. Are there any glaring holes in my education that I should be focusing on now? Two gaps I've identified are a lack of a lower level language like C++ or Java and phone apps. Beyond that I'm not really sure. I poked around a university syllabus and nothing immediately jumped out at me. Ehh, it really depends on what the point of your education is.
|
# ? Jun 8, 2017 21:49 |
|
Big Data and Artificial intelligence courses may interest you, as well as mechatronics (though some schools have that as a mech/electric eng thing or as a mech/compsci thing)
|
# ? Jun 8, 2017 21:54 |
|
Thermopyle posted:Ehh, it really depends on what the point of your education is. funny Star Wars parody posted:Big Data and Artificial intelligence courses may interest you, as well as mechatronics (though some schools have that as a mech/electric eng thing or as a mech/compsci thing) Added those to my list, thanks.
|
# ? Jun 8, 2017 22:05 |
|
huhu posted:To have my self study be more or less equal to what a new grad would know. If you're looking for low-level stuff, I'd argue that the most interesting and challenging courses for those are operating systems and compilers. Those might require a bit of background in C or C++ first, and maybe familiarity with EBNF and other formal language topics. Star War Sex Parrot fucked around with this message at 23:00 on Jun 8, 2017 |
# ? Jun 8, 2017 22:25 |
|
huhu posted:To have my self study be more or less equal to what a new grad would know. As the parrot mentions, this doesn't exactly narrow it down. Also, why? A lot of it will be just useless for a lot of purposes.
|
# ? Jun 8, 2017 22:29 |
|
A good course on formal languages and theory of computation is essential. It's a broad and abstract topic, and students often hate it, but it will absolutely *hone* your programming instincts. You should cover finite automata, context free grammars, Turing machines, P v NP, complexity, and a few of the more important proofs. A course on operating systems. Also a broad topic, but very concrete. When I took it we learned a lot about threads and IPC, these days you may end up covering distributed computing. A hardware course. Learn about microchips, play with logic gates, program in a RISC assembler. I'd also recommend a survey of programming languages. Seven Languages In Seven Weeks is a fun book. If you go it on your own, do Smalltalk, Prolog, Scheme, and Io. (Io isn't important, it's just weird and fun.) After that most students take a couple deep-dive topic courses to round themselves out. Like AI, Databases, compilers, etc.
|
# ? Jun 8, 2017 22:37 |
|
lifg posted:A good course on formal languages and theory of computation is essential. It's a broad and abstract topic, and students often hate it, but it will absolutely *hone* your programming instincts. You should cover finite automata, context free grammars, Turing machines, P v NP, complexity, and a few of the more important proofs. Do you want a *JOB* as a computer toucher? Because it's legitimately interesting or because CE salaries look fatter than ME's on glassdoor?
|
# ? Jun 8, 2017 22:43 |
|
JawnV6 posted:Still not understanding the goal here, because for certain values of "new grad" folks proficient in any two of these could have fantastic careers without knowing a lick about the third. The person asked what more they needed to match a traditional education, and their background suggested programing. I gave some pretty standard topics they're missing in that regard, ones that provide a solid and broad foundation for any future in programming they decide on. I mean, you don't need *any* education to have a career in programming. But if you want a long and successful one, one where you're able to easily adapt to changing technologies and interests, you owe it to yourself to get some foundational learning in.
|
# ? Jun 8, 2017 23:13 |
|
Another thing to note is you can take all the classes you want but you're still going to be as dumb as a CS student straight out of uni unless you get an internship or job where you actually touch the computers in a business setting I did my internship in system management before deciding it wasn't for me and it took a year and a dozen interviews to get into a position where I work with code every day because I had no non-scholastic experience with coding
|
# ? Jun 8, 2017 23:33 |
|
We just had a guy join our team with a masters in CompSci and the idiot left after a week and a half because he didn't know what he was doing and felt that his assigned project was too low level for him His project was writing Squish test cases in Java
|
# ? Jun 8, 2017 23:42 |
|
Thanks for all the feedback. My original motivation for asking that question is because a few months back I learned the basics of big O notation and realized that all the code I'd written up to that point was garbage. Lots of nested for loops and things like that. I was curious if there was anything else similarly important to learn about that was obviously missing from my study. I managed to land a job as a bioinformatics software engineer building tools for scientists with Python, Flasks, MySQL, and JS but it's only a 6 month contract and I'm trying to round out my skills so that I'm competitive in 4 months when it ends.
|
# ? Jun 9, 2017 03:32 |
|
lifg posted:A good course on formal languages and theory of computation is essential. It's a broad and abstract topic, and students often hate it, but it will absolutely *hone* your programming instincts. You should cover finite automata, context free grammars, Turing machines, P v NP, complexity, and a few of the more important proofs. We didn't do a single thing with code and I had no desire to learn to code when I took the class.
|
# ? Jun 9, 2017 03:51 |
|
huhu posted:Thanks for all the feedback. My original motivation for asking that question is because a few months back I learned the basics of big O notation and realized that all the code I'd written up to that point was garbage. Lots of nested for loops and things like that. I was curious if there was anything else similarly important to learn about that was obviously missing from my study. Granted the former is convention for nested loops anyway, but it reinforces the point that the performance discussion in computing doesn't end at Big O. Topics like these are subtle but extremely important to certain applications. Here's the book's preface and table of contents if you want to glance at the topics it covers. If you do the projects for the textbook/course from the website, you'll learn a lot about low level bit fiddling, GDB for debugging, basic rules for avoiding security vulnerabilities in C, and how C memory allocators work. If that's not interesting to you, then don't worry about it. I think it's a very approachable introduction to systems stuff from a software perspective (as the title indicates). It's a keeper on my bookshelf for sure. Star War Sex Parrot fucked around with this message at 04:22 on Jun 9, 2017 |
# ? Jun 9, 2017 03:58 |
|
The core classes in an undergraduate computer science degree are those on analysis of algorithms, computer architecture, computability and complexity, and something that deals with large software systems (generally an OS class). As prerequisites to those, you'll usually take an introduction to programming, an introduction to software design, a basic discrete math class, and an introduction to algorithms and data structures. Look at the CS department webpage at your favorite big state school and you'll be able to find outlines of the major as well as some representative syllabi.
|
# ? Jun 9, 2017 05:00 |
|
That's why you use memcpy.
|
# ? Jun 9, 2017 06:01 |
|
KernelSlanders posted:That's why you use memcpy.
|
# ? Jun 9, 2017 06:33 |
|
Star War Sex Parrot posted:No poo poo. It's not arguing that it's the correct way to copy memory from one array to another. It's illustrating that how you access memory matters which programmers with a poor systems background may not understand. Oh, I wasn't disagreeing. You're right of course. I was trying to take the argument one step further. Fundamental libraries are built by people who have spent a career understanding those system level issues, and neither a naive row-first nor column-first approach is going to do better than what they put together.
|
# ? Jun 9, 2017 06:58 |
|
Star War Sex Parrot posted:I highly recommend the textbook Computer Systems: A Programmer's Perspective if you want exposure to systems topics. For example, you'll understand why two algorithms that accomplish the same task with the same time complexity can take wildly different amounts of CPU time. For example (this is from that course's slides), these two functions do the same thing but have noticeably different runtimes. All that's different from a code standpoint is the order of the iteration for the two index variables: So what's the reason there? The j arrays are stored in a one after another, so (i,j) is just incrementing the pointer, but (j,i) means you're running around in circles?
|
# ? Jun 9, 2017 13:58 |
|
dupersaurus posted:So what's the reason there? The j arrays are stored in a one after another, so (i,j) is just incrementing the pointer, but (j,i) means you're running around in circles? https://stackoverflow.com/questions/8547778/why-are-elementwise-additions-much-faster-in-separate-loops-than-in-a-combined-l/8547993#8547993 https://stackoverflow.com/questions/12264970/why-is-my-program-slow-when-looping-over-exactly-8192-elements/12265928#12265928 https://stackoverflow.com/questions/11413855/why-is-transposing-a-matrix-of-512x512-much-slower-than-transposing-a-matrix-of
|
# ? Jun 9, 2017 14:40 |
dupersaurus posted:So what's the reason there? The j arrays are stored in a one after another, so (i,j) is just incrementing the pointer, but (j,i) means you're running around in circles? Has to do with the CPU cache behavior. In the faster one, memory is accessed sequentially, which allows the cache to work as intended and lets the CPU speculatively prefetch memory into the cache before it gets hit. In the slower, memory is accessed in 8192 (or 16384) byte jumps, which the CPU cache can't help with at all.
|
|
# ? Jun 9, 2017 14:45 |
|
Anyone have experience with https://www.codacy.com/ ? I'm trying to figure out what it does over and above, eg, a private Git repo or JIRA or whatever and I'm not getting much from reading their site.
|
# ? Jun 9, 2017 14:56 |
|
Munkeymon posted:Anyone have experience with https://www.codacy.com/ ? I'm trying to figure out what it does over and above, eg, a private Git repo or JIRA or whatever and I'm not getting much from reading their site. Save time in code reviews by outsourcing the code review of common security concerns, code style violations, best practices, code coverage and other metrics to Codacy.
|
# ? Jun 9, 2017 15:03 |
|
Bob Morales posted:Save time in code reviews by outsourcing the code review of common security concerns, code style violations, best practices, code coverage and other metrics to Codacy. So I'm not missing anything and it's an expensive linter with an overdone UI?
|
# ? Jun 9, 2017 15:57 |
|
|
# ? May 29, 2024 01:24 |
|
Can someone explain linting to me like I'm five? For some reason I thought linting was making keywords a certain colour in your IDE but based on the big words wikipedia says about it, it's more about fixing your code?
|
# ? Jun 9, 2017 16:12 |