Re: dub projects generate docs and host on code.dlang.org?
On Monday, 4 September 2017 at 10:47:47 UTC, Manu wrote: Suggest; code.dlang.org should attempt to generate ddoc for each hosted project, host it, and clearly link to it from the project front-page. Hosted docs should be styled consistently (matching phobos?). Thoughts? - Manu It would be nice if the DUB will be able to generate "docsets" for offline documentation browsers: https://kapeli.com/dash (can be integrated into various IDEs!) https://zealdocs.org/ http://devdocs.io/
Re: dpeq - native PSQL extended query protocol client
On Monday, 4 September 2017 at 17:56:04 UTC, Boris-Barboris wrote: On Monday, 4 September 2017 at 16:05:17 UTC, denizzzka wrote: Sorry fot duplicate answer Ok, just FYI, I guess what I described was implemented in libpq for version 9.6 (but works on any PSQL since 8.4, since they all implement extended query protocol i wrote the client for) in a form of https://2ndquadrant.github.io/postgres/libpq-batch-mode.html Theese calls will be added in pq 10, not 9.6.
Re: dpeq - native PSQL extended query protocol client
On Monday, 4 September 2017 at 18:37:40 UTC, denizzzka wrote: On Monday, 4 September 2017 at 15:47:04 UTC, Boris-Barboris wrote: On Monday, 4 September 2017 at 15:40:47 UTC, denizzzka wrote: This is just internal function. Don't try to call it from your application. I guess it's the Python curse Oh... What is it: PARSE + BIND + EXEC + SYNC ? Yeah, that's what I do currently, just write the whole command chain (same goes for transaction control statement, they take 15-20 bytes before\after actual commands, so no need to send them separately) when it's built, flush it to socket and block until all results come back, finalized by ReadyForQuery message. Probably, you don't need async socket operations here at all. Oops, my mistake. This is wrong.
Re: dpeq - native PSQL extended query protocol client
On Monday, 4 September 2017 at 15:47:04 UTC, Boris-Barboris wrote: On Monday, 4 September 2017 at 15:40:47 UTC, denizzzka wrote: This is just internal function. Don't try to call it from your application. I guess it's the Python curse Oh... What is it: PARSE + BIND + EXEC + SYNC ? Yeah, that's what I do currently, just write the whole command chain (same goes for transaction control statement, they take 15-20 bytes before\after actual commands, so no need to send them separately) when it's built, flush it to socket and block until all results come back, finalized by ReadyForQuery message. Probably, you don't need async socket operations here at all. Do not mix async sockets and async postgres operations. Batch mode was added because new postgres protocol prohibits statements with separation by ; symbol, IMHO
Re: dpeq - native PSQL extended query protocol client
On Monday, 4 September 2017 at 17:56:04 UTC, Boris-Barboris wrote: On Monday, 4 September 2017 at 16:05:17 UTC, denizzzka wrote: Sorry fot duplicate answer Ok, just FYI, I guess what I described was implemented in libpq for version 9.6 (but works on any PSQL since 8.4, since they all implement extended query protocol i wrote the client for) in a form of https://2ndquadrant.github.io/postgres/libpq-batch-mode.html It was possible before, just not in libpq. Same goes for binding multiple portals to one prepared (parsed) statement. Since it's a quite new feature (1 year ago), derelict bindings should be updated. If I'll have a spare day, I'll try to do something with it. After that I will add batch mode into dpq2.
Re: dpeq - native PSQL extended query protocol client
On Monday, 4 September 2017 at 15:59:47 UTC, denizzzka wrote: Sorry fot duplicate answer
Re: dpeq - native PSQL extended query protocol client
On Monday, 4 September 2017 at 15:59:47 UTC, denizzzka wrote: Sorry fot duplicate answer
Re: dpeq - native PSQL extended query protocol client
On Monday, 4 September 2017 at 15:47:04 UTC, Boris-Barboris wrote: On Monday, 4 September 2017 at 15:40:47 UTC, denizzzka wrote: This is just internal function. Don't try to call it from your application. I guess it's the Python curse Oh... What is it: PARSE + BIND + EXEC + SYNC ? Yeah, that's what I do currently, just write the whole command chain (same goes for transaction control statement, they take 15-20 bytes before\after actual commands, so no need to send them separately) when it's built, flush it to socket and block until all results come back, finalized by ReadyForQuery message. Premature optimization, IMHO non-blocking queries available in libpq, dpq2 and in vibe.d postgres supporting package too.
Re: dpeq - native PSQL extended query protocol client
On Monday, 4 September 2017 at 15:47:04 UTC, Boris-Barboris wrote: On Monday, 4 September 2017 at 15:40:47 UTC, denizzzka wrote: This is just internal function. Don't try to call it from your application. I guess it's the Python curse Oh... What is it: PARSE + BIND + EXEC + SYNC ? Yeah, that's what I do currently, just write the whole command chain (same goes for transaction control statement, they take 15-20 bytes before\after actual commands, so no need to send them separately) when it's built, flush it to socket and block until all results come back, finalized by ReadyForQuery message. I dare say that you are engaged in premature optimization.
Re: dpeq - native PSQL extended query protocol client
On Sunday, 3 September 2017 at 22:57:39 UTC, Boris-Barboris wrote: If anyone here has some insight on typical architectural errors wich make ORM writer's life hard, please share. Also, ORM is typical architecturial error. https://en.m.wikipedia.org/wiki/Object-relational_impedance_mismatch
Re: dpeq - native PSQL extended query protocol client
On Monday, 4 September 2017 at 15:32:51 UTC, Boris-Barboris wrote: On Monday, 4 September 2017 at 15:28:11 UTC, denizzzka wrote: What do you mean? It seems like a very generic method way to send batched messages, wich would give a lot of freedom. This is just internal function. Don't try to call it from your application. Possible without any src modify. Will linux socket get a send called between them, or it will be buffered by libpq\dpq2? Oh... What is it: PARSE + BIND + EXEC + SYNC ?
Re: dpeq - native PSQL extended query protocol client
On Monday, 4 September 2017 at 15:11:37 UTC, Boris-Barboris wrote: On Monday, 4 September 2017 at 14:42:31 UTC, denizzzka wrote: https://github.com/denizzzka/vibe.d.db.postgresql uses dpq2 backend https://github.com/denizzzka/vibe.d.db.postgresql/blob/master/source/vibe/db/postgresql/package.d#L92 Very interesting read, thank you. ? Making this: https://github.com/denizzzka/vibe.d.db.postgresql/blob/master/source/vibe/db/postgresql/package.d#L131 private is probably a crime against humanity though. What do you mean? I mostly bothered with EQ protocol because I wanted to send PARSE + BIND + EXEC + SYNC without blocking. Is that possible with socket blocking flag manipulation and moderate source code modification? Possible without any src modify.
Re: dpeq - native PSQL extended query protocol client
On Sunday, 3 September 2017 at 22:57:39 UTC, Boris-Barboris wrote: I tried all existing libraries, and noted pretty mature dpq2 and ddb (and it's hb-ddb fork) libs. I didn't like the first one, because I didn't want to leave vibe-d eventloop, https://github.com/denizzzka/vibe.d.db.postgresql uses dpq2 backend
Re: What is PostgreSQL driver is most stable?
On Wednesday, 15 March 2017 at 08:54:59 UTC, Paolo Invernizzi wrote: I'm curious: ddb does not support yet arbitrary precision numbers [1], does dpq support them? Does Dlang supports them?
Online documentation generator for D projects?
Hi! Why know site what can be hooked to a github project and (re)generate documentation after commit pushing? For tiny projects it seems to be cool to put a link to this site into README.md and don't worry about documentation page.
Re: .opAssign disabled without @disable
As Alex Parrill says, on problem was in const member. But this is one of the problems, and after fix here still was an error. But alphaglosined found another problem! For some unknown reason here it is need to specify an empty postblit constructor. Full patch: https://github.com/denizzzka/r-tree/commit/ca9231df5a8a227aa9a8010b849e2e92a134f8a1 So, my problem is solved. But nevertheless maybe here is a problem in the compiler too.
Re: .opAssign disabled without @disable
On Sunday, 17 April 2016 at 06:42:39 UTC, denizzzka wrote: Tried to build small test app - is not reproduced. Also tried to reduce source: https://github.com/denizzzka/r-tree/tree/314f7f1cc1b6387915dc56dcb2d3ccbc63e19275/source In this source line 199 causes this error (https://github.com/denizzzka/r-tree/blob/314f7f1cc1b6387915dc56dcb2d3ccbc63e19275/source/package.d#L199) But if I am checkout to master and remove const from debug private const bool isLeafNode = false; It isn't fixes compiling. Second branch: I am removed const from file and add import insted of traits template function: https://github.com/denizzzka/r-tree/blob/4457025efa72a6d8a97429e09c35a3f5520c37d5/source/package.d#L26 If place this import to top of the file @disabled error is gone! Why?
Re: .opAssign disabled without @disable
Tried to build small test app - is not reproduced.
Re: .opAssign disabled without @disable
On Saturday, 16 April 2016 at 15:15:18 UTC, Alex Parrill wrote: Try removing the const from this line: debug private const bool isLeafNode = false; I suspect that D is disabling whole-structure assignment since allowing it would mean that the constant `isLeafNode` could be changed. Tried - is no avail.
Re: .opAssign disabled without @disable
On Saturday, 16 April 2016 at 11:48:56 UTC, denizzzka wrote: source/package.d(109,31): Error: function rtree.RAMNode!(Box!(int, 2), ubyte).RAMNode.opAssign is not callable because it is annotated with @disable source/package.d(110,26): Error: function rtree.RAMNode!(Box!(int, 2), ubyte).RAMNode.opAssign is not callable because it is annotated with @disable source/package.d(330,25): Error: template instance rtree.RTree!(RAMNode!(Box!(int, 2), ubyte), true) error instantiating Perhaps I should explain that struct RAMNode placed in repository above. (And it isn't contains any @disable)
.opAssign disabled without @disable
Hi! DMD and LDC2 complain about disabled opAssign, but I am not used @disable and depend package "gfm" also isn't uses @disable. Steps to reproduce: git clone https://github.com/denizzzka/r-tree.git cd r-tree git checkout 803eed22 dub test Fetching gfm 6.0.0 (getting selected version)... Placing gfm 6.0.0 to /home/denizzz/.dub/packages/... Generating test runner configuration '__test__library__' for 'library' (sourceLibrary). Performing "unittest" build using dmd for x86_64. gfm:math 6.0.0: building configuration "library"... r-tree ~master: building configuration "__test__library__"... source/package.d(109,31): Error: function rtree.RAMNode!(Box!(int, 2), ubyte).RAMNode.opAssign is not callable because it is annotated with @disable source/package.d(110,26): Error: function rtree.RAMNode!(Box!(int, 2), ubyte).RAMNode.opAssign is not callable because it is annotated with @disable source/package.d(330,25): Error: template instance rtree.RTree!(RAMNode!(Box!(int, 2), ubyte), true) error instantiating dmd failed with exit code 1. If I am try to add opAssign to struct RAMNode manually it is compiles. (But there is enough postblit constructor.)
Re: Can't Compile Global Semaphores?
On Monday, 27 July 2015 at 20:12:10 UTC, John Colvin wrote: Yes, but then core.sync.semaphore doesn't support being shared, so... I don't really understand how https://github.com/D-Programming-Language/druntime/blob/master/src/core/sync/semaphore.d#L356 is managing to avoid this Since that time is something cleared up? Faced with the same problem
dub dustmite: Initial test fails
Hi! I have a code with segfault. I decided to try to take advantage with dub dustmite: $ dub dustmite ~/ssd/pgator_dustmite0 --program-status=139 -- --config=my_pgator.conf --debug=true WARNING: A deprecated branch based version specification is used for the dependency vibe-d-postgresql. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a branch instead. Copy package 'pgator' to destination folder... Copy package 'vibe-d-postgresql' to destination folder... Copy package 'dpq2' to destination folder... Copy package 'derelict-pq' to destination folder... Copy package 'derelict-util' to destination folder... Copy package 'vibe-d' to destination folder... Copy package 'libasync' to destination folder... Copy package 'memutils' to destination folder... Copy package 'libev' to destination folder... Copy package 'libevent' to destination folder... Copy package 'openssl' to destination folder... Executing dustmite... None => No object.Exception@DustMite/dustmite.d(243): Initial test fails but if I try to run already compiled binary it is successfully core dumps: $ ./pgator --config=my_pgator.conf --debug=true; echo $? 2016-02-23T18:07:00.748:package.d:_sharedStaticCtor6:9 DerelictPQ loading... 2016-02-23T18:07:00.748:package.d:_sharedStaticCtor6:16 ...DerelictPQ loading finished 2016-02-23T18:07:00.750:package.d:connectionFactory:50 creating new connection 2016-02-23T18:07:00.750:package.d:connectionFactory:54 new connection is started 2016-02-23T18:07:00.750:package.d:runStatementBlockingManner:126 runStatementBlockingManner 2016-02-23T18:07:00.750:package.d:doQuery:66 get connection from a pool 2016-02-23T18:07:00.753:package.d:doQuery:90 doesQuery() call 2016-02-23T18:07:00.753:package.d:__lambda5:140 consumeInput() 2016-02-23T18:07:00.753:package.d:__lambda5:145 getResult() 2016-02-23T18:07:00.753:package.d:__lambda5:145 getResult() 2016-02-23T18:07:00.754:app.d:main:88 found method row: "echo" "SELECT $1::text as echoed" ["value_for_echo"] false 2016-02-23T18:07:00.754:app.d:main:137 Method echo loaded. Content: Method("echo", "SELECT $1::text as echoed", ["value_for_echo"], false) 2016-02-23T18:07:00.754:app.d:main:88 found method row: "echo2" "SELECT $1::text" ["value_for_echo"] NULL 2016-02-23T18:07:00.754:app.d:main:132 Value of column one_row_flag is NULL, skipping reading of method echo2 2016-02-23T18:07:00.754:app.d:main:88 found method row: "wrong_sql_statement" "wrong SQL statement" [] false 2016-02-23T18:07:00.754:app.d:main:137 Method wrong_sql_statement loaded. Content: Method("wrong_sql_statement", "wrong SQL statement", [], false) 2016-02-23T18:07:00.754:app.d:main:141 Number of methods in the table "pgator_rpc": 3, failed to load: 1 2016-02-23T18:07:00.754:app.d:__foreachbody18:148 try to prepare method wrong_sql_statement 2016-02-23T18:07:00.754:package.d:runStatementBlockingManner:126 runStatementBlockingManner 2016-02-23T18:07:00.754:package.d:doQuery:66 get connection from a pool 2016-02-23T18:07:00.754:package.d:doQuery:90 doesQuery() call 2016-02-23T18:07:00.754:package.d:__lambda5:140 consumeInput() 2016-02-23T18:07:00.754:package.d:__lambda5:145 getResult() 2016-02-23T18:07:00.754:package.d:__lambda5:145 getResult() 2016-02-23T18:07:00.755:app.d:__foreachbody18:160 ОШИБКА: ошибка синтаксиса (примерное положение: "wrong") LINE 1: wrong SQL statement ^ , skipping preparing of method wrong_sql_statement 2016-02-23T18:07:00.755:app.d:__foreachbody18:162 catched 2016-02-23T18:07:00.755:app.d:__foreachbody18:165 next Ошибка сегментирования (core dumped) 139 How how to understand why dub dustmite doesn't work for me?
Re: Vibe: I found the problem, but don't know how to fix it
On Thursday, 1 November 2012 at 18:25:22 UTC, Lubos Pintes wrote: Hi, Some time ago I reported on D.Anounce, that Vibe apps are not working on my system, they failed with an exception. So I diagnosed a bit and found the following: There is a folder on my system C:\Users\pintes\AppData\Local\Temp\.rdmd\source which contains some DLLs needed for successful run. But the app.exe generated by rdmd is, in one concrete case in the folder C:\Users\pintes\AppData\Local\Temp\.rdmd\rdmd-app.d-7203ADE98B25A99E6D0DEF46E9812990 After I manually moved the app.exe from the previous folder with crazy name to the source folder, everything worked. Hi! You can report this problem to Vibe community forum (without signup): http://news.rejectedsoftware.com/groups/rejectedsoftware.vibed/
How to add n items to TypeTuple?
For example, adding 3 strings to type tuple t: foreach( i; 0..2 ) alias TypeTuple!( t, string ) t; // this is wrong code and result should be: TypeTuple!( string, string, string );
Re: How to add n items to TypeTuple?
Great! Thanks!
UTF-8 strings and endianness
Hi! How to convert D's string to big endian? How to convert to D's string from big endian?
Re: UTF-8 strings and endianness
On Monday, 29 October 2012 at 15:22:39 UTC, Adam D. Ruppe wrote: UTF-8 isn't affected by endianness. Ok, thanks!
Re: UTF-8 strings and endianness
On Monday, 29 October 2012 at 15:46:43 UTC, Jordi Sayol wrote: Al 29/10/12 16:17, En/na denizzzka ha escrit: Hi! How to convert D's string to big endian? How to convert to D's string from big endian? UTF-8 is always big emdian. Yes. (I thought that the problem in this place but the problem was different.)
Re: UTF-8 strings and endianness
On Monday, 29 October 2012 at 15:46:43 UTC, Jordi Sayol wrote: Al 29/10/12 16:17, En/na denizzzka ha escrit: Hi! How to convert D's string to big endian? How to convert to D's string from big endian? UTF-8 is always big emdian. oops, what? Q: Is the UTF-8 encoding scheme the same irrespective of whether the underlying processor is little endian or big endian? A: Yes. Since UTF-8 is interpreted as a sequence of bytes, there is no endian problem as there is for encoding forms that use 16-bit or 32-bit code units. Where a BOM is used with UTF-8, it is only used as an ecoding signature to distinguish UTF-8 from other encodings — it has nothing to do with byte order.
How to place char* of stringZ to ubyte[]?
immutable ubyte[] valueBin = cast(immutable(ubyte[])) toStringz(s); // s is string type Error: e2ir: cannot cast toStringz(s) of type immutable(char)* to type immutable(ubyte[])
Re: How to place char* of stringZ to ubyte[]?
On Monday, 29 October 2012 at 17:51:56 UTC, bearophile wrote: denizzzka: immutable ubyte[] valueBin = cast(immutable(ubyte[])) toStringz(s); // s is string type Error: e2ir: cannot cast toStringz(s) of type immutable(char)* to type immutable(ubyte[]) One way to do it: import std.stdio; void main() { string s = hello; auto valueBin = cast(immutable ubyte[])s.dup; writeln(valueBin); } But what are you trying to do? I am trying to send to remote host utf8 text with zero byte at end (required by protocol) But sending function accepts only ubyte[]
Re: How to place char* of stringZ to ubyte[]?
On Monday, 29 October 2012 at 18:50:58 UTC, bearophile wrote: denizzzka: I am trying to send to remote host utf8 text with zero byte at end (required by protocol) What if your UTF8 string coming from D already contains several zeros? Incredible situation because it is text-based protocol toStringz(s) returns a pointer, so you can't cast a pointer (that doesn't know the length the buffer it points to) to an array. You have to tell it the length in some way. One way is to slice the pointer, another solution is to append a '\0' and then cast it to an immutable array. Two solutions: import std.stdio, std.string; void main() { string s = hello; auto valueBin1 = cast(immutable ubyte[])(s ~ '\0'); writeln(valueBin1); auto valueBin2 = cast(immutable ubyte[])(s.toStringz()[0 .. s.length + 1]); writeln(valueBin2); } I am concerned about the extra allocations of temp arrays. here is it, or not? compiler optimizes it? In my case it does not matter but for the future I would like to know how it can be implemented without overhead. If you have to do this more than two or three times it's better to write a little function to do it, to avoid bugs. Even better is to define with strong typing the type of such nil-terminated array of bytes, to avoid other mistakes. This used to be possible in D with typedef. Now one a little clumsy way to do it is to use a struct with alias this. This is just a sketch: Yes, already implemented similar. struct BytesBuf { this(string s) { this.data = cast(typeof(data))(s ~ '\0'); } byte[] data = [0]; Why not byte[] data; ? alias this = data; // new syntax What difference between this syntax and alias Something this? } void main() { import std.stdio; string s = hello; auto valueBin3 = BytesBuf(s); writeln(valueBin3); }
How to start new command with arguments, pass data to its stdin read its output?
Something like execv() but with stdin/stdout?
Re: How to start new command with arguments, pass data to its stdin read its output?
On Tuesday, 23 October 2012 at 11:34:35 UTC, denizzzka wrote: Something like execv() but with stdin/stdout? Something like popen(), not execv().
Re: How to start new command with arguments, pass data to its stdin read its output?
On Tuesday, 23 October 2012 at 12:19:08 UTC, Adam D. Ruppe wrote: On Tuesday, 23 October 2012 at 11:34:35 UTC, denizzzka wrote: Something like execv() but with stdin/stdout? If you're on linux i have a little file that might help: http://arsdnet.net/dcode/exec.d int exec( string program, string[] args = null, string input = null, string* output = null, string* error = null, string[] environment = null); Thanks! It is suitable for my case. I think something like this should be in the standard library.
synchronization + nothrow
How I can synchronize changing of array in the functions with nothrow? Handmade spinlock or something better?
What about std.lockfree ?
Anyone interested in std.lockfree - lock-free lists, FIFOs, stacks etc? I spent a few days doing implementations of procs, but has not reached any success. My plan: For many of lock-free algorithms it is need a function MCAS (multiple compare-and-swap) also called CASN (cas for n elements). In fact, it is looks very easy to maintain a doubly-linked lists or a trees or graphs if you can at the same time to change (or not change) all links of one or more of its elements. (But do not forget about ABA problem.) But: 0. MCAS/CASN and RDCSS algorithms at first seem looks like brain damaging mocking puzzles 1. It is forbidden to use unproven algorithms - otherwise there is a risk that the algorithm will falls sometimes and find them will be difficult. This simplifies matters: just copy and paste ready procs from articles! 2 Almost everywhere in these algorithms need a function CAS1 - proposed function core.atomic: casw (http://d.puremagic.com/issues/show_bug.cgi?id=8831#c4) - on casw basis CAS1 can be implemented easily (line 136: https://github.com/denizzzka/casn/blob/75b0377aaa1424f3bd3fa3d47eddf4b5fd4e8038/casn.d) 3. I could not run a well-known algorithm RDCSS: it falls on line 198 (Complete() function): if(isDescriptor(r)) Complete(r); I am understand why it falls - at the time of call Complete(r) pointer r can point to garbage because descriptor can be already removed by another thread. But I do not understand why this algorithm works in other places. RDCSS described in a article A Practical Multi-Word Compare-and-Swap Operation, explanation also can be found here: http://cstheory.stackexchange.com/questions/7083/a-practical-multi-word-compare-and-swap-operation But it does not matter, because RDCSS algorithm has one major flaw - it uses two least significant bits as flags (perhaps the number of flags can be reduced to one) that indicate the type of information transmitted. It is bad dirty hack and, as a result, RDCSS can be used only for the exchange of pointers to aligned data, which is not always acceptable. It is available another procedure called GCAS. (http://lampwww.epfl.ch/~prokopec/ctries-snapshot.pdf) This procedure has semantics similar to that of the RDCSS. But I have not examined closely. I have plan to try it later. This all is a very complex, right? Someone else interested on it? You see here the error in reasoning? Can someone help or has finished implementation of these algorithms? It would be great if std.lockfree will be created, because it will reveal many benefits of D associated with shared variables. As I know Java and C# already have this.
Re: What about std.lockfree ?
(RDCSS is a part of MCAS)
Re: What about std.lockfree ?
falls? I mean fails, of course :-) sorry for my English
Re: D interface for C library problems
On Monday, 15 October 2012 at 11:37:22 UTC, Oleg wrote: I got error: In function `gpgme_error_from_syserror': src/main.d:(.text.gpgme_error_from_syserror+0x5): undefined reference to `gpgme_err_code_from_syserror' --- errorlevel 1 collect2: ld returned 1 exit status Anyone knows how to fix this? Thanks and sorry for my English. I think you missed a library with err codes and functions. You should used -L compiler flag or pragma(lib, nameoflib);
how to create a local copy of shared pointer?
void main() { struct S { int payload; } S* s = new shared (S); // Why this is a illegal? } Error: cannot implicitly convert expression (new shared(S)) of type shared(S)* to S*
Re: how to create a local copy of shared pointer?
On Monday, 15 October 2012 at 15:27:03 UTC, thedeemon wrote: On Monday, 15 October 2012 at 15:15:57 UTC, denizzzka wrote: S* s = new shared (S); // Why this is a illegal? Error: cannot implicitly convert expression (new shared(S)) of type shared(S)* to S* Because shared(S) and S are different types. Either declare s as shared too or use a cast. Why it was made in the language? This can be a safe automatic conversion I think.
Re: how to create a local copy of shared pointer?
Thanks!
Re: Feature request: enum init shouldn't create a new enumeration
On Saturday, 13 October 2012 at 15:39:24 UTC, Tommi wrote: enum MyEnum { init = -123, first = 0, second = 1 } void main() { static assert(MyEnum.min == -123); MyEnum me; final switch (me) { case MyEnum.first: break; case MyEnum.second: break; case MyEnum.init: // I'm forced to specify init case too } } Also, a quick question: Why in case its need to write name of the enum? case first: break; case second: break; case init: // I'm forced to specify init case too looks better for me.
Re: Is there a thread safe single linked list?
On Friday, 12 October 2012 at 23:30:39 UTC, Sean Kelly wrote: I would be grateful if someone share singly linked list based on cas() There's a sample Stack and SList implementation in the concurrency chapter: http://www.informit.com/articles/printerfriendly.aspx?p=1609144 Of course, I read this article. I think that SList is not the same thing as FIFO list - get the first entry in the queue and get queue entry by numerical order are two different things in multithreaded environment, right? I think its necessary to implement primitives like a CASN from article A Pratial Multi-Word Compare-and-Swap Operation (by Timothy L. Harris, Keir Fraser and Ian A. Pratt.) This titanic challenge as I see it, but sooner or later it will have to do. Then we will be able to create various thread safe structures.
Re: Is there a thread safe single linked list?
Not that the titanic but the authors, probably, have used Java and another type of cas result returns.
Re: Is there a thread safe single linked list?
or dynamic array with this methods
Re: Is there a thread safe single linked list?
Thanks for answer! After investigation came to the conclusion that here is needed not synchronized-based solution. I am need compare-and-swap single linked list because it will be used in callback proc from C, and it cannot be throwable, but synchronized contains throwable _d_monitorenter and_d_monitorexit. I would be grateful if someone share singly linked list based on cas()
Re: Is there a thread safe single linked list?
I would be grateful if someone share singly linked list based on cas() Ok, this is a good opportunity to learn how to write such by oneself :-)
Best way to store postgresql's numeric type in D?
It is up to 131072 digits before the decimal point; up to 16383 digits after the decimal point.
Re: immutable method not callable using argument types () - doesn't make sense
On Tuesday, 27 March 2012 at 12:57:18 UTC, bearophile wrote: Steven Schveighoffer: So what the compiler is saying is that you can't call dup with arguments (), you must call it with arguments '() immutable', meaning you must call it on an immutable B, not a mutable B. Any space for compiler error message improvements here? +1, spent two hours with a similar problem
Re: SQL working [ was Re: The sorry state of the D stack? ]
On Monday, 8 October 2012 at 07:35:13 UTC, Paulo Pinto wrote: On Sunday, 7 October 2012 at 20:05:22 UTC, denizzzka wrote: On Sunday, 7 October 2012 at 17:06:31 UTC, Joseph Rushton Wakeling wrote: On 10/07/2012 10:55 AM, Russel Winder wrote: Why only PostgreSQL. Shouldn't it also work with MySQL, Oracle, DB2, PervasiveSQL, SQLite3, etc.? I don't have sufficient experience with SQL to be able to really make a judgement here, but is there a case for a std.sql or std.db that would provide a uniform D interface to the arbitrary DB of choice? Each database engine has a unique distinguishing features that make this engine interesting. (for example, different implementations of transactions - SQL standard does not describe the SQL transactions precisely enough) There are plenty of existing interfaces to base D's design on, just a few of them: Perl - DBI Python - DB API C, C++ - ODBC (there is an UNIX variant of it) C++ - OLE DB (Although Windows specific) Java - JDBC .NET - Data Providers Ruby - DBI TCL - TDBC Go - database package Delphi - Data Access Haskell - HaskellDB (HDBC) So, I do not know is it possible to make a universal interface. And why it may need in real life? At least in the enterprise world, we tend to write applications in a DB independent way. One reason is to be able to deploy the applications without forcing the customers to invest in new DB engines, thus reaching a broader client base. Sometimes inside the same organization different business units have different DB engines running (even different versions of the same DB). Finally, to minimize costs when management decides for whatever reason, to change the DB licenses being used. -- Paulo For this to work you need to implement an independent way to create queries that would work on all database engines the same way. I believe that this problem is in principle much more complicated than it would have been implemented interfaces to databases in separate libs.
Re: SQL working [ was Re: The sorry state of the D stack? ]
On Sunday, 7 October 2012 at 17:06:31 UTC, Joseph Rushton Wakeling wrote: On 10/07/2012 10:55 AM, Russel Winder wrote: Why only PostgreSQL. Shouldn't it also work with MySQL, Oracle, DB2, PervasiveSQL, SQLite3, etc.? I don't have sufficient experience with SQL to be able to really make a judgement here, but is there a case for a std.sql or std.db that would provide a uniform D interface to the arbitrary DB of choice? Each database engine has a unique distinguishing features that make this engine interesting. (for example, different implementations of transactions - SQL standard does not describe the SQL transactions precisely enough) So, I do not know is it possible to make a universal interface. And why it may need in real life?
Re: The sorry state of the D stack?
On Sunday, 7 October 2012 at 08:05:10 UTC, Thomas Koch wrote: denizzzka wrote: https://github.com/denizzzka/dpq2 Thank you very much. I think I haven't seen this project. Would you like to add it to this wiki page? http://www.prowiki.org/wiki4d/wiki.cgi?DatabaseBindings#PostgreSQL I could not register there. :( Who have the opportunity, please add https://github.com/denizzzka/dpq2 to this wiki. Thank you!
Re: version(debug)
On Sunday, 7 October 2012 at 01:20:49 UTC, Jonathan M Davis wrote: On Saturday, October 06, 2012 23:49:23 denizzzka wrote: I am on dmd 2.060 debug {} else {} was not obvious for me - I thought that debug is a kind of qualifer. I wouldn't expect you to try either version(debug) or debug {} without seeing them in the docs or in TDPL. I suppose that I can see why you would try version(debug), but it's not listed in the docs. There isn't really a debug version of anything in D. What debug {} does is it's compiled in when -debug is compiled in, and that can be used in conjunction with -release if you want to. So talking about debug vs release in D is likely to get very confusing. Rather -debug enables debug blocks which are intended for inserting debug code, _not_ code which is meant for non- release builds. It looks like version(assert) (which I guess is only in the github version right now) will effectively correspond to not having -release, but if there's ever a compiler flag which specifically enables or disables assertions instead of -release (which does more than just disable assertions - e.g. it disables bounds checking in non-@safe code), then it won't actually be guaranteed to not be there if -release isn't there. It's close enough though I guess, particularly when the type of stuff that you specifically do in non-release code is typically the kind of stuff that you want done with assertions are enabled and probably wouldn't want enable if assertions were turned off, even if that were to somehow happen without -release. I've got a situation that debug information should be placed into the class via the constructor. Therefore, when used -debug constructor has another arguments list, and its need debug {} else {} for ctor calling. In any case, -debug and debug{} should be explained in the docs somewhere. It's certainly not the sort of thing that I would expect you to magically know. Yes.
Re: The sorry state of the D stack?
On Saturday, 6 October 2012 at 12:06:07 UTC, Thomas Koch wrote: - I looked for a PostgreSQL client library. I found small personal hacks and dead projects. https://github.com/denizzzka/dpq2 This is my personal project but it is not dead, and I am determined to see it through. At the moment, it is quite suitable to be used in simple situations. Compiles without warnings by dmd 2.060, also it can be used with rdmd. I really need users, comments, suggestions, bug reports and commits.
How to create immutable struct?
I am have struct with constructor: immutable struct Cell { ... } And I trying to create instance of this struct: immutable (Cell)* s = new Cell( v, s); compiler returns error: Error: cannot implicitly convert expression (new Cell(v,s)) of type Cell* to immutable(Cell)* How to pass immutable to new?
Re: How to create immutable struct?
I should just create immutable constructor :-)
version(debug)
Why version(assert){ int i = 1; } else { int k = 1; } causes error: Error: identifier or integer expected, not assert ? This is bug or feature? http://dlang.org/version.html says what it is correct code, because assert in the list of Predefined Version Identifiers How I can solve this problem by other way?
Re: version(debug)
huh, text should be from upper letter: Assert, Debug
Re: version(debug)
On Saturday, 6 October 2012 at 19:16:26 UTC, Jonathan M Davis wrote: On Saturday, October 06, 2012 20:42:01 Alex Rønne Petersen wrote: version (assert) is a very recent addition to the compiler and is not in 2.060. Which would probably explain why it's not working for him, since presumably, he's not building the compiler himself, but then it really shouldn't be up on the website yet. - Jonathan M Davis I am on dmd 2.060 debug {} else {} was not obvious for me - I thought that debug is a kind of qualifer.
Re: connect to an SQL Server database
On Saturday, 6 October 2012 at 12:35:05 UTC, Minas wrote: Is there a library that I can use to connect to an SQL Server database? (I need to use it on both linux and windows). I am write one for PostgreSQL right now: https://github.com/denizzzka/dpq2
Re: connect to an SQL Server database
On Saturday, 6 October 2012 at 22:08:48 UTC, denizzzka wrote: On Saturday, 6 October 2012 at 12:35:05 UTC, Minas wrote: Is there a library that I can use to connect to an SQL Server database? (I need to use it on both linux and windows). I am write one for PostgreSQL right now: Ops, it turns SQL Server is a *Microsoft* SQL Server
How to create library with exported functions
Hi! I am make a yet another attempt to create an interface to PostgreSQL from the D: https://github.com/denizzzka/dpq2 I can not understand how do I compile it into a library and create .di headers file. Currently, make debug uses dmd -lib and creates libpq.di file, but its file contains only few strings from main() Plz help!
Re: How to create library with exported functions
(sorry for my English) Hi! I am make a yet another attempt to create an interface to PostgreSQL from the D: https://github.com/denizzzka/dpq2 I can not understand how do a compile it into a library and create .di headers file. Currently, make debug uses dmd -lib and creates libpq.di file, but this file contains only few strings from main() As far as I understand it, in libdpq2.di should be automatically added functions what are available from the library. But they are not.
Re: How to create library with exported functions
I tried to add: export { /* module code except imports*/} but nothing has changed.
Re: How to create library with exported functions
solved! problem was in -Hf compiler switch