okay i edited the original
i dunno what I was doing before
it makes sense now right?
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
Deleted User 3420
24492 Posts
November 28 2016 03:42 GMT
#16101
okay i edited the original i dunno what I was doing before it makes sense now right? | ||
Blitzkrieg0
United States13132 Posts
November 28 2016 04:17 GMT
#16102
+ Show Spoiler + import java.util.Random; As an additional exercise, change my code so that it only makes 4 threads, but still finds the squareroot of all the data properly. I'd say that has more practical use if nothing else. | ||
ZigguratOfUr
Iraq16955 Posts
November 28 2016 04:19 GMT
#16103
| ||
Deleted User 3420
24492 Posts
November 28 2016 04:27 GMT
#16104
thanks btw. exactly what I needed. Not as confusing as I expected. | ||
Blisse
Canada3710 Posts
November 28 2016 04:31 GMT
#16105
Or is all of this part of a program and your questions are from a variety of courses? I've never taken a single course that covered this much variety in material. | ||
Deleted User 3420
24492 Posts
November 28 2016 04:34 GMT
#16106
| ||
Blitzkrieg0
United States13132 Posts
November 28 2016 04:37 GMT
#16107
On November 28 2016 13:27 travis wrote:
thanks btw. exactly what I needed. Not as confusing as I expected. 1. as specified in problem statement 2. We're creating all the threads in this step. Each element of threads is one of the threads and the index happens to coincide nicely with each index of array we're processing. Thread has a constructor which takes a Runnable as a parameter. I've always seen Thread extended instead of implementing Runnable personally, but this works. 3. I could/should have called run() in this step. It does the same thing though. 4. Join blocks until the thread is finished processing. We ensure that each thread has finished its math with the join. I'm not sure how much you know about CPUs, processes, threads and the operating system, but I also lack the expertise to explain it well. I'd say its highly questionable to learn about threading without any knowledge of these topics though. | ||
Manit0u
Poland17186 Posts
November 28 2016 06:30 GMT
#16108
On November 28 2016 13:19 ZigguratOfUr wrote: Nietzsche once said that "State is the name of the coldest of all cold monsters." Does that mean Nietzsche was a functional programmer? Nietzsche was talking in terms of state as a country though ![]() | ||
Nesserev
Belgium2760 Posts
November 28 2016 07:16 GMT
#16109
| ||
Targe
United Kingdom14103 Posts
November 28 2016 08:01 GMT
#16110
On November 28 2016 10:24 Manit0u wrote: I think that the first thing you should work on is structuring your data properly:
Holy hell... Also, may I ask why do you want to introduce closures in C? C is not a functional language and trying to make it so isn't going to help you. Edit: I assume you have seen this already? The course I'm doing this in is 'advanced compilers', the closure is how we've been taught to introduce function calls As for the data structure, that tree->left->right stuff is me navigating the abstract syntax tree to get the required nodes (e.g. In that example the current position in the tree is at the base of a function definition and that navigates to either the location of the function name, base of the function body or arguments) generated from the inputted c program, the parser was provided code so I can't make changes. I am however quite overwhelmed with the course and the way I've done things is definitely not the best way | ||
emperorchampion
Canada9496 Posts
November 28 2016 08:02 GMT
#16111
![]() | ||
icystorage
Jollibee19343 Posts
November 28 2016 08:05 GMT
#16112
| ||
Targe
United Kingdom14103 Posts
November 28 2016 08:18 GMT
#16113
Always wondered | ||
Manit0u
Poland17186 Posts
November 28 2016 09:45 GMT
#16114
They point out some interesting pitfalls you can run into. On November 28 2016 17:18 Targe wrote: Also I have a java question, why would you ever extend thread instead of implementing runnable? Always wondered Thread already implements Runnable. The thing is, it comes with plenty of methods already defined so that you don't have to do that yourself (Runnable only has the run() prototype, so no start, stop, suspend, join etc.)... | ||
mantequilla
Turkey775 Posts
November 28 2016 09:47 GMT
#16115
| ||
Manit0u
Poland17186 Posts
November 28 2016 09:53 GMT
#16116
On November 28 2016 18:47 mantequilla wrote: is there a windows equivalent to "command &" in linux? like run program and return to console
http://www.computerhope.com/starthlp.htm | ||
Targe
United Kingdom14103 Posts
November 28 2016 10:13 GMT
#16117
On November 28 2016 18:45 Manit0u wrote: Interesting read about JS: http://bonsaiden.github.io/JavaScript-Garden/ They point out some interesting pitfalls you can run into. Show nested quote + On November 28 2016 17:18 Targe wrote: Also I have a java question, why would you ever extend thread instead of implementing runnable? Always wondered Thread already implements Runnable. The thing is, it comes with plenty of methods already defined so that you don't have to do that yourself (Runnable only has the run() prototype, so no start, stop, suspend, join etc.)... Ah that clears that up then | ||
Blitzkrieg0
United States13132 Posts
November 28 2016 12:50 GMT
#16118
| ||
RoomOfMush
1296 Posts
November 28 2016 15:22 GMT
#16119
On November 28 2016 17:18 Targe wrote: Also I have a java question, why would you ever extend thread instead of implementing runnable? Always wondered The standard way is to implement Runnable. Extending Thread is possible but doesnt give you any benefits. Thread does not have any protected methods or fields. The idea behind implementing Runnable is separation of concerns. The Thread class takes care of all the complicated stuff and the runnable defines the behavior like a Strategy pattern. On November 28 2016 18:45 Manit0u wrote: Interesting read about JS: http://bonsaiden.github.io/JavaScript-Garden/ They point out some interesting pitfalls you can run into. Show nested quote + On November 28 2016 17:18 Targe wrote: Also I have a java question, why would you ever extend thread instead of implementing runnable? Always wondered Thread already implements Runnable. The thing is, it comes with plenty of methods already defined so that you don't have to do that yourself (Runnable only has the run() prototype, so no start, stop, suspend, join etc.)... You should not use the stop() or suspend() methods on Threads in java. There was even talk about removing them from Java 8 (by having them always throw exceptions) and breaking backwards compatibility. Thats how bad they are. | ||
Targe
United Kingdom14103 Posts
November 28 2016 16:01 GMT
#16120
| ||
| ||
![]() StarCraft 2 StarCraft: Brood War Dota 2 Counter-Strike Super Smash Bros Other Games Organizations Other Games StarCraft 2 StarCraft: Brood War
StarCraft 2 • Berry_CruncH737 StarCraft: Brood War• rockletztv ![]() • Hupsaiya ![]() • LaughNgamezSOOP • sooper7s • intothetv ![]() • Kozan • IndyKCrew ![]() • AfreecaTV YouTube • Laughngamez YouTube • Migwel ![]() Other Games |
Replay Cast
Replay Cast
SOOP
SKillous vs Spirit
Tenacious Turtle Tussle
PiG Sty Festival
Serral vs TriGGeR
Cure vs SHIN
The PondCast
Replay Cast
PiG Sty Festival
Clem vs Bunny
Solar vs Zoun
Replay Cast
Korean StarCraft League
[ Show More ] PiG Sty Festival
herO vs Rogue
ByuN vs SKillous
SC Evo Complete
[BSL 2025] Weekly
PiG Sty Festival
MaxPax vs Classic
Dark vs Maru
Sparkling Tuna Cup
|
|