Jump to content

Sensei

Senior Members
  • Posts

    7938
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by Sensei

  1. What is "purpose" of fruits? They have to attract animals, which will eat them, digest and expel. Animals concentrate on eating fruits they like to eat, leaving other parts of plant undamaged. Additionally seeds are spread at much longer distance than they could reach simply failing at ground and remaining there, in close distance to original plant. Animals don't want to eat fruits they don't like, so branches of evolution of unpleasant to consume fruits are cancelled by them.
  2. Human is making CO2 directly and indirectly. Directly by breathing (it's easy to estimate exhausted gas). Indirectly by e.g. burning fossil fuels (coal, oil & gas), by professional modern food production of meat (especially), and plants (e.g. decomposition of unwanted inedible parts of vegetables and fruits, produced by farms). Mass production of cement for housing. And other chemical industry sources.
  3. If somebody has to not learn bad habits (in e.g. PHP, Perl, Python, Visual Basic) since the beginning, C/C++ is way to go.. Thanks. Many other languages relies on C/C++ statements style, and repeat and extend it (usage of braces {}, previously mentioned built-in functions/statements etc.). So somebody who will learn these basics, this knowledge will apply also later in Java, JavaScript, C#/C++ .NET Framework, and other languages.
  4. I suggest starting from C/C++. You can read this website: http://www.cplusplus.com/ In ANSI C there is really just a couple built-in functions/statements (e.g. for(), while(), do{} while; return; etc. etc.) Majority of functions(/procedures/methods) are in special libraries (stdio, stdlib, etc. etc.) They're described f.e. on this website: http://www.cplusplus.com/reference/ C/C++ is also described on MSDN (shortcut from Microsoft Developer Network) https://msdn.microsoft.com/en-us/library/hh875057.aspx While programming in C/C++ you will often (everyday?) have to search for Windows specific functions. Google "[name of function] msdn" to find article about function.
  5. I would start from drawing entire race on timeline (graph) to visualize it.. x-axis could be time, and y-axis distance.
  6. "The solar tidal force is 46% as large as the lunar." https://en.wikipedia.org/wiki/Tide
  7. That's not entirely true. Magnetic field has effect on ions. Thus there is Lorentz's force: https://en.wikipedia.org/wiki/Lorentz_force It's used to separate isotopes with different masses and elements with different charges, in mass-spectrometry.
  8. Download free Blender, or trial version of other 3D program, and you will be able to do it by yourself.. https://www.blender.org/download/ https://www.lightwave3d.com/try/
  9. Yeah, ammeter should have A letter in circle, instead of arrow..
  10. You drew weird circuit. Ammeters should be plugged in series to measure current, because they're like shortcut otherwise (extremely tiny resistance).. i.e. current will skip your 20 ohm and the rightmost 40 ohm resistors (has easier route through ammeters!)
  11. Suppose so you have calculation: a = ( b + c ) * d b+c must be added first (suppose so e=b+c) and later a = e * d It relies on result of addition! Such operation can't be done parallel. But if you have millions of such operations, you can split to first do the all b+c in loop e.g. for( int i = 0; i < max; i++ ) { e[i] = a[i] + b[i]; } and then for( int i = 0; i < max; i++ ) { a[i] = e[i] * d[i]; } or alternatively: for( int j = 0; j < thread_max; j++ ) { for( int i = j; i < max; i += thread_max ) { a[ i ] = ( b[ i ] + c[ i ] ) * d[ i ]; } } There are much harder to make working parallel calculations or operations. There is needed to know entire algorithm to judge whether it's possible, or not possible, to make it working parallel. CPU is splitting job (like office manager in company), and telling each GPU core what chunk of data it has to process. And when job is done, integrates data from various GPU cores together, or orders them to do the final integration.
  12. I gave you references to read. You didn't do it. I won't write so simple code for you. You won't learn anything this way. If you would read links that I gave, instantly you would notice there are special methods designed for your job, instead of nextLine().. Reading documentation and learning what classes have what methods with what parameters is majority of programmer's time spend on project. Built-in classes and methods you must learn (and remember!) by reading docs. https://docs.oracle.com/javase/7/docs/api/overview-summary.html java.lang , java.io, java.util, java.text, java.applet , java.math etc. etc. This is what you must read the all (at least). java.sql, java.net and java.awt won't hurt later. Print them (description of the all classes with methods), and read them in WC, metro, or bus etc. etc. in your free time. Make little test programs to check how to use methods that you just read about.
  13. 3D visualization is the main job of modern gfx card. That's what for they were designed. But I am talking about general usage of GPU for things outside of 2D/3D graphics area, for heavy math calculations of floating point numbers and integers (GFLOPS = Giga FLoating point Operations Per Second). Drawing triangle is very easy procedure, and easily can be implemented in hardware. Comparison of various gfx cards is in that case done in quantity of triangles per second ("millions/billions of triangles per second").
  14. Good start would be searching net for "cuda programming tutorial". e.g. https://www.tutorialspoint.com/cuda/cuda_quick_guide.htm There is comparison table which year of production of CPU has what GFLOPS versus GPU GFLOPS. But the real results you would get after writing equivalent code for both CPU and GPU, and benchmarking them.. There are algorithms which are easy to make them working parallel (to run on multiple CPU cores, CPU threads, or GPU cores), and there are certain algorithms which are very hard, or impossible, to convert to parallel (mostly because result from previous calculation is used in further calculation, one depending on other). Algorithm which is impossible to make it working parallel will obviously work the best on CPU which can have 2.0... 3.0 GHz per core (the larger frequency the better, the less cycles of CPU per instruction the better), because GPU core runs at much smaller frequency each (but there can be thousands of them!) than CPU..
  15. If you have String (not string) object, you have to convert it to integer. You used comparison operator > (greater than) on String object. What methods and operators are available for String you can obviously check in Oracle Java docs: https://docs.oracle.com/javase/7/docs/api/java/lang/String.html How to convert string to integer: https://stackoverflow.com/questions/5585779/how-do-i-convert-a-string-to-an-int-in-java You should also read entire Scanner class description: https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
  16. java.util.Scanner.nextLine() method is returning String object, not integer.. https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#nextLine()
  17. I am sorry for maybe too harsh my previous posts..
  18. Elitist attitude? Thx, for showing complete lack of understanding.. It's not about asking "the right sort of questions", but what is done with answers given for already existing one (from the past experience)..
  19. No. People should ask for advice, if they are really stuck. But fredreload asks for advice, and then he is NOT using them in the real world.. and it's repeated over and over and over again in many different threads.. The thing is he is not seeking for advice.. Advice could be given and then used by somebody really seeking for advice.. but he is not using any advices given here on this forum.. Somebody really seeking for advice, would write the same piece of code for multi-threaded CPU, then for multi-core GPU in OpenCL/CUDA, benchmark them on a few CPUs/GPUs, and learn what is benefit (or not) from experimental data gained by himself/herself, and share results on forum of his/her findings. Every gfxcard has different number of cores.. his CPU can have 1-6 the real cores, and 0-12 hyper-threads.. It's impossible to give him definite answers, what will work the best for him, on his machine. But he is not going to check it, will not write any code to check it... Questions are purely theoretical.. I would prefer talking with somebody who is using my advices in the real world, implementing them, when they're revealed. And then we can check whether they were good (or not) advices..
  20. Show me your OpenCL code to analyze... or whatever else are you using... CUDA? GPU has e.g. 1024 cores, running at pretty low frequency each, while CPU has very few cores/hyper-threads with e.g. 4-6 cores (8-12 hyper-threaded) (quite modern CPU @ 2018) The thing is, you never wrote the real code, for GPU.. so you have no knowledge.. Write code, and you will gain knowledge. Simple as that. Easier than writing post on forum..
  21. Binary-Tree, KD-Tree, Quad-Tree, Octree, should be implemented by programmer, who is enough knowledgeable (it's basics), and is programming it for real rather than just talking on forum... For internal organs imaging there are often used voxels (3D version of pixels in 2D).
  22. He can simply have depression or bipolar disorder. It has nothing to do with career or personal life. He forgot about you 5 minutes after banning on forum.. I don't think so.. They don't think about you. Especially if they have girlfriends/wives.
  23. That was toy, not real one..
  24. In this particular case, you don't have to. You can leave variables uninitialized during declaration, and then use operator =, instead of operator +=. But you must understand and comply to what is said in above post about uninitialized and initialized variables. Otherwise you will have unexpected random crashes in C/C++. It is very difficult to trace them.
  25. Function's local variables are allocated dynamically on the CPU stack. Stack is filled by functions, which allocates/frees this space, and can contain trash (undetermined data). If you have declaration of variable int x; it's uninitialized variable, its value can be random value. But later there is used operator +=. It's taking current value of variable (if it's initialized to 0, result is predictable), and adds to it something else. There are special debugging tools which are trashing stack and newly allocated memory on purpose, to find errors caused by using of uninitialized data. These are very hard to find errors. new operator in C++ does not clear memory of object prior calling constructor. Programmer has to do it by himself/herself in each constructor (there can be default constructor, constructor with parameters, copy-constructor etc. etc. in each of them the all object members must be manually initialized. It's easy to make mistake while adding yet another member in complex class). ps. Even if specific language initializes variables (e.g. clears them), it's good habit to clear them by yourself. One language can allow it, other one will not.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.