Re: Class, constructor and inherance.

2015-10-12 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/10/15 5:56 AM, holo wrote: @Rikki: If you didn't need to make it easily changeable I would say not even bother with OOP at all. Basically that what i had was enough for me and on top of that i could build my app. It need to just periodically check for new instances and if they are

Re: Ternary if and ~ does not work quite well

2015-10-11 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/10/15 6:19 PM, Andre wrote: Hi, I am not sure, whether the output of following coding is correct: import std.stdio; void main() { writeln("foo "~ true ? "bar" : "baz"); writeln("foo "~ false ? "bar" : "baz"); // assert("foo "~ true ? "bar" : "baz" == "foo bar"); does not

Re: Class, constructor and inherance.

2015-10-11 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/10/15 4:13 PM, holo wrote: By the looks, I'm guessing you do not have much experience when it comes to OOP. I think you are wanting something a bit closer to: import std.typecons : tuple, TypeTuple; interface Credential { string encode(); } class SigV4 : Credential {

Re: Class, constructor and inherance.

2015-10-11 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/10/15 3:14 PM, holo wrote: Hello I'm trying to write my first class. I want to use it as module and build anothers on top of it. I read that default functions attributes are not inherited. Is it that same for constructor? This is how my class (not finished) is looking right now: class

Re: AWS API Dlang, hmac sha256 function.

2015-10-06 Thread Rikki Cattermole via Digitalmars-d-learn
On 07/10/15 3:18 PM, holo wrote: Congrats on getting it working! @Rikki Thanks :) I was trying to write my own lib from beginning based on examples but after some time i resign from that idea (will back to it when i will have some more experience) and right now im trying to customize that one

Re: AWS API Dlang, hmac sha256 function.

2015-10-05 Thread Rikki Cattermole via Digitalmars-d-learn
On 06/10/15 11:26 AM, holo wrote: On Monday, 5 October 2015 at 21:00:38 UTC, Vladimir Panteleev wrote: On Monday, 5 October 2015 at 19:43:39 UTC, holo wrote: @Vladimir where can i check or do you know when next version of phobos will be available? You can use Digger to get the latest version

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 04/10/15 1:09 AM, holo wrote: On Saturday, 3 October 2015 at 05:02:58 UTC, Rikki Cattermole wrote: On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 04/10/15 1:49 AM, holo wrote: On Saturday, 3 October 2015 at 12:22:11 UTC, Rikki Cattermole wrote: On 04/10/15 1:09 AM, holo wrote: On Saturday, 3 October 2015 at 05:02:58 UTC, Rikki Cattermole wrote: On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: [...]

Re: How will std.allocator change how we program in D?

2015-10-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 03/10/15 12:54 PM, Taylor Hillegeist wrote: I do not come from a c++ background. but have looked at what allocators do for c++. I know in D the standard for memory management is garbage collection and if we want to manage it ourselfs we have to do things like @nogc. I was just curious how the

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 04/10/15 2:31 AM, holo wrote: On Saturday, 3 October 2015 at 12:50:58 UTC, Rikki Cattermole wrote: On 04/10/15 1:49 AM, holo wrote: On Saturday, 3 October 2015 at 12:22:11 UTC, Rikki Cattermole wrote: On 04/10/15 1:09 AM, holo wrote: [...] By the looks of things the problem is with

Re: AWS API Dlang, hmac sha256 function.

2015-10-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks pretty easy). Or go the route of Botan:

Re: AWS API Dlang, hmac sha256 function.

2015-10-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 03/10/15 4:54 PM, holo wrote: On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks pretty easy). Or go the route of Botan: https://github.com/etcimon/botan/blob/3bdc835d5b9bad7523deaa86fe98b1fbb2f09d6b/source/botan/mac/hmac.d

Re: AWS API Dlang, hmac sha256 function.

2015-10-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 03/10/15 4:11 PM, holo wrote: Hello I'm trying to contact AWS API with D according to documentation: http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html there is written example in python which i want to rewrite to D:

Re: How to do unittests

2015-09-30 Thread Rikki Cattermole via Digitalmars-d-learn
On 01/10/15 1:59 AM, Namal wrote: Hello, can someone give me a complete example please how to do unittests? I tried this with the example from german wikipedia, but the flag -unittest didn't make any difference. Example file with loads of unittests:

Re: Mac IDE with Intellisense

2015-09-26 Thread Rikki Cattermole via Digitalmars-d-learn
On 26/09/15 9:17 PM, Mike McKee wrote: I've tried Sublime Text 3 editor on the Mac, but even it doesn't seem to have the D2 language in it yet (only D), and doesn't have intellisense for components in the imports that I do, even after saving the file after adding the import statements. What OSX

Re: ORM libraries for D

2015-09-25 Thread Rikki Cattermole via Digitalmars-d-learn
On 26/09/15 3:03 AM, John Colvin wrote: On Thursday, 24 September 2015 at 13:33:51 UTC, Rikki Cattermole wrote: On 25/09/15 1:30 AM, Edwin van Leeuwen wrote: On Thursday, 24 September 2015 at 13:24:14 UTC, Rikki Cattermole wrote: Dvorm is more or less feature complete :) I am the author of

Re: Dub package with C code

2015-09-24 Thread Rikki Cattermole via Digitalmars-d-learn
On 24/09/15 5:51 PM, Sebastiaan Koppe wrote: On Thursday, 24 September 2015 at 04:17:14 UTC, Rikki Cattermole wrote: Is libxlsxwriter available in the systems package manager? Pacman says no. Let e.g. Windows users figure theirs out. libxlsxwriter is not supported on windows. Which is

Re: ORM libraries for D

2015-09-24 Thread Rikki Cattermole via Digitalmars-d-learn
On 25/09/15 1:18 AM, David Nadlinger wrote: Hi all, I'm having a look at ORM libraries in D right now. So far, I've come across hibernated and dvorm. Are there any other libraries that I should have a look at, particularly actively maintained ones? dvorm and hibernated seem to have received no

Re: ORM libraries for D

2015-09-24 Thread Rikki Cattermole via Digitalmars-d-learn
On 25/09/15 1:30 AM, Edwin van Leeuwen wrote: On Thursday, 24 September 2015 at 13:24:14 UTC, Rikki Cattermole wrote: Dvorm is more or less feature complete :) I am the author of it, but unless issues come up I do not intend to continue working upon it. You could consider bumping it up to

Re: ORM libraries for D

2015-09-24 Thread Rikki Cattermole via Digitalmars-d-learn
On 25/09/15 1:43 AM, David Nadlinger wrote: On Thursday, 24 September 2015 at 13:24:14 UTC, Rikki Cattermole wrote: Dvorm is more or less feature complete :) I am the author of it, but unless issues come up I do not intend to continue working upon it. Do you know whether somebody has written

Re: How to setup mono-D for shared libraries?

2015-09-24 Thread Rikki Cattermole via Digitalmars-d-learn
On 25/09/15 9:58 AM, Jacob wrote: On Wednesday, 23 September 2015 at 04:34:45 UTC, Rikki Cattermole wrote: On 23/09/15 8:20 AM, Jacob wrote: How do I setup mono-D for creating shared libraries and including them into other projects? When I drag the .d files to create the library from, which is

Re: Dub package with C code

2015-09-23 Thread Rikki Cattermole via Digitalmars-d-learn
On 24/09/15 2:43 PM, Sebastiaan Koppe wrote: I have just created bindings for libxlsxwriter, an c library for creating excel files. Used the htod tool to do most of the work, and only had to adjust some things - mainly because libxlsxwriter uses data structures written in macro's. Right now I

Re: How to setup mono-D for shared libraries?

2015-09-22 Thread Rikki Cattermole via Digitalmars-d-learn
On 23/09/15 8:20 AM, Jacob wrote: How do I setup mono-D for creating shared libraries and including them into other projects? When I drag the .d files to create the library from, which is not my own, I get undefined references. I have the lib files, which are a bunch of separate libs, that I

Re: Defining compile-time constants?

2015-09-17 Thread Rikki Cattermole via Digitalmars-d-learn
On 18/09/15 3:32 AM, Tim K. wrote: Hi! I am wondering if there is any way to define constants to pass to the compiler like in C (especially useful in combination with Makefiles, for obvious reasons), i.e.: gcc -DPREFIX=\"/usr/local\" -o myprogram main.c Like this a program can look for

Re: "if sting in string"

2015-09-16 Thread Rikki Cattermole via Digitalmars-d-learn
On 17/09/15 12:55 AM, smadus wrote: Hello Searching after hours, i give up and here is the question. ;) I will make a programm, this searching all txt files on the system or the path from user and searching a user tiped term in this file. http://dpaste.dzfl.pl/dec09a0f849c The Problem is in

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Rikki Cattermole via Digitalmars-d-learn
On 15/09/15 9:00 PM, Kagamin wrote: On Tuesday, 15 September 2015 at 08:51:02 UTC, Fredrik Boulund wrote: Using char[] all around might be a good idea, but it doesn't seem like the string conversions are really that taxing. What are the arguments for working on char[] arrays rather than

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Rikki Cattermole via Digitalmars-d-learn
On 15/09/15 12:30 AM, Fredrik Boulund wrote: Hi, This is my first post on Dlang forums and I don't have a lot of experience with D (yet). I mainly code bioinformatics-stuff in Python on my day-to-day job, but I've been toying with D for a couple of years now. I had this idea that it'd be fun to

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Rikki Cattermole via Digitalmars-d-learn
On 15/09/15 5:41 AM, NX wrote: On Monday, 14 September 2015 at 16:33:23 UTC, Rikki Cattermole wrote: A lot of this hasn't been covered I believe. http://dpaste.dzfl.pl/f7ab2915c3e1 I believe that should be: foreach (query, ref value; hitlists) Since an assignment happenin there..?

Re: Win32 function vs delegate issues with api

2015-09-08 Thread Rikki Cattermole via Digitalmars-d-learn
On 09/09/15 12:18 PM, Prudence wrote: I have hook = SetWindowsHookEx(WH_MOUSE, , NULL, ThreadID); Proc is the standard hook proc: public extern (Windows) LRESULT Proc(int code, WPARAM wParam, LPARAM lParam) I get a type mismatch because Proc is a delegate and SetWindowsHookEx expects a

Re: Windows Resources

2015-09-05 Thread Rikki Cattermole via Digitalmars-d-learn
This may interest you: https://github.com/Devisualization/window/blob/master/platforms/win32/devisualization/window/window.d

Re: cURL alternative for enable javascript

2015-09-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 04/09/15 2:09 AM, xky wrote: hello! :) Well.. yes. cURL couldn't enable javascript. How can i use other library alternative cURL for D ? regards, Curl is meant to transfer data and in this case, download files over http. It is not meant to render them via JavaScript. If you are wanting

Re: array function

2015-08-31 Thread Rikki Cattermole via Digitalmars-d-learn
On 31/08/15 11:24 PM, Namal wrote: Hello, can someone explain to me please what I am doing wrong by passing an integer to this function and then just creating a static array? The error I get is: Error: variable N cannot be read at compile time int[] foo(int N){ int[N] v; //do

Re: How to use Registry Windows ?

2015-08-29 Thread Rikki Cattermole via Digitalmars-d-learn
On 29/08/15 9:14 PM, medhi558 wrote: Hello, I can't seem to use Registry, I tried to many attraction ways but I have every time an error Value cannot be set. Exemple code : module main; import std.stdio; import std.windows.registry; void main(string[] args) { version(Windows) {

Re: Reading and converting binary file 2 bits at a time

2015-08-27 Thread Rikki Cattermole via Digitalmars-d-learn
On 27/08/15 9:00 PM, Andrew Brown wrote: Hi, I need to read a binary file, and then process it two bits at a time. But I'm a little stuck on the first step. So far I have: import std.file; import std.stdio; void main(){ auto f = std.file.read(binaryfile); auto g = cast(bool[])f;

Re: __traits(allMembers) and aliases

2015-08-25 Thread Rikki Cattermole via Digitalmars-d-learn
On 26/08/15 12:06 AM, Mike Parker wrote: Is there a way to determine whether a given symbol is an alias? Consider this: ``` module funcs; alias FuncPtr = void function(); @ChooseMe FuncPtr funcPtr; alias anotherName = funcPtr; ``` Handing this module off to __traits(allMembers), then checking

Re: (De)Serializing interfaces

2015-08-23 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/23/2015 10:17 PM, nims wrote: On Sunday, 23 August 2015 at 08:38:14 UTC, Rikki Cattermole wrote: What I was thinking was having a serialize method take an output range which you will just pass in a value. I'm not really sure what you mean. Replacing the operator by a range function or

Re: How to use ranges?

2015-08-23 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/23/2015 10:17 PM, Doolan wrote: I keep running into areas of my code where it looks like I'd benefit from using ranges, and then I try to do some range stuff and my compiler tells me I'm using the wrong types, or there's this problem, or that problem... so I'm scared off and I just figure

Re: (De)Serializing interfaces

2015-08-23 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/23/2015 8:15 PM, nims wrote: On Sunday, 23 August 2015 at 03:09:03 UTC, Rikki Cattermole wrote: Anyway to summise why D doesn't yet have something akin to Java or C#. Simply put, we generally work with the actual type not an interface. So libraries like Orange can serialize/deserialize

Re: (De)Serializing interfaces

2015-08-23 Thread Rikki Cattermole via Digitalmars-d-learn
On Sunday, 23 August 2015 at 10:37:11 UTC, Rikki Cattermole wrote: On 8/23/2015 10:17 PM, nims wrote: On Sunday, 23 August 2015 at 08:38:14 UTC, Rikki Cattermole wrote: What I was thinking was having a serialize method take an output range which you will just pass in a value. I'm not really

Re: How to use ranges?

2015-08-23 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/24/2015 12:52 AM, Doolan wrote: On Sunday, 23 August 2015 at 10:38:53 UTC, Rikki Cattermole wrote: On 8/23/2015 10:17 PM, Doolan wrote: Have a read of: https://github.com/rikkimax/twp-d/blob/master/manuscript/content/idioms/ranges.md Let me know what you think :) I think I'm a little

Re: post on using go 1.5 and GC latency

2015-08-22 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/22/2015 10:47 PM, Laeeth Isharc wrote: On Saturday, 22 August 2015 at 09:16:32 UTC, Russel Winder wrote: On Sat, 2015-08-22 at 07:30 +, rsw0x via Digitalmars-d-learn wrote: […] because Go is not a general purpose language. Not entirely true. Go is a general purpose language, it is

Re: (De)Serializing interfaces

2015-08-22 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/23/2015 7:14 AM, nims wrote: I think interfaces are very powerful and I heavily use them. The only problem I have with them is that serializing/deserializing them to XML or JSON doesn't seem to work. So far I got to try Orange and painlessjson. Using Orange all I got was a lot of compiler

Re: New to D - playing with Thread and false Sharing

2015-08-20 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/21/2015 3:37 AM, Dejan Lekic wrote: Keep in mind that in D everything is thread-local by default! :) For shared resources use __gshared or shared (although I do not know for sure whether shared works or not). Note: shared is __gshared but with mutex's added.

Re: unusual bare metal target: Amazon Dash

2015-08-18 Thread Rikki Cattermole via Digitalmars-d-learn
On 19/08/2015 3:24 a.m., Laeeth Isharc wrote: On Tuesday, 18 August 2015 at 04:36:49 UTC, Rikki Cattermole wrote: On 18/08/2015 1:32 p.m., Laeeth Isharc wrote: I don't know whether D can run on one, but from a quick look perhaps feasible. Running D on something like this (perhaps it's

Re: unusual bare metal target: Amazon Dash

2015-08-17 Thread Rikki Cattermole via Digitalmars-d-learn
On 18/08/2015 1:32 p.m., Laeeth Isharc wrote: I don't know whether D can run on one, but from a quick look perhaps feasible. Running D on something like this (perhaps it's underpowered, but looked to have similar spec to what people had been doing with related ARM cortex processors) would

Re: Real OOP with D

2015-08-17 Thread Rikki Cattermole via Digitalmars-d-learn
On 17/08/2015 5:57 p.m., Ozan wrote: Hi Working with objectoriented concepts results often in large trees of related classes. Every instance of a class knows his methods and data. An example like following would work: import std.stdio; class Family { } class Dad : Family { void greeting() {

Re: Code Reviewer

2015-08-13 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/08/2015 10:50 a.m., Clayton wrote: Hello everyone, Am looking for someone who could help review my code . As an entry exercise to D am converting 3 C implementations of popular pattern matching algorithms. The idea is to have 6 final implementations ( 3 compile-time and 3 runtime) . I

Re: Structs and compiletime evaluation

2015-08-13 Thread Rikki Cattermole via Digitalmars-d-learn
On Thursday, 13 August 2015 at 12:07:48 UTC, D_Learner wrote: I am having this struct :- struct COMPILETIME_BM_PRE { void initialisebmBc(S,C,I,int k)( const S pattern ,ref I[C] bmBc){ static if ( k ASIZE ){ bmBc[ALPHABET[k]] = size;

Re: Structs and compiletime evaluation

2015-08-13 Thread Rikki Cattermole via Digitalmars-d-learn
On 14/08/2015 12:48 a.m., D_Learner wrote: On Thursday, 13 August 2015 at 12:21:44 UTC, Rikki Cattermole wrote: On Thursday, 13 August 2015 at 12:07:48 UTC, D_Learner wrote: I am having this struct :- struct COMPILETIME_BM_PRE { void initialisebmBc(S,C,I,int k)( const S

Re: Code Reviewer

2015-08-12 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/08/2015 12:09 a.m., Clayton wrote: On Wednesday, 12 August 2015 at 02:49:59 UTC, Rikki Cattermole wrote: On 12/08/2015 10:50 a.m., Clayton wrote: Hello everyone, Am looking for someone who could help review my code . As an entry exercise to D am converting 3 C implementations of

Re: dmd.conf... again

2015-08-12 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/08/2015 12:16 a.m., Atila Neves wrote: I'm trying to use dmd on a VM where I don't have root privileges (don't ask). I can't copy dmd.conf to /etc. According to the docs, I should be able to use a dmd.conf that's in the same dir as dmd itself, or in my home directory, or even specifying

Re: Code Reviewer

2015-08-11 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/08/2015 10:50 a.m., Clayton wrote: Hello everyone, Am looking for someone who could help review my code . As an entry exercise to D am converting 3 C implementations of popular pattern matching algorithms. The idea is to have 6 final implementations ( 3 compile-time and 3 runtime) . I

Re: Removing elements from dynamic array

2015-08-09 Thread Rikki Cattermole via Digitalmars-d-learn
On 10/08/2015 2:24 a.m., Reflexive wrote: On Sunday, 9 August 2015 at 13:40:51 UTC, cym13 wrote: On Sunday, 9 August 2015 at 13:22:02 UTC, Reflexive wrote: You can use std.algorithm.remove for that. If you need more advanced ways to remove elements, you may want to switch from a regular

Re: Measuring test coverage

2015-08-09 Thread Rikki Cattermole via Digitalmars-d-learn
On 10/08/2015 8:24 a.m., Alexei Bykov wrote: D has builtin support for coverage analysis but it produces only .lst files. This is a bit inconvenient. Is there any tool which can create something like an html report from .lst files? For now I'm using OpenCppCoverage which is not the best tool and

Re: Array start index

2015-08-01 Thread Rikki Cattermole via Digitalmars-d-learn
On 1/08/2015 9:35 p.m., DLearner wrote: Does the D language set in stone that the first element of an array _has_ to be index zero? Wouldn't starting array elements at one avoid the common 'off-by-one' logic error, it does seem more natural to begin a count at 1. Actually, maybe even better to

Re: Changes on dynamic shared library writing

2015-07-29 Thread Rikki Cattermole via Digitalmars-d-learn
On 30/07/2015 8:27 a.m., tcak wrote: On Wednesday, 29 July 2015 at 19:41:14 UTC, tcak wrote: After a long time (Failed many times before), I checked the page http://dlang.org/dll-linux.html again. It shows a message on top saying that preliminary and subject to change. Exactly what changes are

Re: How disruptive is the GC?

2015-07-29 Thread Rikki Cattermole via Digitalmars-d-learn
On 29/07/2015 9:25 p.m., Snape wrote: I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of people have said lots of things about it, but some of that information is old, so

Re: Why does this script BSOD-ize windows ?

2015-07-21 Thread Rikki Cattermole via Digitalmars-d-learn
On 21/07/2015 10:14 p.m., Baz wrote: --- import std.process; import core.thread; import std.random; void main(string[] args) { string on = netsh interface set interface \Connexion au réseau local\ Enable; string off = netsh interface set interface \Connexion au réseau local\ Disable;

Re: C bindings: typedef struct conflicts with method

2015-07-21 Thread Rikki Cattermole via Digitalmars-d-learn
On 21/07/2015 5:53 p.m., yawniek wrote: i tried to automagically create bindings for librdkafka (https://github.com/edenhill/librdkafka) with dstep. now the code contains typedefs structs with the same name as methods: ``` typedef struct rd_kafka_metadata { int broker_cnt;

Re: Why does this script BSOD-ize windows ?

2015-07-21 Thread Rikki Cattermole via Digitalmars-d-learn
On 21/07/2015 10:36 p.m., Baz wrote: On Tuesday, 21 July 2015 at 10:28:27 UTC, Rikki Cattermole wrote: On 21/07/2015 10:14 p.m., Baz wrote: --- import std.process; import core.thread; import std.random; void main(string[] args) { string on = netsh interface set interface \Connexion au

Re: GLU in DerelictOrg

2015-07-21 Thread Rikki Cattermole via Digitalmars-d-learn
On 21/07/2015 11:08 p.m., Spacen Jasset wrote: Hello, Can anyone tell me if the GLU functions, gluSpehere etc are availble in DerelictOrg or have they been removed. I can replace these with my own versions, but was hoping to do a quick port to DerelictOrg

Re: static-if cant compile

2015-07-19 Thread Rikki Cattermole via Digitalmars-d-learn
On 20/07/2015 12:17 a.m., Clayton wrote: Pardon me for trivial question, Am new to D. Why would a statement as below fail to compile. The plan is to do some computation at compile-time hence considering the static-if statement which fails to compile. The regular if-statement compiles but is

Re: How to abort compilation

2015-07-13 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/07/2015 6:36 p.m., tcak wrote: To keep the story short (if necessary, I can explain the use-case), if there any way to abort compilation with a message. I would use static if or version to check a situation, and pragma msg to show a message. But I couldn't have found any proper way to

Re: socket server help

2015-07-11 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/07/2015 2:53 p.m., Adwelean wrote: Hello, I have a project of updater for a game with few functions for administrate the game and for this i need a server to communicate with my client side (written in C#). I started to create the server but i have a problem with the async part, i tried

Re: socket server help

2015-07-11 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/07/2015 5:13 p.m., ketmar wrote: On Sun, 12 Jul 2015 15:44:44 +1200, Rikki Cattermole wrote: Perhaps try vibe.d? It does support what you want, automatically. most of the time vibe.d seems to be overkill. that's like building a space ship to visit Aunt Ellie, who lives in a town

Re: DUB Build Linker Library Search Path

2015-07-10 Thread Rikki Cattermole via Digitalmars-d-learn
On 10/07/2015 9:34 p.m., Nordlöw wrote: On Friday, 10 July 2015 at 09:29:49 UTC, Martin Nowak wrote: On Friday, 10 July 2015 at 09:27:19 UTC, Nordlöw wrote: How do I tell `dub build` where to find libraries in non-standard directories? You're missing the development package libclang-dev,

Re: DUB Build Linker Library Search Path

2015-07-10 Thread Rikki Cattermole via Digitalmars-d-learn
On 10/07/2015 11:02 p.m., Nordlöw wrote: On Friday, 10 July 2015 at 09:37:42 UTC, Rikki Cattermole wrote: On 10/07/2015 9:34 p.m., Nordlöw wrote: On Friday, 10 July 2015 at 09:29:49 UTC, Martin Nowak wrote: On Friday, 10 July 2015 at 09:27:19 UTC, Nordlöw wrote: How do I tell `dub build`

Re: Wrapping a C-style Array (Pointer + Length) in a Range Interface

2015-07-07 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/07/2015 12:26 a.m., Per =?UTF-8?B?Tm9yZGzDtnci?= per.nord...@gmail.com wrote: I'm currently developing a high-level wrapper for FFMPEG at https://github.com/nordlow/justd/blob/master/tests/t_ffmpeg.d My question now becomes how to most easily wrap the iteration over streams at

Re: Wrapping a C-style Array (Pointer + Length) in a Range Interface

2015-07-07 Thread Rikki Cattermole via Digitalmars-d-learn
On Tuesday, 7 July 2015 at 12:33:23 UTC, Per Nordlöw wrote: On Tuesday, 7 July 2015 at 12:29:04 UTC, Rikki Cattermole wrote: size_t count; AVStream* thePtr; AVStream[] array = thePtr[0 .. count]; That should work. Thanks. Will that reuse the existing allocate memory at `thePtr` for

Re: documenting compile-time constants

2015-07-06 Thread Rikki Cattermole via Digitalmars-d-learn
On 7/07/2015 1:05 p.m., Vlad Levenfeld wrote: How do I ddoc an enum constant? Putting ddoc comments above functions and structs woorks fine but ddocing an enum constant doesn't generate any documentation. If: /// enum MyValue = 8.2f; does not generate documentation upon its creation, please

Re: code review based on what I learned from D

2015-07-05 Thread Rikki Cattermole via Digitalmars-d-learn
On 5/07/2015 6:53 p.m., Szabo Bogdan wrote: Hi, Recently while I was reviewing some swift code, a colleague left me the impression that I am the one with the bad habits and these were learned while coding in D. I still think that I proposed some changes to avoid some bugs but I was told that I

Re: code review based on what I learned from D

2015-07-05 Thread Rikki Cattermole via Digitalmars-d-learn
On 5/07/2015 9:37 p.m., ketmar wrote: On Sun, 05 Jul 2015 19:01:59 +1200, Rikki Cattermole wrote: Failing gracefully. Not something most developers do. usually that is not related. i mean that if program entered invalid state, it may be too late to save user data. it may be even undesirable

Re: code review based on what I learned from D

2015-07-05 Thread Rikki Cattermole via Digitalmars-d-learn
On 5/07/2015 9:32 p.m., ketmar wrote: On Sun, 05 Jul 2015 06:53:34 +, Szabo Bogdan wrote: For both of these issues I was told that swift is not Java and if the situations that I described happens, you don't want to crash the user app, because this will make the user unhappy. i completely

Re: Best way to count character spaces.

2015-06-30 Thread Rikki Cattermole via Digitalmars-d-learn
On 1/07/2015 6:33 a.m., Taylor Hillegeist wrote: So I am aware that Unicode is not simple... I have been working on a boxes like project http://boxes.thomasjensen.com/ it basically puts a pretty border around stdin characters. like so: /\ \

Re: Autocorrelation function with ranges

2015-06-27 Thread Rikki Cattermole via Digitalmars-d-learn
On 27/06/2015 10:29 p.m., kerdemdemir wrote: Hi My question is more about Maths than D lang, I am hoping, maybe somebody worked with AutoCorrelation function before. auto autoCorrelation(R)(R range) if (isRandomAccessRange!R) { auto residual = residualPowerOf2(range.length); //

Re: Calling DLL coded in D from Java

2015-06-16 Thread Rikki Cattermole via Digitalmars-d-learn
On 17/06/2015 2:18 p.m., bitwise wrote: On Tue, 16 Jun 2015 18:47:03 -0400, DlangLearner bystan...@gmail.com wrote: I'd like to know if it is possible to call an DLL coded in D from Java? What you're looking for is JNI (Java Native Interface). If you export your D functions correctly, as

Re: Adding Lua libraries to LuaD?

2015-06-16 Thread Rikki Cattermole via Digitalmars-d-learn
On 17/06/2015 7:49 a.m., lzed wrote: Did somebody managed to do this or something similar? Like this? https://github.com/rikkimax/skeleton/blob/master/source/skeleton/syntax/luasyn.d

Re: What is D's minimum requirements on Mac?

2015-06-13 Thread Rikki Cattermole via Digitalmars-d-learn
On 14/06/2015 12:32 p.m., Adam D. Ruppe wrote: On Friday, 12 June 2015 at 07:17:44 UTC, Jacob Carlborg wrote: I'm running a OS X 10.7 on Macbook from 2006, it's working perfectly fine. Although the whole computer it's quite slow, it only has 2 GB of RAM. Thanks everyone. A coworker says he

Re: AMD Windows 7

2015-06-12 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/06/2015 10:54 p.m., Chris wrote: Has anyone run into problems with D on AMD processors? I'm talking about Windows 7 on a HP625 laptop in particular. Have you checked the issue tracker?

Re: Windows Universal/Store apps support

2015-05-29 Thread Rikki Cattermole via Digitalmars-d-learn
On 29/05/2015 7:03 p.m., Paulo Pinto wrote: On Friday, 29 May 2015 at 03:23:39 UTC, Rikki Cattermole wrote: On 29/05/2015 3:57 a.m., Olivier Prince wrote: I searched the forum to find if there is some support for new Windows development technologies and I didn't find anything related (except

Re: Windows Universal/Store apps support

2015-05-29 Thread Rikki Cattermole via Digitalmars-d-learn
On 29/05/2015 9:55 p.m., Paulo Pinto wrote: On Friday, 29 May 2015 at 07:41:14 UTC, Rikki Cattermole wrote: On 29/05/2015 7:03 p.m., Paulo Pinto wrote: On Friday, 29 May 2015 at 03:23:39 UTC, Rikki Cattermole wrote: On 29/05/2015 3:57 a.m., Olivier Prince wrote: I searched the forum to find

Re: Windows Universal/Store apps support

2015-05-28 Thread Rikki Cattermole via Digitalmars-d-learn
On 29/05/2015 3:57 a.m., Olivier Prince wrote: I searched the forum to find if there is some support for new Windows development technologies and I didn't find anything related (except some rants about WinRT 3 years ago). - Is there any support in D or phobos for developping this kind of

Re: Necessity of D Library (and/or Core Library)

2015-05-23 Thread Rikki Cattermole via Digitalmars-d-learn
On 23/05/2015 6:35 p.m., Anthony Monterrosa wrote: Does D require the standard library to function? Or to be more direct, does D as a language need its library, or core library, to function correctly? I have become very interested in how programming languages do their magic; how they

Re: What happens when you launch a D application ?

2015-05-23 Thread Rikki Cattermole via Digitalmars-d-learn
On 23/05/2015 10:57 p.m., Suliman wrote: Every D program is started as if it were a C program. Why is so necessary? What about C++ and other languages? Does they have more then one main? Depends on the implementation. I believe Visual C++ does. But it is used like D's to allow it to

Re: better code organization?

2015-05-17 Thread Rikki Cattermole via Digitalmars-d-learn
On 17/05/2015 9:26 p.m., Suliman wrote: I am writing in D server and client apps. Server is base on vibed. Server and client have some common code (example working with config class). How I can prevent code duplication? I can move config code to separate module, but how to link on it? server

Re: problem with parallel foreach

2015-05-13 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/05/2015 2:59 a.m., Gerald Jansen wrote: I am a data analyst trying to learn enough D to decide whether to use D for a new project rather than Python + Fortran. I have recoded a non-trivial Python program to do some simple parallel data processing (using the map function in Python's

Re: problem with parallel foreach

2015-05-12 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/05/2015 4:20 a.m., Gerald Jansen wrote: At the risk of great embarassment ... here's my program: http://dekoppel.eu/tmp/pedupg.d As per Rick's first suggestion (thanks) I added import core.memory : GC; main() GC.disable; GC.reserve(1024 * 1024 * 1024); ... to no avail. thanks

Re: problem with parallel foreach

2015-05-12 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/05/2015 2:59 a.m., Gerald Jansen wrote: I am a data analyst trying to learn enough D to decide whether to use D for a new project rather than Python + Fortran. I have recoded a non-trivial Python program to do some simple parallel data processing (using the map function in Python's

Re: Spawning a console in Windows (similar to forkpty on linux)

2015-05-09 Thread Rikki Cattermole via Digitalmars-d-learn
On 10/05/2015 12:13 a.m., wobbles wrote: This isn't specifically a D question, but seeing as it's for a D library I figure it can go here :) On Windows, I want to be able to spawn a console and then interact with its stdin/out asynchronously, similar to how forkpty [1] works on linux. I'm

Re: vibed: how to use pure HTML instead of template engine?

2015-05-08 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/05/2015 10:17 p.m., Chris wrote: On Thursday, 7 May 2015 at 19:51:20 UTC, yawniek wrote: On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote: 1. Do I need write ./public/ ? In examples often simply public/ will work too. even public it goes trough Path struct, see:

Re: vibed: how to use pure HTML instead of template engine?

2015-05-08 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/05/2015 10:49 p.m., Chris wrote: On Friday, 8 May 2015 at 10:20:35 UTC, Rikki Cattermole wrote: On 8/05/2015 10:17 p.m., Chris wrote: On Thursday, 7 May 2015 at 19:51:20 UTC, yawniek wrote: On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote: 1. Do I need write ./public/ ? In

Re: Multiple template alias parameters

2015-05-07 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/05/2015 1:53 p.m., Brian Schott wrote: I have some code that automatically wires up control flow based on annotations. Use of this code looks something like this: ``` import some_package.some_module; void main(string[] args) { doMagicStuff!(some_package.some_module)(args); } ``` All

Re: dub sub-packages

2015-05-06 Thread Rikki Cattermole via Digitalmars-d-learn
On 6/05/2015 11:39 p.m., Alessandro wrote: Hi everyone, I've been learning D for a few months now and really liked it :) ! Currently I'm experimenting with client/server application development using the ZeroMQ library D wrapper called zmqd. Although I could successfully build the basic

Re: CTFE template predicates

2015-05-04 Thread Rikki Cattermole via Digitalmars-d-learn
On 4/05/2015 11:15 p.m., Robert M. Münch wrote: On 2015-05-04 03:52:21 +, Rikki Cattermole said: Have you looked at my book? https://leanpub.com/ctfe No, thanks for the hint. You will have one more reader ;-) I'm currently live streaming, feel free to jump on and ask any questions!

Re: CTFE template predicates

2015-05-04 Thread Rikki Cattermole via Digitalmars-d-learn
On 5/05/2015 6:24 a.m., Robert M. Münch wrote: On 2015-05-04 03:52:21 +, Rikki Cattermole said: Have you looked at my book? https://leanpub.com/ctfe I bought it. Will it be updated? It's very generic with respect the concept and I'm missing code examples for all the user-cases.

Re: CTFE template predicates

2015-05-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 4/05/2015 9:46 a.m., Robert M. Münch wrote: Hi, I have now played a around couple of hours (reading everything I could find) to get something to work, but I think I'm missing some basic concepts/understanding. Maybe someone can enlighten me how these things work. I thought that some code from

Re: Factory pattern in D

2015-05-01 Thread Rikki Cattermole via Digitalmars-d-learn
On 1/05/2015 10:01 p.m., Chris wrote: What would be the D equivalent of the factory pattern? This obviously doesn't work: struct A { int x = 42; } struct B { int x = 7; } auto factory(string type) { if (type == A) return A(); else if (type == B) return B(); else

Re: Microcontroller startup file - supported devices wish-list

2015-04-25 Thread Rikki Cattermole via Digitalmars-d-learn
On 26/04/2015 5:53 a.m., Jens Bauer wrote: As I'm impressed with the interest in the startup-files I've made so far, I'd like to add support for more devices. In order to do so, I'd like to ask on this forum, which devices you would be interested in. Please list specific device names/numbers if

Re: Startup files for STM32F4xx

2015-04-25 Thread Rikki Cattermole via Digitalmars-d-learn
On 25/04/2015 7:04 p.m., Jens Bauer wrote: On Saturday, 25 April 2015 at 05:14:57 UTC, Rikki Cattermole wrote: On 25/04/2015 5:07 p.m., Jens Bauer wrote: I hope to find a good way to use import for microcontroller libraries, so it'll be easy for everyone. I'm thinking about something like ...

Re: Startup files for STM32F4xx

2015-04-25 Thread Rikki Cattermole via Digitalmars-d-learn
On 25/04/2015 7:31 p.m., Jens Bauer wrote: On Saturday, 25 April 2015 at 07:08:26 UTC, Rikki Cattermole wrote: I was referring to package.d files. And publically importing all below modules/packages. Normally, one would want to import only the most necessary parts. Let's take an example: A

<    4   5   6   7   8   9   10   11   >