Re: Problems compiling sqlite-d

2017-01-28 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 29 January 2017 at 04:13:17 UTC, Nestor wrote: On Sunday, 29 January 2017 at 03:11:34 UTC, Stefan Koch wrote: On Sunday, 29 January 2017 at 02:59:12 UTC, Nestor wrote: On Sunday, 29 January 2017 at 02:55:04 UTC, Adam D. Ruppe wrote: [...] In the case of Windows, where libraries ar

Re: Problems compiling sqlite-d

2017-01-28 Thread Nestor via Digitalmars-d-learn
On Sunday, 29 January 2017 at 03:11:34 UTC, Stefan Koch wrote: On Sunday, 29 January 2017 at 02:59:12 UTC, Nestor wrote: On Sunday, 29 January 2017 at 02:55:04 UTC, Adam D. Ruppe wrote: On Sunday, 29 January 2017 at 00:36:34 UTC, Nestor wrote: Well, native implementations are useful at least fo

Re: Problems compiling sqlite-d

2017-01-28 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 29 January 2017 at 02:59:12 UTC, Nestor wrote: On Sunday, 29 January 2017 at 02:55:04 UTC, Adam D. Ruppe wrote: On Sunday, 29 January 2017 at 00:36:34 UTC, Nestor wrote: Well, native implementations are useful at least for building self-contained applications. Sometimes true, but s

Re: Problems compiling sqlite-d

2017-01-28 Thread Nestor via Digitalmars-d-learn
On Sunday, 29 January 2017 at 02:55:04 UTC, Adam D. Ruppe wrote: On Sunday, 29 January 2017 at 00:36:34 UTC, Nestor wrote: Well, native implementations are useful at least for building self-contained applications. Sometimes true, but sqlite can be easily embedded and statically linked, so you

Re: Problems compiling sqlite-d

2017-01-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 29 January 2017 at 00:36:34 UTC, Nestor wrote: Well, native implementations are useful at least for building self-contained applications. Sometimes true, but sqlite can be easily embedded and statically linked, so your binary is still self-contained, there's just a small compile ti

Re: Problems compiling sqlite-d

2017-01-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 29 January 2017 at 01:02:07 UTC, Ali Çehreli wrote: Agreed but there can be happy surprises. :) Just because it's fresh in my mind: Jon Degenhardt implemented D versions of existing C, Go, and Rust tool kits in D and saw 3 to 10 times performance increase in many cases (not all). Y

Re: Problems compiling sqlite-d

2017-01-28 Thread Nestor via Digitalmars-d-learn
On Sunday, 29 January 2017 at 01:53:30 UTC, Stefan Koch wrote: On Sunday, 29 January 2017 at 01:47:44 UTC, Nestor wrote: On Saturday, 28 January 2017 at 21:09:25 UTC, Stefan Koch wrote: On Saturday, 28 January 2017 at 12:09:35 UTC, Nestor wrote: On Friday, 27 January 2017 at 12:55:55 UTC, Stefa

Re: Problems compiling sqlite-d

2017-01-28 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 29 January 2017 at 01:47:44 UTC, Nestor wrote: On Saturday, 28 January 2017 at 21:09:25 UTC, Stefan Koch wrote: On Saturday, 28 January 2017 at 12:09:35 UTC, Nestor wrote: On Friday, 27 January 2017 at 12:55:55 UTC, Stefan Koch wrote: [...] Thanks. It did compile using dub, though

D and Oracle Pro*C

2017-01-28 Thread KP via Digitalmars-d-learn
Hi, Is anyone using Oracle's Pro*C with D? Thanks, KP

Re: Problems compiling sqlite-d

2017-01-28 Thread Nestor via Digitalmars-d-learn
On Saturday, 28 January 2017 at 21:09:25 UTC, Stefan Koch wrote: On Saturday, 28 January 2017 at 12:09:35 UTC, Nestor wrote: On Friday, 27 January 2017 at 12:55:55 UTC, Stefan Koch wrote: [...] Thanks. It did compile using dub, though I had a couple of issues with dub, by the way. [...]

Re: Problems compiling sqlite-d

2017-01-28 Thread Ali Çehreli via Digitalmars-d-learn
On 01/28/2017 04:14 PM, Adam D. Ruppe wrote: On Saturday, 28 January 2017 at 21:03:08 UTC, Stefan Koch wrote: It's not native though. It's a mistake to ask for native D implementations of mature C libraries, especially a public domain one like sqlite. There's just no advantage in production us

Re: size of a string in bytes

2017-01-28 Thread Nestor via Digitalmars-d-learn
On Saturday, 28 January 2017 at 19:09:01 UTC, ag0aep6g wrote: In D, a `char` is a UTF-8 code unit. Its size is one byte, exactly and always. A `char` is not a "character" in the common meaning of the word. There's a more specialized word for "character" as a visual unit: grapheme. For example

Re: Problems compiling sqlite-d

2017-01-28 Thread Nestor via Digitalmars-d-learn
On Sunday, 29 January 2017 at 00:14:02 UTC, Adam D. Ruppe wrote: On Saturday, 28 January 2017 at 21:03:08 UTC, Stefan Koch wrote: It's not native though. It's a mistake to ask for native D implementations of mature C libraries, especially a public domain one like sqlite. There's just no adva

Re: Problems compiling sqlite-d

2017-01-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 28 January 2017 at 21:03:08 UTC, Stefan Koch wrote: It's not native though. It's a mistake to ask for native D implementations of mature C libraries, especially a public domain one like sqlite. There's just no advantage in production use to rewrite it.

Re: Problems compiling sqlite-d

2017-01-28 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 28 January 2017 at 12:09:35 UTC, Nestor wrote: On Friday, 27 January 2017 at 12:55:55 UTC, Stefan Koch wrote: [...] Thanks. It did compile using dub, though I had a couple of issues with dub, by the way. [...] I think you have to remove the app.d that comes with sqlite-d fil

Re: Problems compiling sqlite-d

2017-01-28 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 28 January 2017 at 19:01:48 UTC, Adam D. Ruppe wrote: On Friday, 27 January 2017 at 12:01:30 UTC, Nestor wrote: Is there any other native D implementation of sqlite reader? My sqlite.d and database.d from here can do it too: https://github.com/adamdruppe/arsd Just download those

Re: Reflection in D

2017-01-28 Thread medhi558 via Digitalmars-d-learn
thank you, the second method works perfectly. I have one last problem, I start thread and in thread Protocol.GetInstance(id) return null while in main thread it works. My class : class ProtocolMessageManager { private static TypeInfo_Class[uint] m_types; shared static this()

Re: Reflection in D

2017-01-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 28 January 2017 at 07:10:27 UTC, medhi558 wrote: I have a last question, currently i use : if(lc.name.indexOf("protocol.messages") != -1) If they're all in the same module, you can also use the compile time reflection to scan the module for classes. That's foreach(memberName; __

Re: size of a string in bytes

2017-01-28 Thread ag0aep6g via Digitalmars-d-learn
On Saturday, 28 January 2017 at 18:04:58 UTC, Nestor wrote: I believe I saw somewhere that in D a char was not neccesarrily the same as an ubyte because chars sometimes take more than one byte, In D, a `char` is a UTF-8 code unit. Its size is one byte, exactly and always. A `char` is not a

Re: Problems compiling sqlite-d

2017-01-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 27 January 2017 at 12:01:30 UTC, Nestor wrote: Is there any other native D implementation of sqlite reader? My sqlite.d and database.d from here can do it too: https://github.com/adamdruppe/arsd Just download those two files and compile them together with your file: dmd yourfile.

Re: size of a string in bytes

2017-01-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 28 January 2017 at 18:04:58 UTC, Nestor wrote: I believe I saw somewhere that in D a char was not neccesarrily the same as an ubyte because chars sometimes take more than Not true in the language, but the Phobos library does treat char and ubyte differently because of the multi-ch

Re: size of a string in bytes

2017-01-28 Thread Nestor via Digitalmars-d-learn
On Saturday, 28 January 2017 at 16:01:38 UTC, Ivan Kazmenko wrote: As said, the byte count is indeed string.length. The number of code points can be found by std.range.walkLength, but be aware it takes O(answer) time to compute. Example: - import std.range, std.stdio; void main () {

Re: size of a string in bytes

2017-01-28 Thread Ivan Kazmenko via Digitalmars-d-learn
On Saturday, 28 January 2017 at 15:32:33 UTC, Nestor wrote: I want to know variable size in memory. For example, say I have an UTF-8 string of only 2 characters, but each of them takes 2 bytes. string length would be 2, but the content of the string would take 4 bytes in memory (excluding overh

Re: size of a string in bytes

2017-01-28 Thread rikki cattermole via Digitalmars-d-learn
On 29/01/2017 4:32 AM, Nestor wrote: On Saturday, 28 January 2017 at 14:56:03 UTC, rikki cattermole wrote: On 29/01/2017 3:51 AM, Nestor wrote: Hi, One can get the length of a string easily, however since strings are UTF-8, sometimes characters take more than one byte. I would like to know the

Re: size of a string in bytes

2017-01-28 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Jan 28, 2017 at 03:32:33PM +, Nestor via Digitalmars-d-learn wrote: [...] > I do not want string lenth or code points. Perhaps I didn't explain > myselft. The .length property of a string is the number of bytes used to store the string. > I want to know variable size in memory. For e

Re: Parsing a UTF-16LE file line by line, BUG?

2017-01-28 Thread Nestor via Digitalmars-d-learn
On Friday, 27 January 2017 at 04:26:31 UTC, Era Scarecrow wrote: Skipping the BOM is just a matter of skipping the first two bytes identifying it... AFAIK in some cases the BOM takes up to 4 bytes (FOR UTF-32), so when input encoding is unknown one must perform some kind of detection in orde

Re: size of a string in bytes

2017-01-28 Thread Nestor via Digitalmars-d-learn
On Saturday, 28 January 2017 at 14:56:03 UTC, rikki cattermole wrote: On 29/01/2017 3:51 AM, Nestor wrote: Hi, One can get the length of a string easily, however since strings are UTF-8, sometimes characters take more than one byte. I would like to know then how many bytes does a string take,

Re: size of a string in bytes

2017-01-28 Thread rikki cattermole via Digitalmars-d-learn
On 29/01/2017 3:51 AM, Nestor wrote: Hi, One can get the length of a string easily, however since strings are UTF-8, sometimes characters take more than one byte. I would like to know then how many bytes does a string take, but this code didn't work as I expected: import std.stdio; void main()

size of a string in bytes

2017-01-28 Thread Nestor via Digitalmars-d-learn
Hi, One can get the length of a string easily, however since strings are UTF-8, sometimes characters take more than one byte. I would like to know then how many bytes does a string take, but this code didn't work as I expected: import std.stdio; void main() { string mystring1; string mys

Re: D package for optimizing/compressing images

2017-01-28 Thread aberba via Digitalmars-d-learn
On Friday, 27 January 2017 at 11:03:15 UTC, aberba wrote: Are there any dub package for compressing images uploaded through web forms? Cropping/resizing may also come in handy. I want one for a vibe.d project. I read Flickr and others use GraphicsMagick but here again heroku doesn't help.

Re: D package for optimizing/compressing images

2017-01-28 Thread aberba via Digitalmars-d-learn
On Friday, 27 January 2017 at 11:03:15 UTC, aberba wrote: Are there any dub package for compressing images uploaded through web forms? Cropping/resizing may also come in handy. I want one for a vibe.d project. Currently, there are RIP and Daffodil dor image related operations. I think suppor

Re: Problems compiling sqlite-d

2017-01-28 Thread Nestor via Digitalmars-d-learn
On Friday, 27 January 2017 at 12:55:55 UTC, Stefan Koch wrote: You have to compile the library with your app. or better yet use dub replace app.d with your app.d and run dub Thanks. It did compile using dub, though I had a couple of issues with dub, by the way. The first occured because I am

Re: D idom for removing array elements

2017-01-28 Thread cym13 via Digitalmars-d-learn
On Saturday, 28 January 2017 at 10:46:29 UTC, albert-j wrote: On Friday, 27 January 2017 at 08:15:56 UTC, Dukc wrote: void main() { import std.stdio, std.algorithm, std.range, std.array, std.datetime; int[] a = [1, 2, 3, 4, 5, 6, 7, 4].cycle.take(2000).array; int[] b = [3, 4, 6].cyc

Re: D idom for removing array elements

2017-01-28 Thread cym13 via Digitalmars-d-learn
On Friday, 27 January 2017 at 11:56:02 UTC, Dukc wrote: On Friday, 27 January 2017 at 10:20:19 UTC, albert-j wrote: I am also wondering why the standard library doesn't have convenience functions for this, e.g. like Java's removeAll? Now there's more typing than necessary for a relatively commo

Re: D idom for removing array elements

2017-01-28 Thread albert-j via Digitalmars-d-learn
On Friday, 27 January 2017 at 08:15:56 UTC, Dukc wrote: void main() { import std.stdio, std.algorithm, std.range, std.array, std.datetime; int[] a = [1, 2, 3, 4, 5, 6, 7, 4].cycle.take(2000).array; int[] b = [3, 4, 6].cycle.take(2000).array; void originalMethod() { auto c

Re: Reflection in D

2017-01-28 Thread medhi558 via Digitalmars-d-learn
On Saturday, 28 January 2017 at 09:05:13 UTC, rumbu wrote: As long as your class has a default constructor, you can use directly Object.factory(id): public static NetworkMessage GetInstance(string id) { return cast(NetworkMessage)(Object.factory(id)); } It isn't possible. My function when I

Re: Reflection in D

2017-01-28 Thread medhi558 via Digitalmars-d-learn
abstract class NetworkMessage { uint MessageId; // } override class QueueStatusUpdateMessage : NetworkMessage { uint MessageId = 1; // } override class Message2 : NetworkMessage { uint MessageId = 2; // } override class Message3 : NetworkMessage { uint Me

Re: Reflection in D

2017-01-28 Thread rumbu via Digitalmars-d-learn
On Saturday, 28 January 2017 at 07:03:51 UTC, medhi558 wrote: public static NetworkMessage GetInstance(string id) { auto v = (id in ProtocolMessageManager.m_types); if (v !is null) return cast(NetworkMessage)ProtocolMessageManager.m_types[id].create(); else

Re: Reflection in D

2017-01-28 Thread rumbu via Digitalmars-d-learn
On Saturday, 28 January 2017 at 08:18:15 UTC, medhi558 wrote: On Saturday, 28 January 2017 at 07:39:51 UTC, rumbu wrote: On Saturday, 28 January 2017 at 07:10:27 UTC, medhi558 wrote: I have a last question, currently i use : if(lc.name.indexOf("protocol.messages") != -1) To know if the class i

Re: Concurrent containers

2017-01-28 Thread Nordlöw via Digitalmars-d-learn
On Saturday, 28 January 2017 at 00:09:45 UTC, Arun Chandrasekaran wrote: Does phobos offer concurrent containers? I couldn't find one at http://dlang.org/phobos/std_container.html Any other in the D land? You can always search here http://code.dlang.org/

Re: Reflection in D

2017-01-28 Thread medhi558 via Digitalmars-d-learn
On Saturday, 28 January 2017 at 07:39:51 UTC, rumbu wrote: On Saturday, 28 January 2017 at 07:10:27 UTC, medhi558 wrote: I have a last question, currently i use : if(lc.name.indexOf("protocol.messages") != -1) To know if the class is a NetworkMessage, Would be possible to do this if(lc is Ne