Re: GC page and block metadata storage

2018-10-02 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 2 October 2018 at 07:25:36 UTC, Per Nordlöw wrote: Should a new fresh GC for D store block metadata inside the page itself or in a (pool) structure separate from the page? I'm already aware of Dmitry's suggestion to separate value-type pools from pools of types possibly containing

Re: Write native GUI applications for Windows

2017-12-19 Thread thedeemon via Digitalmars-d-learn
On Monday, 18 December 2017 at 07:55:25 UTC, Andrey wrote: I have a question about creating native GUI applications for Windows 7 or/and Windows 10. And what about D? What should I do? Make some kind of wrapper above C WinApi? I've used DFL which is a thin wrapper over WinAPI and its native w

Re: structs inheriting from and implementing interfaces

2017-12-29 Thread thedeemon via Digitalmars-d-learn
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote: Is that simply because it hasn't been implemented or suggested yet for D, or was there a deliberate design decision? It's a design decision. Look carefully at structs vs. classes here: https://dlang.org/spec/struct.html There is

Re: how to localize console and GUI apps in Windows

2018-01-03 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 3 January 2018 at 06:42:42 UTC, Andrei wrote: AFAIK, Windows GUI have no ANSI/OEM problem. You can use Unicode. Partly, yes. Just for a test I tried to "russify" the example Windows GUI program that comes with D installation pack (samples\d\winsamp.d). Window captions, button ca

Re: how to localize console and GUI apps in Windows

2018-01-03 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 3 January 2018 at 09:11:32 UTC, thedeemon wrote: you need to use TextOutW that accepts 16-bit Unicode, so just convert your UTF-8 D strings to 16-bit Unicode wstrings, there are appropriate conversion functions in Phobos. Some details: import std.utf : toUTF16z; ... string s = "п

Re: Gc/D_runtime prevents dangling pointers?

2018-01-03 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 3 January 2018 at 22:22:06 UTC, tipdbmp wrote: x doesn't seem to be a dangling pointer, how come? What is your definition of a dangling pointer? In the shown example we have a reference to a piece of memory containing 'x', so this memory is not freed, it's used by the program.

Re: Gc/D_runtime prevents dangling pointers?

2018-01-04 Thread thedeemon via Digitalmars-d-learn
On Thursday, 4 January 2018 at 11:05:25 UTC, tipdbmp wrote: What is your definition of a dangling pointer? A pointer pointing to freed memory, which presumably '&a[0]' should be because it reallocates. It allocates a larger array, but the old version is not freed up front. Right because there

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 09:09:00 UTC, Vino wrote: Thank you very much, can you suggest the best way around this issue. What exactly are you trying to do in Master()? The code seems very broken. Each time you write read[i] is will call read() and read the whole file, you're going to rea

Re: I want to transmit the class name and the member name in the method

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 07:40:14 UTC, Brian wrote: I think code style like: db.select(User).where(email.like("*@hotmail.com")).limit(10); You need to read about templates in D, here's a good guide: https://github.com/PhilippeSigaud/D-templates-tutorial Basically you can write a function l

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 12:40:41 UTC, Vino wrote: What exactly are you trying to do in Master()? Please find the full code, Sorry, I'm asking what problem are you solving, what the program should do, what is its idea. Not what code you have written.

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 13:09:25 UTC, Vino wrote: Sorry, I'm asking what problem are you solving, what the program should do, what is its idea. Not what code you have written. Hi, I am trying to implement data dictionary compression, and below is the function of the program, Function

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 17:50:13 UTC, thedeemon wrote: Here's my version of solution. I've used ordinary arrays instead of std.container.array, since the data itself is in GC'ed heap anyway. I used csv file separated by tabs, so told csvReader to use '\t' for delimiter. And since lines o

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 17:59:32 UTC, thedeemon wrote: Tuple!( staticMap!(Arr, ColumnTypes) ) res; // array of tuples Sorry, I meant tuple of arrays, of course.

Re: Error: variable i cannot be read at compile time

2018-01-06 Thread thedeemon via Digitalmars-d-learn
On Saturday, 6 January 2018 at 06:47:33 UTC, Vino wrote: On Friday, 5 January 2018 at 18:00:34 UTC, thedeemon wrote: On Friday, 5 January 2018 at 17:59:32 UTC, thedeemon wrote: Tuple!( staticMap!(Arr, ColumnTypes) ) res; // array of tuples Sorry, I meant tuple of arrays, of course. Hi D

Re: Error: variable i cannot be read at compile time

2018-01-07 Thread thedeemon via Digitalmars-d-learn
On Sunday, 7 January 2018 at 12:59:10 UTC, Vino wrote: Just noticed that the output writes the data and key as 2 values , but the requirnment is to write to six files, e.g That's the part you can implement yourself. Just replace those writelns with writing to corresponding files.

Re: Error: variable i cannot be read at compile time

2018-01-07 Thread thedeemon via Digitalmars-d-learn
On Sunday, 7 January 2018 at 17:30:26 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. You've said before you need 6 different files, not some tables. Also, after the "compre

Re: Error: variable i cannot be read at compile time

2018-01-08 Thread thedeemon via Digitalmars-d-learn
On Monday, 8 January 2018 at 07:37:31 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. ... Using the function countUntil find the keys for each of the column and store the res

Re: Error: variable i cannot be read at compile time

2018-01-08 Thread thedeemon via Digitalmars-d-learn
On Monday, 8 January 2018 at 07:37:31 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. Ah, sorry, now I think I get it. Your problem is you get output like ["a","b","c"] and i

Re: Storing struct in a array

2018-01-09 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 9 January 2018 at 13:49:41 UTC, Vino wrote: Hi All, It is possible to store struct in a array ans use the same in csvReader Sure, you can just pass the type of your struct to csvReader: struct Layout { string name; int value; double other; } auto readArrayOfStructs(string fname

Re: Storing struct in a array

2018-01-09 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 9 January 2018 at 18:09:58 UTC, Vino wrote: It is possible to store struct in a array ans use the same in csvReader Sure, you can just pass the type of your struct to csvReader: Array!T1 T1s; reader(fName, T1s); // pass the array Type as a function parameter First you write a

Re: Interfacing with webcam

2018-01-11 Thread thedeemon via Digitalmars-d-learn
On Thursday, 11 January 2018 at 17:02:58 UTC, Amorphorious wrote: Looking for something similar. I simply need to show the video of a camera and be able to do to basics like rotation, crop, etc. On which platform? On Windows I've successfully used DirectShow, I can show an example of working

Re: class initialization

2018-01-16 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 16 January 2018 at 03:23:20 UTC, Marc wrote: But can't figure out if D does have that for classes. I believe there's no such thing for classes, you're supposed to use constructors. Class objects are in many aspects more abstract things than POD structs: instead of accessing their

Re: Get largest heap object at runtime? ...tracking the leak

2018-01-22 Thread thedeemon via Digitalmars-d-learn
On Monday, 22 January 2018 at 06:48:00 UTC, Andres Clari wrote: Not sure why "spawn" would leak like that tho. I would assume that once the thread exits, it would get destroyed and it's resources reclaimed, specially when I have calls to "GC.collect and GC.minimize". All threads withing a pro

Re: Get largest heap object at runtime? ...tracking the leak

2018-01-22 Thread thedeemon via Digitalmars-d-learn
On Monday, 22 January 2018 at 16:37:19 UTC, Andres Clari wrote: All threads withing a process share the same heap, so whatever one thread allocated in that heap is not freed or reclaimed automatically when thread dies, it stays in the heap. Well the destructor of some Json objects and strings

Re: getting member functions of a struct and Error: identifier expected following ., not this

2018-01-23 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 23 January 2018 at 00:00:38 UTC, aliak wrote: Hi, I'm trying to get a list of only member functions of a struct. I've found that if you do not declare a struct as static inside a scope, then there's a hidden "this" member as part of the struct. Can someone explain the logic there?

Re: Strange compiler error. Whose bug is that?

2018-01-27 Thread thedeemon via Digitalmars-d-learn
On Friday, 26 January 2018 at 21:17:14 UTC, Oleksii Skidan wrote: struct Game { Triangle player = new Triangle; When you initialize a struct member like this, compiler tries to calculate the initial value and remember it as data, so each time such struct is constructed the data is just c

Re: parallelism

2018-01-27 Thread thedeemon via Digitalmars-d-learn
On Saturday, 27 January 2018 at 11:19:37 UTC, Arun Chandrasekaran wrote: Simplified test case that still errors: You got really close here. Here's a working version: enum Operation { a, b } import std.traits, std.conv, std.stdio; void main(string[] args) { auto op = Operation.a;

Re: parallelism

2018-01-27 Thread thedeemon via Digitalmars-d-learn
On Saturday, 27 January 2018 at 20:49:43 UTC, Arun Chandrasekaran wrote: Error: must use labeled break within static foreach Just follow the compiler suggestion: void main(string[] args) { auto op = Operation.a; foreach (_; 0 .. args.length) { ops: final switch (op) {

Re: How to proceed with learning to code Windows desktop applications?

2018-01-29 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 30 January 2018 at 03:07:38 UTC, rikki cattermole wrote: But since Windows is the only platform mentioned or desired for, everything you need is in WinAPI! It's like saying "everything you need is assembly language" when talking about languages and compilers. Pure WinAPI is a cru

Re: How to proceed with learning to code Windows desktop applications?

2018-01-31 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 30 January 2018 at 18:52:18 UTC, I Lindström wrote: I've been looking into C# and VS2017 today along with VisualD. Reading through all this it looks like the simplest path is to learn C# and VS and go from there. I've found a pile of courses on LinkedIn that seem to build up to what

Re: Tell GC to use shared memory

2015-10-11 Thread thedeemon via Digitalmars-d-learn
On Thursday, 8 October 2015 at 09:25:36 UTC, tcak wrote: On Thursday, 8 October 2015 at 05:46:31 UTC, ketmar wrote: On Thursday, 8 October 2015 at 04:38:43 UTC, tcak wrote: Is it possible to modify GC (without rebuilding the compiler), so it uses a given shared memory area instead of heap for

Re: Why my app require MSVCR120.dll?

2015-11-07 Thread thedeemon via Digitalmars-d-learn
On Saturday, 7 November 2015 at 10:03:58 UTC, Suliman wrote: I am using DMD. -m64 or -m32mscoff ?

Re: Why my app require MSVCR120.dll?

2015-11-08 Thread thedeemon via Digitalmars-d-learn
On Sunday, 8 November 2015 at 05:11:50 UTC, suliman wrote: On Sunday, 8 November 2015 at 04:50:49 UTC, thedeemon wrote: On Saturday, 7 November 2015 at 10:03:58 UTC, Suliman wrote: I am using DMD. -m64 or -m32mscoff ? Without any keys. I use dub for building I suspect your issue is cause

Re: How to use D parallel functions/library

2015-11-24 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 18:49:25 UTC, Bishop120 wrote: I figured this would be a simple parallel foreach function with an iota range of sizeX and just making int X declared inside the function so that I didnt have to worry about shared variable but I cant get around the alive++ reductio

Re: Make Simple Things Hard to Figure out

2015-12-21 Thread thedeemon via Digitalmars-d-learn
On Monday, 21 December 2015 at 13:51:57 UTC, default0 wrote: As this isn't really a question for Learn I'm not sure if it fits here. This is more of a "This is how I went about trying to learn X. These are the problems I encountered. Ideas to improve?" but I guess I might as well post it here.

Re: How is D doing?

2015-12-23 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 21:38:22 UTC, ZombineDev wrote: Google Trends shows something interesting: https://google.com/trends/explore#q=%2Fm%2F01kbt7%2C%20%2Fm%2F0dsbpg6%2C%20%2Fm%2F091hdj%2C%20%2Fm%2F03j_q%2C%20C%2B%2B&cmpt=q&tz=Etc%2FGMT-2 Today I Learned C++ is most interested by in E

Re: Graphics/font/platform backends with common interfaces?

2015-12-25 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 23:34:58 UTC, Rikki Cattermole wrote: So far I've been implementing windowing and image libraries for Phobos. Right now windowing works on Windows minice eventing. Once eventing is done it is ready for the first stage of feedback. I don't understand somethin

Re: Functions that return type

2016-01-20 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 20 January 2016 at 04:27:27 UTC, blm768 wrote: I guess the constraints are that of a static language. (This is not true.) I'm playing with the design of such a language myself. Basically, anything can create/use/return type objects This is usually possible in dependently type

Re: Things that keep D from evolving?

2016-02-08 Thread thedeemon via Digitalmars-d-learn
On Saturday, 6 February 2016 at 08:07:42 UTC, NX wrote: What language semantics prevent precise & fast GC implementations? Unions and easy type casting prevent precise GC. Lack of write barriers for reference-type fields prevent fast (generational and/or concurrent) GC. Some more detailed ex

Re: Things that keep D from evolving?

2016-02-10 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 9 February 2016 at 17:41:34 UTC, NX wrote: I would want it to be solved rather than being worked on... which requires design change which is probably not going to happen. There is still room for improvement though. Right. I think there are at least two things that can improve cur

Re: D Book page 402 Concurrency FAIL

2016-02-15 Thread thedeemon via Digitalmars-d-learn
On Sunday, 14 February 2016 at 22:54:36 UTC, Brother Bill wrote: Please provide full replacement of this toy program that works with D version 2.070.0 This one works fine for me in Windows with VisualD and DMD 2.070.0: -- import std.concurrency, std.stdio, std.exc

Re: Photoshop programming

2016-02-15 Thread thedeemon via Digitalmars-d-learn
On Sunday, 14 February 2016 at 09:48:54 UTC, Patience wrote: Photoshop has the ability to be controlled by scripts and programming languages. For example, C# can be used to access photoshop by adding the appropriate reference and using directives. I believe it is COM based but I am not totally

Re: Memory Efficient HashSet

2016-03-10 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 22:31:50 UTC, Nordlöw wrote: consumes 842.m MiB on my Ubuntu. Here's mine: https://bitbucket.org/infognition/robinhood/src (you just need one file rbhash.d to use in your apps) The following test takes ~130 MB and can take less with some tweaks in the settings:

Re: GC scan for pointers

2016-03-10 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 15:14:02 UTC, Gerald Jansen wrote: I've studied [1] and [2] but don't understand everything there. Hence these dumb questions: Given enum n = 100_000_000; // some big number auto a = new ulong[](n); auto b = new char[8][](n); struct S { ulong x; char[8] y;

Re: Use of GUID constants

2016-03-10 Thread thedeemon via Digitalmars-d-learn
On Thursday, 10 March 2016 at 15:48:14 UTC, Mike Parker wrote: Personally I would just declare one immutable value in module scope and be done with it. It really just doesn't matter. Unless you're following some sort of style guide, personal preference rules the day. I don't know if Rainers has

Re: Can DUB --combined builds be faster?

2016-03-14 Thread thedeemon via Digitalmars-d-learn
On Monday, 14 March 2016 at 11:50:38 UTC, Rene Zwanenburg wrote: When building in release mode the call to foo() gets inlined just fine without --combined. How does it work? Is it because the source of foo() is visible to the compiler when producing the result?

Re: Something wrong with GC

2016-03-21 Thread thedeemon via Digitalmars-d-learn
On Sunday, 20 March 2016 at 07:49:17 UTC, stunaep wrote: The gc throws invalid memory errors if I use Arrays from std.container. Those arrays are for RAII-style deterministic memory release, they shouldn't be freely mixed with GC-allocated things. What happens here is while initializing Array

Re: Something wrong with GC

2016-03-23 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 22 March 2016 at 13:46:41 UTC, stunaep wrote: So what am I do to? Just learn more about available containers and their semantics. Maybe you don't need Array!T when there is a simple T[]. If you think you do need Array, then think about memory management: where are you going to all

Re: Compiler or Interpreter or Hybrid

2016-04-20 Thread thedeemon via Digitalmars-d-learn
On Thursday, 21 April 2016 at 02:06:00 UTC, newB wrote: How is D implemented? (Compiler, Interpreter and Hybrid). Can you please explain why? Generally D is a compiled language: you give the compiler some source code and it produces executable binary with native machine code. Then you ca

Re: How do you use D to launch/open a window?

2016-04-23 Thread thedeemon via Digitalmars-d-learn
On Friday, 22 April 2016 at 21:13:31 UTC, anonymousuer wrote: What code is needed to tell D to open a window? Thank you in advance. import dlangui; mixin APP_ENTRY_POINT; extern (C) int UIAppMain(string[] args) { Window window = Platform.instance.createWindow("Window caption", null);

Re: DlangUI translations

2016-04-23 Thread thedeemon via Digitalmars-d-learn
On Saturday, 23 April 2016 at 15:44:22 UTC, stunaep wrote: I am wondering how to use other languages and how to NOT use other languages. Did you see example1 from examples folder in dlangui? It has two languages and allows switching at runtime via menu.

Re: DlangIDE Themes

2016-05-11 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 11 May 2016 at 12:55:13 UTC, Chris wrote: Is there a way I can add my own themes? I've created a theme file and added it to views/resources.list However, it doesn't show up. "Default" and "Dark" seem to be hardwired somewhere in the source code. Indeed they are, just grep for "

Re: DlangIDE Themes

2016-05-12 Thread thedeemon via Digitalmars-d-learn
On Thursday, 12 May 2016 at 09:17:24 UTC, Chris wrote: They shouldn't be hardwired. Best would be to load them dynamically with their respective names encoded in the xml file. In this way people could add their own themes as they see fit. I wouldn't mind creating themes and adding them to Dla

Re: .array changes the order

2016-05-12 Thread thedeemon via Digitalmars-d-learn
On Thursday, 12 May 2016 at 09:44:39 UTC, xtreak wrote: I came across the issue where using .array after .joiner caused the changes to the output. The program is at https://dpaste.dzfl.pl/0885ba2eddb4 . I tried to debug through the output but I couldn't get the exact issue. It will be helpful

Re: .array changes the order

2016-05-12 Thread thedeemon via Digitalmars-d-learn
On Thursday, 12 May 2016 at 10:17:19 UTC, xtreak wrote: Thanks a lot. Can you kindly elaborate a little more on File.byLine with an example of the scenario so that I don't get bitten by it. File.byLine.array works as expected for me. A little more explanation on the permutations will also be

Re: Generation of AST for semantic rule checking

2016-05-22 Thread thedeemon via Digitalmars-d-learn
On Sunday, 22 May 2016 at 04:33:44 UTC, Chris Katko wrote: Basically, I want compile-time enforcement of semantic rules. So the question is: Is there a way to get LDC2 to generate AST or similar, and if not, any other way to go about this? I think one popular approach to the task is to use l

Re: Accessing COM Objects

2016-06-14 Thread thedeemon via Digitalmars-d-learn
On Monday, 13 June 2016 at 17:38:41 UTC, Incognito wrote: Cool. Oleview gives me the idl files. How to convert the idl files to d or possibly c? There are ready tools idl2d: https://github.com/dlang/visuald/tree/master/c2d and tlb2idl: https://github.com/dlang/visuald/tree/master/tools I've

Re: Accessing COM Objects

2016-06-15 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 07:01:30 UTC, Joerg Joergonson wrote: It seems idl2d from VD is not easily compilable? I don't remember problems with that, anyway here's the binary I used: http://stuff.thedeemon.com/idl2d.exe

Re: ARSD PNG memory usage

2016-06-16 Thread thedeemon via Digitalmars-d-learn
On Friday, 17 June 2016 at 01:51:41 UTC, Joerg Joergonson wrote: Hi, so, do you have any idea why when I load an image with png.d it takes a ton of memory? I've bumped into this previously. It allocates a lot of temporary arrays for decoded chunks of data, and I managed to reduce those alloca

Re: Accessing COM Objects

2016-06-16 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 21:06:01 UTC, Joerg Joergonson wrote: Ok, I've tried things like uncommenting Document Open(BSTR Document, VARIANT As, VARIANT AsSmartObject); void Load(BSTR Document); /*[id(0x70537673)]*/ BSTR get_ScriptingVersion(); /*[id(0x70464D4D)]*/ doub

Re: Registration-free COM client

2016-06-27 Thread thedeemon via Digitalmars-d-learn
On Monday, 27 June 2016 at 21:17:52 UTC, Thalamus wrote: Hi everyone, I've succeeded in using D as a client for regular (registered) COM servers in the past, but in this case, I'm building the server as well. I would like to avoid registering it if possible so XCOPY-like deployment remains an

Re: Hooking into GC

2016-06-28 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 02:18:27 UTC, MMJones wrote: I read somewhere that one can modify the D files from phobos and runtime to supply a stub for the GC. I would like to add some logging features to the GC. You don't need to recompile anything, a stub can be installed from your progra

Re: Commit size and Page fault's very large for simple program

2016-07-04 Thread thedeemon via Digitalmars-d-learn
On Monday, 4 July 2016 at 11:56:14 UTC, Rene Zwanenburg wrote: On Monday, 4 July 2016 at 11:42:40 UTC, Rene Zwanenburg wrote: ... I forgot to mention: If you're on Windows compilation defaults to 32 bit, false pointers can be a problem with D's current GC in 32 bit applications. This isn't

Re: DFL is the best UIcontrols for D,compare it to dwt, tkd,dtk,dlangui,anchovy......

2014-05-13 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 13 May 2014 at 00:10:15 UTC, FrankLike wrote: 1.DFL's Memory Usage is the least than other. winsamp.exe is 2.1M,DFL's example's exe is 2.7M. 2.The size of DFL's example's exe files is the least than other, and only a single file. 3.DFL's source code is the most easy to understand.

Re: Are there desktop appications being developed in D currently?

2014-08-09 Thread thedeemon via Digitalmars-d-learn
On Saturday, 9 August 2014 at 00:34:43 UTC, Puming wrote: Yes, rust is a more infantile language compared to D, but people are already using them to create complicate applications like browser! Heh, Rust was initially created exactly to create a browser. Servo project is its main driver and p

Re: Are there desktop appications being developed in D currently?

2014-08-09 Thread thedeemon via Digitalmars-d-learn
On Sunday, 10 August 2014 at 04:41:45 UTC, Puming wrote: Photo processing app: Disk space visualizer and redundancy searcher: A tool for watching some folders and processing video files there... Interesting :-) Unfortunately they are all windows only apps, I don't have a windows machine.

Re: Recursive data-types

2014-09-27 Thread thedeemon via Digitalmars-d-learn
On Saturday, 27 September 2014 at 11:40:19 UTC, Rikki Cattermole wrote: These definitions can't work since Function and Atom need each other in this recursive definition. How to get out of this trap? Do I have to drop Algebraic and go back to manual tagged unions? Converting Function to a

Re: A hash table implementation benchmark

2014-10-01 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 1 October 2014 at 21:40:01 UTC, Ali Çehreli wrote: Are you motivated enough to compare D's associative arrays with those results? :) Here's another benchmark: D AAs vs. Vibe.d's open addressing hashes vs. Robin Hood hashing: http://www.infognition.com/blog/2014/on_robin_hood_h

Re: Obedient threads

2014-10-02 Thread thedeemon via Digitalmars-d-learn
Just use non-blocking receives in main thread's event loop. When you get a message from child thread that it's finished playing and you decide you don't need that thread anymore, send a message to child "you're dismissed". The child should also have some loop to check for incoming messages non-

Re: Hunting down rogue memory allocations?

2014-10-03 Thread thedeemon via Digitalmars-d-learn
On Thursday, 2 October 2014 at 20:16:56 UTC, Gary Willoughby wrote: Say i have created a program written in D, what tools are available for me to track memory allocations? I wrote a tiny module trackallocs.d that inserts a GC proxy and outputs to log file (or stdout) all the allocations, gathe

Re: Hunting down rogue memory allocations?

2014-10-03 Thread thedeemon via Digitalmars-d-learn
On Friday, 3 October 2014 at 09:27:50 UTC, Kiith-Sa wrote: https://bitbucket.org/infognition/dstuff/src/ Mind if I use some parts of it in my profiler? (there's no license) Sure, it's in public domain (as noted in readme).

Re: Exception thrown while trying to read file

2014-10-03 Thread thedeemon via Digitalmars-d-learn
On Friday, 3 October 2014 at 11:30:02 UTC, Matt wrote: I am building a PE-COFF file reader file.seek(0x3c, SEEK_SET); file.readf("%d", &offs); // this is the problem line Does anyone else see whatever it is that I'm doing wrong? readf is for reading text, it expects to see some digits. You'

Re: What is a sink delegate?

2014-10-09 Thread thedeemon via Digitalmars-d-learn
On Friday, 10 October 2014 at 03:06:33 UTC, Joel wrote: How do you use that toString? Maybe an example? void main() { Try t = Try("Joel", 35); t.toString(s => writeln(s)); }

Re: Check if give an array is equal to first elements in another array

2014-10-15 Thread thedeemon via Digitalmars-d-learn
On Thursday, 16 October 2014 at 04:35:13 UTC, MachineCode wrote: Is there one function in the Phobos library to check if give an array is equal to first elements in another array? auto n = min(a.length, b.length); if (a[0..n] == b[0..n]) ...

Re: String created from buffer has wrong length and strip() result is incorrect

2014-10-17 Thread thedeemon via Digitalmars-d-learn
On Friday, 17 October 2014 at 06:29:24 UTC, Lucas Burson wrote: // This is where things breaks { ubyte[] buff = new ubyte[16]; buff[0..ATA_STR.length] = cast(ubyte[])(ATA_STR); // read the string back from the buffer, stripping whitespace string stringFromBuffer =

Re: String created from buffer has wrong length and strip() result is incorrect

2014-10-17 Thread thedeemon via Digitalmars-d-learn
You fill first few chars with data from ATA_STR but the rest 10 bytes of the array are still part of the string Edit: you fill first 5 chars and have 11 bytes of zeroes in the tail. My counting skill is too bad. ;)

Re: Does the grammar allow an alias statement without a semicolon?

2014-10-17 Thread thedeemon via Digitalmars-d-learn
On Saturday, 18 October 2014 at 00:52:23 UTC, Solomon E wrote: Hi, everyone, first post here. I'm trying to learn to parse D code. Just in case, I'll remind these two projects that might be helpful: https://github.com/Hackerpilot/libdparse https://github.com/Hackerpilot/DGrammar

Re: Really in need of help with std.container.array.d

2014-10-20 Thread thedeemon via Digitalmars-d-learn
Speaking of this module, since I cannot currently login to bugtracker, I'd like to note here that there are two major bugs in one little function: Array.Payload.length setter. One is this https://issues.dlang.org/show_bug.cgi?id=13619 and the other is reallocating without notifying GC of the p

Re: Really in need of help with std.container.array.d

2014-10-20 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 21 October 2014 at 04:22:37 UTC, thedeemon wrote: Speaking of this module, since I cannot currently login to bugtracker, I'd like to note here that there are two major bugs in one little function: Array.Payload.length setter. One is this https://issues.dlang.org/show_bug.cgi?id=1361

Re: Pointer across threads

2014-11-04 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 4 November 2014 at 14:36:19 UTC, Chris wrote: I'm still curious, though, how D handles this internally, because data.data is still mutable while the other reference to the same address (tmp) is not. What if I change data.data while the other thread is being executed? "immutable" i

Re: Access Violation Tracking

2014-11-05 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 5 November 2014 at 11:09:42 UTC, Bauss wrote: Is there any way to track down access violations, instead of me having to look through my source code manually. I have a pretty big source code and an access violation happens at runtime, but it's going to be a nightmare looking throu

Re: How to turn this C++ into D?

2014-11-06 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 5 November 2014 at 17:45:00 UTC, luminousone wrote: abstract class foo { static DList!foo foo_list; ~this(){ foo_list.remove(this); } One note: when your program exits the runtime does a final GC cycle and collects those things calling destructors/finalizers, however the

Re: Easy way to monitor gc activity?

2014-11-12 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 10:43:32 UTC, Tofu Ninja wrote: What is an easy way to monitor gc activity? Here's mine: https://bitbucket.org/infognition/dstuff/src/ A little module that allows you to track all GC allocations.

Re: Russian translation of the "range" term?

2014-11-12 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 11:50:18 UTC, Ivan Kazmenko wrote: Hi! I'm unsure what is the Russian equivalent for the term "range", as in "D range", the generalization of a pair of iterators. I think "последовательность" (sequence) is the most appropriate, because the defining characteris

Re: Destructor/Finalizer Guarantees

2014-11-12 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 22:31:17 UTC, Maxime Chevalier-Boisvert wrote: I've made it so they unregister themselves in their destructor. ... However, this only works if I can assume that the GC will first call the destructor on an object, then free the object, that this is done in a predi

Re: Destructor/Finalizer Guarantees

2014-11-12 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 04:06:11 UTC, Algo wrote: Could this work? class VM { static List[VM*] _gcRootLists; List* gcRootList; ~this() { _gcRootLists.remove(&this); No. Hash-table operations may try to allocate or free memory which is not allowed during a GC cyc

Re: std.array oddness

2014-12-13 Thread thedeemon via Digitalmars-d-learn
On Saturday, 13 December 2014 at 06:40:41 UTC, ketmar via Digitalmars-d-learn wrote: .map!"a.idup" That can be just .map!idup.

Re: Call of rmdir in destructor causes InvalidMemoryOperationError

2015-01-01 Thread thedeemon via Digitalmars-d-learn
On Thursday, 1 January 2015 at 15:14:41 UTC, Timo Gransch wrote: Hi, I have a class which unzips an archive into a temporary directory below the system temp folder. I want to delete this temporary directory in the class's destructor, but when I call rmdir there, I get an core.exception.Inva

Re: Constructing a tuple dynamically

2015-02-03 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 10:32:47 UTC, Pena wrote: How can I use this code or something similar to dynamically construct a tuple containing types of fields marked as @Cloneable? import std.traits, std.typetuple; template CloneableTypes(S) { template IsCloneable(string M) { enum Is

Re: Is there websocket client implementation for D

2015-03-25 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 24 March 2015 at 17:55:38 UTC, Ilya Korobitsyn wrote: Hello! Is there any websocket client implementation in D? There's some WebSocket stuff here: https://github.com/adamdruppe/arsd/blob/master/cgi.d It's for server side, but probably contains stuff you need for client too.

Re: Speed of horizontal flip

2015-04-01 Thread thedeemon via Digitalmars-d-learn
std.algorithm.reverse uses ranges, and shamefully DMD is really bad at optimizing away range-induced costs.

Re: C++ to D - recursion with std.variant

2015-04-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 3 April 2015 at 16:46:08 UTC, Dennis Ritchie wrote: Hi, Is it possible to write on D recursion using std.variant? Using Algebraic from std.variant and some additional templates: http://dpaste.dzfl.pl/65afd3a7ce52 (taken from this thread: http://forum.dlang.org/thread/yidovyrczgdiveq

Re: problem with parallel foreach

2015-05-12 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 12 May 2015 at 14:59:38 UTC, Gerald Jansen wrote: The output of /usr/bin/time is as follows: Lang JobsUser System Elapsed %CPU Py 2 79.242.16 0:48.90 166 D 2 19.41 10.14 0:17.96 164 Py 30 1255.17 58.38 2:39.54 823 * Pool(12) D 30 421.61

Re: problem with parallel foreach

2015-05-12 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 12 May 2015 at 17:02:19 UTC, Gerald Jansen wrote: About 3.5 million lines read by main(), 0.5 to 2 million lines read and 3.5 million lines written by runTraits (aka runJob). Each GC allocation in D is a locking operation (and disabling GC doesn't help here at all), probably each

Re: problem with parallel foreach

2015-05-12 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 12 May 2015 at 20:50:45 UTC, Gerald Jansen wrote: Your advice is appreciated but quite disheartening. I was hoping for something (nearly) as easy to use as Python's parallel.Pool() map(), given that this is essentially an "embarassingly parallel" problem. Avoidance of GC allocation

Re: problem with parallel foreach

2015-05-13 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 06:59:02 UTC, Ali Çehreli wrote: > In case of Python's parallel.Pool() separate processes do the > work without any synchronization issues. In case of D's > std.parallelism it's just threads inside one process and they > do fight for some locks, thus this result. Rig

Re: What wrong?

2015-05-15 Thread thedeemon via Digitalmars-d-learn
On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote: Simple code: http://pastebin.com/raw.php?i=7jVeMFXQ What I'm doing wrong? Try using class instead of struct. Last time I played with std.concurrency it used Variants to store the messages, so when something bigger than a little b

Re: The analogue of "fill-pointer" in D

2015-05-18 Thread thedeemon via Digitalmars-d-learn
On Monday, 18 May 2015 at 10:24:25 UTC, Dennis Ritchie wrote: No, afraid not. Function capacity is not an analogue of fill-pointers! It's exactly the same. Lisp-programmer explains the usefulness of fill-pointers as follows: "Fill pointer "cuts" the tail of the vector. In D: .length "cut

Re: -vgc Info ok?

2015-05-19 Thread thedeemon via Digitalmars-d-learn
On Monday, 18 May 2015 at 14:30:43 UTC, Chris wrote: Why is _accessing_ an assoc treated as indexing it? Are you sure you understand "indexing" as we do? It's not like indexing of databases, it's just "accessing by index" i.e. using myarray[some_index].

Re: Checking template parameter types of class

2015-05-25 Thread thedeemon via Digitalmars-d-learn
On Monday, 25 May 2015 at 04:15:00 UTC, tcak wrote: main.d(243): Error: class main.FileResourceList(T) if (is(T : FileResource)) is used as a type The error message is not indicating directly this, though logically it is still correct. Compiler means "template is used as a type" which is an

  1   2   >