Re: Passing array as an function argument.

2017-09-11 Thread wobbles via Digitalmars-d-learn
On Monday, 11 September 2017 at 12:20:08 UTC, Vino.B wrote: On Monday, 11 September 2017 at 12:03:32 UTC, wobbles wrote: On Monday, 11 September 2017 at 11:58:18 UTC, Vino.B wrote: [...] The type returned from Test1() is a `RangeT!(Array!string)`. This is due to the `[]` on the end of

Re: Passing array as an function argument.

2017-09-11 Thread wobbles via Digitalmars-d-learn
On Monday, 11 September 2017 at 11:58:18 UTC, Vino.B wrote: Hi All, Can some one help me on how to pass a container array as a function argument , the below code throws an error, Error: Error: function T3.Test2 (Array!string t1) is not callable using argument types (RangeT!(Array!string))

Re: [vibe.d] showing images

2016-10-26 Thread wobbles via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 12:42:09 UTC, Nicholas Wilson wrote: [...] When you get the 404, do you see the contents of 'writeln(images);' in your terminal?

Re: Your connection is not private

2016-10-01 Thread wobbles via Digitalmars-d-learn
On Saturday, 1 October 2016 at 03:21:05 UTC, rikki cattermole wrote: On 01/10/2016 11:51 AM, Joel wrote: I get this when I click Learn at the top of the screen in dlang. This is on Chrome Mac (Sierra 10.12). Yup, you need to be on https. Chrome just started warning when using http in the

Re: vibe.d PaaS

2016-09-14 Thread wobbles via Digitalmars-d-learn
On Wednesday, 14 September 2016 at 16:03:50 UTC, Guillaume Piolat wrote: On Wednesday, 14 September 2016 at 10:56:57 UTC, llaine wrote: No PaaS service, but you can pretty simply use Heroku to deploy any vibe.d application. Check the tour.dlang.io

Re: vibe.d PaaS

2016-09-14 Thread wobbles via Digitalmars-d-learn
On Wednesday, 14 September 2016 at 09:01:11 UTC, Guillaume Piolat wrote: Is there vibe.d hosting sold anywhere? Not that I know, but any VPS you rent would be capable of hosting it. I guess you don't want to deal with all of the other services you'd need? (nginx / security / dbs etc etc ?)

Re: Mysql-native with LAMPP

2016-09-12 Thread wobbles via Digitalmars-d-learn
On Monday, 12 September 2016 at 05:31:46 UTC, Geert wrote: Hi all! I tried the client driver for MySQL/MariaDB "mysql-native". https://github.com/mysql-d/mysql-native Everything works well with an individually installed version of MySql. But I would like to know if there is a way to make D

Re: Compiling vibe.d application for Amazon ec2 instance

2016-09-12 Thread wobbles via Digitalmars-d-learn
On Sunday, 11 September 2016 at 23:12:15 UTC, crimaniak wrote: Hi all! I made vibe-d application, and client give me already taken hosting for it on Amazon aws ec2, uname -a: Linux ip-xxx-xx-xx-xx 4.4.11-23.53.amzn1.x86_64 #1 SMP Wed Jun 1 22:22:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Re: Get all files imported by a D source file

2016-09-09 Thread wobbles via Digitalmars-d-learn
On Thursday, 8 September 2016 at 07:20:52 UTC, Yuxuan Shui wrote: On Thursday, 8 September 2016 at 06:33:00 UTC, Jacob Carlborg wrote: On 2016-09-08 07:39, Yuxuan Shui wrote: Hi, I wonder if there's standardized way to gather which files are imported by a source file. I know I can run "dmd

Re: Template not seeming to instantiate a second time with default alias parameter

2016-08-31 Thread wobbles via Digitalmars-d-learn
On Tuesday, 30 August 2016 at 21:35:29 UTC, ag0aep6g wrote: On 08/30/2016 11:28 PM, wobbles wrote: I'll have to try find a workaround for now :/ This seems to work and isn't too ugly: class Node(T, alias func) {/*...*/} alias Node(T) = Node!(T, (T t) => t*t); Excellent - thanks

Re: Template not seeming to instantiate a second time with default alias parameter

2016-08-30 Thread wobbles via Digitalmars-d-learn
On Tuesday, 30 August 2016 at 20:55:20 UTC, ag0aep6g wrote: On 08/30/2016 10:41 PM, wobbles wrote: class Node(T, alias func = (T t => t*t))(){ //whatever } //instantiate Node!(int) intNode; Node!(float) floatNode; // fails as lambda func expects an int. Am I doing something wrong or is

Template not seeming to instantiate a second time with default alias parameter

2016-08-30 Thread wobbles via Digitalmars-d-learn
Hi, Code here: https://gist.github.com/grogancolin/066a8a8c105fa473dfee961e2481a30e Basically, it seems when a template has an alias parameter like class Node(T, alias func = (T t => t*t))(){ //whatever } //instantiate Node!(int) intNode; Node!(float) floatNode; // fails as lambda func

Re: OpenGL Setup?

2016-06-16 Thread wobbles via Digitalmars-d-learn
On Thursday, 16 June 2016 at 19:52:58 UTC, OpenJelly wrote: Last time I worked on anything OpenGL in D I was using a Linux machine, and I had to really bend over backward to get set up. I'm using Windows 7 at the moment and I'd like to work on some graphics stuff but I'm pretty lost... I

Re: Recommended coding convention for combining unix and windows code ?

2016-06-07 Thread wobbles via Digitalmars-d-learn
On Tuesday, 7 June 2016 at 15:33:57 UTC, chmike wrote: Hello I'm writing some code that I want to be portable across Posix and Windows. What is the recommended code convention for such type of code ? 80% of the class implementation is the same for both OS. Should I write the following and

Re: execute bash?

2016-04-10 Thread wobbles via Digitalmars-d-learn
On Sunday, 10 April 2016 at 00:47:28 UTC, Puming wrote: On Saturday, 9 April 2016 at 08:56:17 UTC, wobbles wrote: On Friday, 8 April 2016 at 23:06:06 UTC, Puming wrote: On Friday, 8 April 2016 at 18:23:32 UTC, wobbles wrote: On Friday, 8 April 2016 at 16:07:13 UTC, Adam D. Ruppe wrote: On

Re: execute bash?

2016-04-09 Thread wobbles via Digitalmars-d-learn
On Friday, 8 April 2016 at 23:06:06 UTC, Puming wrote: On Friday, 8 April 2016 at 18:23:32 UTC, wobbles wrote: On Friday, 8 April 2016 at 16:07:13 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 15:20:09 UTC, Puming wrote: I tried with signal, but didn't catch SIGTTOU, it seems that

Re: execute bash?

2016-04-08 Thread wobbles via Digitalmars-d-learn
On Friday, 8 April 2016 at 16:07:13 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 15:20:09 UTC, Puming wrote: I tried with signal, but didn't catch SIGTTOU, it seems that spawnProcess with `bash -i -c` will signal with SIGTTIN. Oh, surely because it wants to be interactive and is thus

Re: Does something like std.algorithm.iteration:splitter with multiple seperators exist?

2016-03-28 Thread wobbles via Digitalmars-d-learn
On Sunday, 27 March 2016 at 07:45:00 UTC, ParticlePeter wrote: On Wednesday, 23 March 2016 at 20:00:55 UTC, wobbles wrote: [...] Thanks Wobbles, I took your approach. There were some minor issues, here is a working version: [...] Great, thanks for fixing it up!

Re: Does something like std.algorithm.iteration:splitter with multiple seperators exist?

2016-03-23 Thread wobbles via Digitalmars-d-learn
On Wednesday, 23 March 2016 at 11:57:49 UTC, ParticlePeter wrote: I need to parse an ascii with multiple tokens. The tokens can be seen as keys. After every token there is a bunch of lines belonging to that token, the values. The order of tokens is unknown. I would like to read the file in as

Re: Enabling Only Top-Level Unittests

2016-03-21 Thread wobbles via Digitalmars-d-learn
On Monday, 21 March 2016 at 10:37:31 UTC, ZombineDev wrote: On Monday, 21 March 2016 at 10:29:36 UTC, Nordlöw wrote: I want to enable unittests only at the top-level of a module compilation. If I have a module top.d that imports dep1.d dep2.d ... which all contain

Re: Speed of csvReader

2016-01-21 Thread wobbles via Digitalmars-d-learn
On Thursday, 21 January 2016 at 15:17:08 UTC, data pulverizer wrote: On Thursday, 21 January 2016 at 14:56:13 UTC, Saurabh Das wrote: On Thursday, 21 January 2016 at 14:32:52 UTC, Saurabh Das wrote: [...] Actually since you're aiming for speed, this might be better: sw.start(); auto records

Re: core.time Duration how to get units in double/float format?

2016-01-19 Thread wobbles via Digitalmars-d-learn
On Tuesday, 19 January 2016 at 14:07:50 UTC, Borislav Kosharov wrote: On Monday, 18 January 2016 at 12:46:31 UTC, Jonathan M Davis wrote: [...] I want to use float time in a game where I call the update method passing the delta time as float seconds. It's more easy to multiply the dt with a

Re: Balanced match with std.regex

2015-12-15 Thread wobbles via Digitalmars-d-learn
On Tuesday, 15 December 2015 at 02:35:34 UTC, Xinok wrote: On Tuesday, 15 December 2015 at 01:29:39 UTC, Jakob Ovrum wrote: Thanks, that makes sense. String manipulation in D without regex is pretty nice anyway, so it's not a big loss. There is a library named Pegged which can match against

Re: String interpolation

2015-11-10 Thread wobbles via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 10:21:32 UTC, tired_eyes wrote: Hi, The only example of string interpolation I've found so far is on Rosetta Code: void main() { import std.stdio, std.string; "Mary had a %s lamb.".format("little").writeln; "Mary had a %2$s %1$s

Re: String interpolation

2015-11-10 Thread wobbles via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 10:41:52 UTC, tired_eyes wrote: On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath wrote: On Tuesday, 10 November 2015 at 10:21:32 UTC, tired_eyes wrote: [...] std.string.format and std.format are the standard options. What are you missing? Ruby:

Re: foreach loop

2015-11-03 Thread wobbles via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 15:10:43 UTC, wobbles wrote: On Tuesday, 3 November 2015 at 15:06:00 UTC, Namal wrote: On Tuesday, 3 November 2015 at 14:52:19 UTC, Adam D. Ruppe wrote: On Tuesday, 3 November 2015 at 14:47:14 UTC, Namal wrote: [...] for many of them it is as simple as:

Re: foreach loop

2015-11-03 Thread wobbles via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 15:06:00 UTC, Namal wrote: On Tuesday, 3 November 2015 at 14:52:19 UTC, Adam D. Ruppe wrote: On Tuesday, 3 November 2015 at 14:47:14 UTC, Namal wrote: I remember it is possible to get the index for each element in the foreach loop, but I forgot how to do it. Can

Re: foreach loop

2015-11-03 Thread wobbles via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 15:42:16 UTC, Edwin van Leeuwen wrote: On Tuesday, 3 November 2015 at 15:29:31 UTC, Namal wrote: writefln("Count is: %s", arr .filter!(a => a==true) .sum); // Note: std.algorithm.sum is the same as // std.algorithm.reduce!((a,b)=a+b); Shouldn't you be

Re: foreach loop

2015-11-03 Thread wobbles via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 14:47:14 UTC, Namal wrote: Hello guys, I remember it is possible to get the index for each element in the foreach loop, but I forgot how to do it. Can you help me out please. Thx. auto arr = ["Hello", "World"]; foreach(int idx, string str; arr){

Re: Mac IDE with Intellisense

2015-09-28 Thread wobbles via Digitalmars-d-learn
On Sunday, 27 September 2015 at 22:55:38 UTC, Johannes Loher wrote: On Saturday, 26 September 2015 at 18:27:52 UTC, Mike McKee wrote: On Saturday, 26 September 2015 at 10:31:13 UTC, wobbles wrote: Have you installed dkit for sublime? As in? https://github.com/yazd/DKit Looks like it's

Re: Mac IDE with Intellisense

2015-09-26 Thread wobbles via Digitalmars-d-learn
On Saturday, 26 September 2015 at 09:17:10 UTC, 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

Re: how do I check if a member of a T has a member ?

2015-09-13 Thread wobbles via Digitalmars-d-learn
On Sunday, 13 September 2015 at 16:46:54 UTC, Laeeth Isharc wrote: can I check if a member of a T has a member without using a mixin? hid_t createDataType(T)() if (__traits(isSame, TemplateOf!(T), PriceBar)) { auto tid=H5T.create(H5TClass.Compound,T.sizeof); enum offsetof(alias type,

Re: Is D suitable for my latest project?

2015-09-08 Thread wobbles via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 19:30:16 UTC, chris stevens wrote: On Sunday, 6 September 2015 at 14:45:45 UTC, BBasile wrote: You have Object.factory for this. You can also use a custom factory based on string comparison. (with some: static if(condition) return new This; else static

Re: Can we get a video tutorial?

2015-09-03 Thread wobbles via Digitalmars-d-learn
On Thursday, 3 September 2015 at 19:13:35 UTC, Stephen wrote: On Wednesday, 2 September 2015 at 01:15:28 UTC, Mike Parker wrote: * What was previously said * Ok, so, I am running Windows 10, I have installed VS 2015, I have installed DMD 1 and 2 (I know I only need 2 but it shouldn't hurt

Re: How to test if a double has no fraction part

2015-09-03 Thread wobbles via Digitalmars-d-learn
On Thursday, 3 September 2015 at 12:51:42 UTC, Namal wrote: Interesting, in contrary to C++ it saves the integral part in the dummy variable. Doing this I noticed if I try to write a double variable in the console it gives me only the integral part. I only did it with writeln so far. How can I

Re: reading file byLine

2015-09-02 Thread wobbles via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 21:53:20 UTC, Namal wrote: Thx guys, this helped alot. The next thing I want to do is read the file line by line and split the stream into words. I found this example of code that seems to do sort of something like it. How can I modyfy it so I can store the

Re: How to get BaseEnumType?

2015-08-31 Thread wobbles via Digitalmars-d-learn
On Monday, 31 August 2015 at 08:10:35 UTC, wobbles wrote: On Monday, 31 August 2015 at 07:55:53 UTC, drug wrote: import std.stdio; import std.traits; void main(){ static if(isSomeString!Foo){ writefln("String: %s", Foo.A); } static if(isScalarType!Bar){

Re: How to get BaseEnumType?

2015-08-31 Thread wobbles via Digitalmars-d-learn
On Monday, 31 August 2015 at 07:55:53 UTC, drug wrote: Hello I need to get the type to which I can cast the enum for using with foreign library. For example: ``` enum Foo { A = "a", B = "b", } enum Bar { A = 123, B = 432, } static assert(is(BaseEnumType!Foo == string)); static

How to get the current Timezone

2015-08-28 Thread wobbles via Digitalmars-d-learn
From the docs in std.datetime, I figured I could write: Clock.currTime.timezone().name() to get the timezone this system is in. However, it just returns an empty string. Anyone know how to get the timezone of the machine easily? Thanks!

Re: automatically verifying code samples in phobos docs

2015-08-20 Thread wobbles via Digitalmars-d-learn
On Thursday, 20 August 2015 at 06:28:44 UTC, Jacob Carlborg wrote: On 2015-08-20 01:41, Laeeth Isharc wrote: [...] Just use a documented unit tests block: /// unittest { // code goes here } It will be run as part of the unit tests and it will be included when generating the

Re: dmd.conf... again

2015-08-12 Thread wobbles via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 14:05:57 UTC, Atila Neves wrote: On Wednesday, 12 August 2015 at 13:46:24 UTC, wobbles wrote: On Wednesday, 12 August 2015 at 13:00:45 UTC, Atila Neves wrote: On Wednesday, 12 August 2015 at 12:40:49 UTC, Adam D. Ruppe wrote: [...] I downloaded the zip, added

Re: Convert a hex color string into r,g,b components.

2015-08-12 Thread wobbles via Digitalmars-d-learn
On Tuesday, 11 August 2015 at 22:11:51 UTC, Marcin Szymczak wrote: I would really love to solve this problem using ranges, because i am learning how to use them. Unfortunately even such a simple task seems so hard for me ;( I think writing a simple function to parse a string into a Color

Re: dmd.conf... again

2015-08-12 Thread wobbles via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 13:00:45 UTC, Atila Neves wrote: On Wednesday, 12 August 2015 at 12:40:49 UTC, Adam D. Ruppe wrote: On Wednesday, 12 August 2015 at 12:16:50 UTC, 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

Re: Yes or No Options

2015-07-28 Thread wobbles via Digitalmars-d-learn
On Monday, 27 July 2015 at 18:23:57 UTC, Alex wrote: On Monday, 27 July 2015 at 17:31:08 UTC, Ali Çehreli wrote: On 07/27/2015 08:50 AM, Alex wrote: a book that I bought The program looks a lot like one of the exercises in this chapter: http://ddili.org/ders/d.en/if.html You didn't

Re: oauth, Twitter, and std.net.curl

2015-06-15 Thread wobbles via Digitalmars-d-learn
On Monday, 15 June 2015 at 14:41:32 UTC, Taylor Gronka wrote: Hello, I've picked up a web design project, and I would love to use vibe.d/dlang. I need to use oauth to search on a number of web api's, such as searching for Twitter tweets. I tried using Adam's oauth (Thanks!). However, it

Re: oauth, Twitter, and std.net.curl

2015-06-15 Thread wobbles via Digitalmars-d-learn
On Monday, 15 June 2015 at 15:23:43 UTC, Taylor Gronka wrote: You two are phenomenal! Thanks! Oh, replaceMap is a custom funciton I wrote too... Eases replacing multiple values in a string with 1 function call. I wont pretend that it's fast as it allocates a lot of memory :) public string

Re: Casting MapResult

2015-06-15 Thread wobbles via Digitalmars-d-learn
On Monday, 15 June 2015 at 15:10:24 UTC, jmh530 wrote: snip float[] exp(float[] x) { auto y = x.map!(a = exp(a)); cast(float[]) y; return y; } Also, I dont think your functions will work? Your recursively calling exp in your map, but with a 'float' instead of

Re: Template problem - if arg[0]==something; call arg[1];

2015-05-28 Thread wobbles via Digitalmars-d-learn
On Wednesday, 27 May 2015 at 22:49:50 UTC, ketmar wrote: On Wed, 27 May 2015 22:49:18 +, ketmar wrote: i.e. `constructCases~(Aliases[2..$])` `constructCases!(Aliases[2..$])`, of course ;-) Only getting back to this now... Doesnt seem to work, I think I might rethink it and write a

Template problem - if arg[0]==something; call arg[1];

2015-05-27 Thread wobbles via Digitalmars-d-learn
I have some code that I'd really like to template-ize. Currently, I've the same construct all over my code, repeated(yet slightly different) about 15 times. Too much for me, and I'd like to make it into a template. This is a sample of my current code: http://dpaste.dzfl.pl/76814846898e I

Re: Writing to two files at once

2015-05-21 Thread wobbles via Digitalmars-d-learn
On Thursday, 21 May 2015 at 21:02:42 UTC, Ali Çehreli wrote: On 05/21/2015 01:56 PM, wobbles wrote: What I ended up doing was creating an OutputRange that contains the files I want to write to. On OutputRange.put I simply print to print to all the files. Just like MultiFile example here: :)

Re: Writing to two files at once

2015-05-21 Thread wobbles via Digitalmars-d-learn
On Thursday, 21 May 2015 at 20:15:29 UTC, wobbles wrote: On Thursday, 21 May 2015 at 20:06:08 UTC, wobbles wrote: I would like to write to two files at once. If user specifies verbose flag, output should write to both stdout and the programs standard output file. Any ideas? I should add,

Re: Writing to two files at once

2015-05-21 Thread wobbles via Digitalmars-d-learn
On Thursday, 21 May 2015 at 21:00:15 UTC, Cassio Butrico wrote: If I understand right you want to redirect the output to a file by a flag , another file type , video printer is it? I think by video printer you mean the console? If so, yes. I believe I've solved it anyway, see Ali and my

Writing to two files at once

2015-05-21 Thread wobbles via Digitalmars-d-learn
I would like to write to two files at once. If user specifies verbose flag, output should write to both stdout and the programs standard output file. Any ideas?

Re: Writing to two files at once

2015-05-21 Thread wobbles via Digitalmars-d-learn
On Thursday, 21 May 2015 at 20:06:08 UTC, wobbles wrote: I would like to write to two files at once. If user specifies verbose flag, output should write to both stdout and the programs standard output file. Any ideas? I should add, I'm using a library that already writes it's output to a

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

2015-05-11 Thread wobbles via Digitalmars-d-learn
On Saturday, 9 May 2015 at 23:32:49 UTC, Adam D. Ruppe wrote: On Saturday, 9 May 2015 at 13:00:01 UTC, wobbles wrote: On Linux, I'm able to edit a file descriptor after I've created it to tell it to read/write asynchronously, I cant seem to find anything similar on windows however.

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

2015-05-09 Thread wobbles via Digitalmars-d-learn
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 improving my dexpect library [2] to work

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

2015-05-09 Thread wobbles via Digitalmars-d-learn
On Saturday, 9 May 2015 at 12:25:32 UTC, wobbles wrote: On Saturday, 9 May 2015 at 12:16:52 UTC, Rikki Cattermole wrote: 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

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

2015-05-09 Thread wobbles via Digitalmars-d-learn
On Saturday, 9 May 2015 at 12:16:52 UTC, Rikki Cattermole wrote: 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

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

2015-05-09 Thread wobbles via Digitalmars-d-learn
On Saturday, 9 May 2015 at 12:48:16 UTC, Kagamin wrote: On Saturday, 9 May 2015 at 12:26:58 UTC, wobbles wrote: What I mean is, if the cmd.exe hasnt flushed it's output, my cmdPid.stdout.readln (or whatever) will block until it does. I dont really want this. Are you sure cmd is the culprit?

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

2015-05-09 Thread wobbles via Digitalmars-d-learn
On Saturday, 9 May 2015 at 13:00:01 UTC, wobbles wrote: On Saturday, 9 May 2015 at 12:48:16 UTC, Kagamin wrote: On Saturday, 9 May 2015 at 12:26:58 UTC, wobbles wrote: What I mean is, if the cmd.exe hasnt flushed it's output, my cmdPid.stdout.readln (or whatever) will block until it does. I

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

2015-05-07 Thread wobbles via Digitalmars-d-learn
On Thursday, 7 May 2015 at 08:25:30 UTC, Suliman wrote: You're not setting a port. add: settings.port = 8080; before listenHTTP(); then it'll work. It's do not help :( You're sure? My app.d is: import std.stdio; import vibe.d; shared static this(){ auto router = new URLRouter;

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

2015-05-07 Thread wobbles via Digitalmars-d-learn
On Thursday, 7 May 2015 at 09:08:53 UTC, wobbles wrote: On Thursday, 7 May 2015 at 08:25:30 UTC, Suliman wrote: You're not setting a port. add: settings.port = 8080; before listenHTTP(); then it'll work. It's do not help :( You're sure? My app.d is: import std.stdio; import vibe.d;

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

2015-05-07 Thread wobbles via Digitalmars-d-learn
On Thursday, 7 May 2015 at 08:09:50 UTC, Suliman wrote: Is next example is enough to serv simple index.html page? void setupServer() { auto router = new URLRouter; // add other routes here router.get(*, serveStaticFiles(public/)); auto settings = new

Re: Linker command

2015-05-06 Thread wobbles via Digitalmars-d-learn
On Monday, 4 May 2015 at 20:34:32 UTC, Paul wrote: Can some one tell me what this linker command means (or point me at some docs) please: dmd example.d -L-L. $@ AFAIK $@ is 'all the supplied arguments' so I don't understand what it achieves. (it's from the DAllegro5 example program, on

Re: getopt helpWanted

2015-04-30 Thread wobbles via Digitalmars-d-learn
On Wednesday, 29 April 2015 at 22:02:29 UTC, novice2 wrote: Hello. Help me please to understand, how to show usage help to user, who enter wrong options? For example, user not provided required filename. I want to show error message, and program usage help text. But likely getopt don't

Re: dub building is extremely slow

2015-04-30 Thread wobbles via Digitalmars-d-learn
On Thursday, 30 April 2015 at 03:00:36 UTC, zhmt wrote: On Thursday, 30 April 2015 at 02:02:50 UTC, zhmt wrote: dub build is running on centos7. It works well until today, It becomes very slow suddenly. It will take minuties per compilation, there is 10 files in project. Has anyone

Re: Possible to write a classic fizzbuzz example using a UFCS chain?

2015-04-28 Thread wobbles via Digitalmars-d-learn
On Tuesday, 28 April 2015 at 11:04:12 UTC, w0rp wrote: On Tuesday, 28 April 2015 at 10:46:54 UTC, Gary Willoughby wrote: After reading the following thread: http://forum.dlang.org/thread/nczgumcdfystcjqyb...@forum.dlang.org I wondered if it was possible to write a classic fizzbuzz[1] example

Re: Return data from different types of conditional operation

2015-04-23 Thread wobbles via Digitalmars-d-learn
On Thursday, 23 April 2015 at 09:48:21 UTC, Dennis Ritchie wrote: Hi, Why the program can not return different types of data from the conditional operator? - import std.stdio; auto foo() { if (true) { return 0; } else return true; } void

Re: DMD 64 bit on Windows

2015-04-14 Thread wobbles via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 01:31:27 UTC, Etienne wrote: I'm currently experiencing Out Of Memory errors when compiling in DMD on Windows Has anyone found a way to compile a DMD x86_64 compiler on Windows? I've been having this same issue. Over-use of CTFE is what's causing it on my part,

Managing memory usage at Compile Time with DMD

2015-04-09 Thread wobbles via Digitalmars-d-learn
So, I'm writing a poker AI bot. The idea was to generate a lookup table of all the poker hands using CTFE so runtime can be as quick as possible (as the bot has a very small amount of time to act). There are a LOT of calculations though, many millions of combinations. During complation,

Re: Managing memory usage at Compile Time with DMD

2015-04-09 Thread wobbles via Digitalmars-d-learn
On Thursday, 9 April 2015 at 10:04:09 UTC, John Colvin wrote: On Thursday, 9 April 2015 at 09:49:39 UTC, wobbles wrote: Another possibilty I was looking at was to write a tool that will spit out all combinations at runtime, and then import these back into the bot at compile time to build a

Re: Generating all combinations of length X in an array

2015-04-08 Thread wobbles via Digitalmars-d-learn
On Wednesday, 8 April 2015 at 11:08:00 UTC, wobbles wrote: On Wednesday, 8 April 2015 at 10:54:45 UTC, bearophile wrote: wobbles: While trying to generate all combinations of length X in an array, I came across the question on stackoverflow. [1] Theres a couple good answers there, but one

Generating all combinations of length X in an array

2015-04-08 Thread wobbles via Digitalmars-d-learn
Hi folks, While trying to generate all combinations of length X in an array, I came across the question on stackoverflow. [1] Theres a couple good answers there, but one that caught my eye shows a C# code snippet that is quite nice and short: public static IEnumerableIEnumerableT

Re: Generating all combinations of length X in an array

2015-04-08 Thread wobbles via Digitalmars-d-learn
On Wednesday, 8 April 2015 at 10:54:45 UTC, bearophile wrote: wobbles: While trying to generate all combinations of length X in an array, I came across the question on stackoverflow. [1] Theres a couple good answers there, but one that caught my eye shows a C# code snippet that is quite

Re: Windows - std.process - Setting env variables from D

2015-03-30 Thread wobbles via Digitalmars-d-learn
On Monday, 30 March 2015 at 12:54:28 UTC, Adam D. Ruppe wrote: On Monday, 30 March 2015 at 12:28:19 UTC, wobbles wrote: Any solutions that people know of? You can't from an exe, it is a limitation of the operating system (same on Linux btw, environment variable inheritance is always from

Windows - std.process - Setting env variables from D

2015-03-30 Thread wobbles via Digitalmars-d-learn
I'm trying to set environment variables that will be visible when my D program exits. It is possible in a windows batch file using the set command (like set VAR=VALUE ) However, running this in D using: import std.process; import std.stdio; void main(){ auto pid1 = spawnShell(`set

Re: Windows - std.process - Setting env variables from D

2015-03-30 Thread wobbles via Digitalmars-d-learn
On Monday, 30 March 2015 at 14:14:50 UTC, Laeeth Isharc wrote: On Monday, 30 March 2015 at 13:29:06 UTC, wobbles wrote: On Monday, 30 March 2015 at 12:54:28 UTC, Adam D. Ruppe wrote: On Monday, 30 March 2015 at 12:28:19 UTC, wobbles wrote: Any solutions that people know of? You can't from

Re: OPTLINK Error 45 Too Much DEBUG Data for Old CodeView format

2015-03-23 Thread wobbles via Digitalmars-d-learn
On Sunday, 22 March 2015 at 15:29:00 UTC, Koi wrote: thank you Etienne, after i replaced dmd's link.exe my project compiles successfully in debug-mode again. i'll add this info in my todo-after-installing-DMD.txt just in case. On Sunday, 22 March 2015 at 14:29:14 UTC, Etienne wrote: This

Re: enum and static if

2015-03-11 Thread wobbles via Digitalmars-d-learn
On Wednesday, 11 March 2015 at 14:34:32 UTC, ketmar wrote: On Wed, 11 Mar 2015 13:48:45 +, Namespace wrote: This code does not work: enum Test { Foo, static if (__VERSION__ = 2067) Bar, } Quatz } Any chance that this could work? nope. `static if` is statement,

Re: Dub + Optlink == ???

2015-03-09 Thread wobbles via Digitalmars-d-learn
On Sunday, 8 March 2015 at 23:05:53 UTC, David Held wrote: On 3/8/2015 3:55 PM, David Held wrote: Since DDT (Eclipse plugin) uses Dub, I am trying to convert the DWT build instructions into Dub. Here is my current attempt: { name : foo, description : foo, importPaths : [

Re: Opening temporary files for std.process.spawnProcess input/output

2015-02-26 Thread wobbles via Digitalmars-d-learn
On Wednesday, 25 February 2015 at 19:09:16 UTC, Ali Çehreli wrote: On 02/25/2015 05:56 AM, wobbles wrote: Hi, Any reason why the following wont work? void main(string[] args) { auto pidIn = File.tmpfile(); auto pidOut = File.tmpfile(); auto pid = spawnProcess([ls, ./],

Opening temporary files for std.process.spawnProcess input/output

2015-02-25 Thread wobbles via Digitalmars-d-learn
Hi, Any reason why the following wont work? void main(string[] args) { auto pidIn = File.tmpfile(); auto pidOut = File.tmpfile(); auto pid = spawnProcess([ls, ./], pidIn, pidOut, std.stdio.stdout, null, Config.newEnv); if(wait(pid) == 0) writefln(%s, pidOut.readln());

Re: Static method of inner class needs this

2015-02-09 Thread wobbles via Digitalmars-d-learn
On Monday, 9 February 2015 at 07:32:33 UTC, rumbu wrote: class Outer { class Inner { static Inner createInner() { return new Inner(); //need 'this' to access member this } } } Is this a bug? If Inner is not nested, it works as expected: class

Re: Question about Allocating

2015-01-26 Thread wobbles via Digitalmars-d-learn
On Monday, 26 January 2015 at 07:52:06 UTC, Gan wrote: I've been working on my game and am getting some pretty gnarly memory problems. I think it's how I'm allocating. Sometimes when I use variables I can do Color(255, 255, 255). But why is that different than new Color(255, 255, 255)? Same

Re: Dub / Derelict confusion

2014-11-19 Thread wobbles via Digitalmars-d-learn
On Wednesday, 19 November 2014 at 09:12:52 UTC, Paul wrote: I would like to create a simple program using SDL. I've read this page http://dblog.aldacron.net/derelict-help/using-derelict/ and this one http://code.dlang.org/about and decided that using 'dub' would be the sensible option for a

Re: Dub / Derelict confusion

2014-11-19 Thread wobbles via Digitalmars-d-learn
Put them into a place your linker can find (usually /usr/lib/ iirc). I forgot, I'm pretty sure make install does that step for you.