Re: Pro programmer
On Monday, 26 August 2019 at 04:39:39 UTC, Tony wrote: On Sunday, 25 August 2019 at 21:30:10 UTC, GreatSam4sure wrote: I am wondering as to what is the starting point of being a pro programmer. If I want to be a pro programmer what language must I start with? Most pro programmer I have heard of are all C and C++ Guru. Most of the best guys on this D forum falls into that category. I really want to know programming to the core not just tied to a language or just at the level of drag and drop or use a framework or library. I will appreciate your help in this matter. I am ready to put in hard work. I ready know a little of java, actionscrip 3.0, kotlin, D but at the surface level but can use them to write app. But I am a concern with a matter like how can I write a GUI toolkit from the ground up. When you say "pro programmer" are you referring to someone who programs for a living for a company or a "top-notch/very good programmer"? I am referring to a person who has a good understanding of programming that he can model any real-world situation. He can turn any real-world case to a program. For instance, I consider Walter, Andrei, etc as a pro programmer this platform. They are c and C++ programmer. What is the path of becoming very good at programming? Which language will one start with. I have some real-world situation I want to model but I am at a loss as to how to start. For instance, I do one build a GUI framework like adobe spark, javafx,etc with minimum dependency or no dependency from the ground up. The lack of easily customizable, platform native GUI in D is a real concern to me but I don't have the expertise to do it. Where is the starting point of doing such amazing thing? Thanks for your reply
.fflush() in stdio.d
Out of curiosity: Browsing the source of stdio.d I found that flush() is implemented by calling fflush from some C++ library. What I don't understand: Why is the call to fflush preceded by a dot?
Re: Pro programmer
On Sunday, 25 August 2019 at 21:30:10 UTC, GreatSam4sure wrote: I am wondering as to what is the starting point of being a pro programmer. If I want to be a pro programmer what language must I start with? Most pro programmer I have heard of are all C and C++ Guru. Most of the best guys on this D forum falls into that category. I really want to know programming to the core not just tied to a language or just at the level of drag and drop or use a framework or library. I will appreciate your help in this matter. I am ready to put in hard work. I ready know a little of java, actionscrip 3.0, kotlin, D but at the surface level but can use them to write app. But I am concern with matter like how can I write a GUI toolkit from the ground up. When you say "pro programmer" are you referring to someone who programs for a living for a company, or a "top notch/very good programmer" ?
Do I understand std.experimental.allocator composition correctly?
The documentation for std.experimental.allocator is a little dense and I wanted to make sure I am understanding composition correctly. Suppose I have the following, taken more-or-less direct from the docs: auto batchAllocator = AllocatorList!( (size_t n) => Region!Mallocator(max(n, 1024*1024)) )(); https://dlang.org/phobos/std_experimental_allocator_building_blocks_region.html#.Region Is my understanding correct that Mallocator, the ParentAllocator in Region's construction will allocate a block of at least 1 MiB when a request comes in, but calls to batchAllocator.make!(T) will allocate only enough (rounded up to some ideal like a power of 2) to store T -- until it runs out, then the AllocatorList will allocate another block of 1 MiB, and so on? Essentially, I need to allocate memory for objects in an inner loop, and I thought a better strategy would be to make big block alloc(s) as a pool and then hand out internal pointers into the pool. I previously did this will malloc() and std.conv.emplace, but this looks like a better solution, if my understanding is correct. Thank you!
Re: Setting up Dlang Environment
On Saturday, 17 August 2019 at 21:26:27 UTC, Andre Pany wrote: On Saturday, 17 August 2019 at 20:42:41 UTC, Mike Brown wrote: Hi All, I've tried installing and setting up Dlang a few times now. I'm struggling to get it reliable and to a decent environment in place. I don't really want to make this thread about specific issues - Id very much like to know if there's a decent tutorial or guide to setup Dlang? * I'd like to get the basic's down solid (One of my issues is a linker issue on release but not debug, etc) * A decent IDE which allows debugging, understanding the stack traces, step through etc? * The package management, Should I be using DUB or doing packaging etc with make files etc? I appriciate some of this is down to choice, but an idiots guide and recommended practises - to setting up the above so I can just get on with coding would be great. Kind Regards, Mike Hi Mike, Which OS do you target? Setting up DMD on e.g. Ubuntu is just installing package build-essentials and installing the dmd deb file. On Windows you just extract the 7z file and add the bin path to th PATH environment variable. I tried so far IntelliJ IDEA and Visual Studio Code. Both are multi platform and free to use. Both supports debugging but here the details really depends on your OS. For Visual Studio Code there are even different D plugins available. I used vscode-dlang and it was just a fantastic experience. (I still prefer the kind of development flow IntelliJ provides, but Intellij D support is more complex to setup). If you target Windows, there is also Visual Studio, this plugin has no dub integration as far as I know. Kind regards Andre Hi Andre, Thank you for your reply! Windows is my target system. I have (hopefully) installed the d compiler toolchain, and Visual Studio Code - along with the recommended extension. I'm wondering on the build systems, I have read up on rdmd and dub. I think these are two seperate competing build systems? Which should I use, for which situations? I'd like to use Vibe, so I guess I need to use DUB? Can I use rdmd with dub dependencys? Kind Regards, Mike
Pro programmer
I am wondering as to what is the starting point of being a pro programmer. If I want to be a pro programmer what language must I start with? Most pro programmer I have heard of are all C and C++ Guru. Most of the best guys on this D forum falls into that category. I really want to know programming to the core not just tied to a language or just at the level of drag and drop or use a framework or library. I will appreciate your help in this matter. I am ready to put in hard work. I ready know a little of java, actionscrip 3.0, kotlin, D but at the surface level but can use them to write app. But I am concern with matter like how can I write a GUI toolkit from the ground up.
Re: Sort Associative Array by Key
On Sunday, 25 August 2019 at 19:03:10 UTC, JN wrote: I think normal lambdas are better than these string ones: foo.byPair.array.sort!((a, b) => a[0] < b[0]).map!(a => a[1]).writeln; You can also use names instead of numeric indices: foo.byPair.array.sort!((a, b) => a.key < b.key).map!(a => a.value);
Re: Sort Associative Array by Key
On Sunday, 25 August 2019 at 17:01:23 UTC, a11e99z wrote: On Sunday, 25 August 2019 at 16:54:33 UTC, Samir wrote: Is there a way to output the values of an associative array based on the lexicographic order of the keys? For example, if foo = ["VXE":8, "BZP":5, "JLC":2], I'd like to output something like: 5 2 8 auto foo = ["VXE":8, "BZP":5, "JLC":2]; foo.byPair.array.sort!"a[0] I think normal lambdas are better than these string ones: foo.byPair.array.sort!((a, b) => a[0] < b[0]).map!(a => a[1]).writeln;
Re: Sort Associative Array by Key
On Sunday, 25 August 2019 at 16:54:33 UTC, Samir wrote: Is there a way to output the values of an associative array based on the lexicographic order of the keys? For example, if foo = ["VXE":8, "BZP":5, "JLC":2], I'd like to output something like: 5 2 8 auto foo = ["VXE":8, "BZP":5, "JLC":2]; foo.byPair.array.sort!"a[0]
Sort Associative Array by Key
Is there a way to output the values of an associative array based on the lexicographic order of the keys? For example, if foo = ["VXE":8, "BZP":5, "JLC":2], I'd like to output something like: 5 2 8 Thanks! Samir
Re: [Help!] Use two different assembly symbol in D, but they are same address.
On Sunday, 25 August 2019 at 13:43:42 UTC, a11e99z wrote: On Sunday, 25 August 2019 at 13:24:57 UTC, lili wrote: On Saturday, 24 August 2019 at 12:55:57 UTC, a11e99z wrote: and try to use any compiler DMD/LDC/GDC. maybe result will be that u want.
Re: [Help!] Use two different assembly symbol in D, but they are same address.
On Sunday, 25 August 2019 at 13:24:57 UTC, lili wrote: On Saturday, 24 August 2019 at 12:55:57 UTC, a11e99z wrote: On Saturday, 24 August 2019 at 12:16:34 UTC, lili wrote: On Saturday, 24 August 2019 at 12:09:19 UTC, a11e99z wrote: On Saturday, 24 August 2019 at 11:53:01 UTC, lili wrote: [...] resb 8 just reserving 8 bytes not initializing it. probably u compare some garbage. sometimes it equals, sometimes not. no? I write wrong, not if (_vga_x == _vga_y) but if (&_vga_x == &_vga_y) try to do next: add funtion in asm that returns real addresses to vga_x,y extern(C) void asmVgas( int** px, int** py) call it int *px, *py; asmVgas( &px, &py); writefln( "%s=%s,%s=%s",px, &_vga_x,py, &_vga_y); and see result I followed your suggest, call asm_fn in d function. it return address not 0 but is a correct address same as the var address show in link map file. when a try define a __shared int xx, the &xx also 0. after linked all variables address is 0 that in .bss segment. do you know why occur this? [global asm_fn] asm_fn: mov rax, p2_table ret no idea. u can to define _vga_x,_vga_y in D code and export it to asm (vice versa than now). see result again. in case still not working: make very simple app with global vars: 2 D-files OR 1 D-file and 1 asm-file (maybe its not working even for D+D files). try to get same bug from compiler/linker. fill the issue and attach both files as sample. add point (for case D+asm) "how to compile asm file for linking with D" as u did. then wait and hope.
Re: [Help!] Use two different assembly symbol in D, but they are same address.
On Saturday, 24 August 2019 at 12:55:57 UTC, a11e99z wrote: On Saturday, 24 August 2019 at 12:16:34 UTC, lili wrote: On Saturday, 24 August 2019 at 12:09:19 UTC, a11e99z wrote: On Saturday, 24 August 2019 at 11:53:01 UTC, lili wrote: [...] resb 8 just reserving 8 bytes not initializing it. probably u compare some garbage. sometimes it equals, sometimes not. no? I write wrong, not if (_vga_x == _vga_y) but if (&_vga_x == &_vga_y) try to do next: add funtion in asm that returns real addresses to vga_x,y extern(C) void asmVgas( int** px, int** py) call it int *px, *py; asmVgas( &px, &py); writefln( "%s=%s,%s=%s",px, &_vga_x,py, &_vga_y); and see result I followed your suggest, call asm_fn in d function. it return address not 0 but is a correct address same as the var address show in link map file. when a try define a __shared int xx, the &xx also 0. after linked all variables address is 0 that in .bss segment. do you know why occur this? [global asm_fn] asm_fn: mov rax, p2_table ret