Re: DlangUI translations

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

Re: Why does map take lambda as a template parameter

2016-04-23 Thread Lass Safin via Digitalmars-d-learn
On Saturday, 23 April 2016 at 20:06:39 UTC, xtreak wrote: map takes lambda as a template parameter and so does filter and many other functions. Sometimes they take something other than lambda as a template parameter. Eg. In case of to!int("5") int is a type and hence might need it as a template

Why does map take lambda as a template parameter

2016-04-23 Thread xtreak via Digitalmars-d-learn
map takes lambda as a template parameter and so does filter and many other functions. Sometimes they take something other than lambda as a template parameter. Eg. In case of to!int("5") int is a type and hence might need it as a template parameter but why does map and others take it as template

Re: What does alias do?

2016-04-23 Thread ag0aep6g via Digitalmars-d-learn
On 23.04.2016 21:49, xtreak wrote: I am a D newbie from Python and I am trying to grok alias. Is alias like Python does as below L = [] myextend = L.extend L.myextend My Python isn't too great, but I think this is more similar to function pointers or delegates in D. Renaming imported funct

Re: What does alias do?

2016-04-23 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 23 April 2016 at 19:52:15 UTC, xtreak wrote: I just thought posting to forum will have more people to discuss on this. Sorry for the double post. There's no problem with posting to the forums and talking on IRC. Since the chat isn't searchable and disappears fast, the forums lets

Re: What does alias do?

2016-04-23 Thread xtreak via Digitalmars-d-learn
On Saturday, 23 April 2016 at 19:49:46 UTC, xtreak wrote: I am a D newbie from Python and I am trying to grok alias. Is alias like Python does as below L = [] myextend = L.extend L.myextend Renaming imported function from itertools import permutations as p p([1, 2], 2) Is D aliasing the same

What does alias do?

2016-04-23 Thread xtreak via Digitalmars-d-learn
I am a D newbie from Python and I am trying to grok alias. Is alias like Python does as below L = [] myextend = L.extend L.myextend Renaming imported function from itertools import permutations as p p([1, 2], 2) Is D aliasing the same as above? How does aliasing types help like below alias

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

2016-04-23 Thread Kagamin via Digitalmars-d-learn
http://wiki.dlang.org/Libraries_and_Frameworks#GUI_Libraries

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

2016-04-23 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-04-23 08:53, Mike Parker wrote: If you need a complete, cross-platform GUI toolkit, there are D bindings for Gtk (GtkD) and SWT (DWT). Technically DWT is not bindings to SWT. It's the full source completely translated to D. -- /Jacob Carlborg

Re: Why I can't pass to datetime.benchmark function with parameters?

2016-04-23 Thread Suliman via Digitalmars-d-learn
In the third example you're providing an integer as the function to benchmark, and foo is never mentioned. My error. I mean it should be: auto r = benchmark!(foo(4))(1); But thanks for answer!

Re: Are structs saved in multi-thread delegate call?

2016-04-23 Thread ag0aep6g via Digitalmars-d-learn
On 23.04.2016 07:35, ag0aep6g wrote: So the struct is destroyed at the end of DoDirSearch, despite there being a closure for it. Is the compiler doing the right thing here? Shouldn't the struct be considered alive until the closure gets garbage collected? I've filed an issue: https://issues.dla

Re: Why I can't pass to datetime.benchmark function with parameters?

2016-04-23 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 23 April 2016 at 15:11:13 UTC, Suliman wrote: Working: void main() { auto r = benchmark!(foo)(1); } [...] Do not working: void main() { auto r = benchmark!(foo())(1); } [...] Error: expression foo() is void and has no value Do not working: void main() { auto r = benchma

Re: Linker error for d.o: relocation R_X86_64_32 against `__dmd_personality_v0'

2016-04-23 Thread Basile B. via Digitalmars-d-learn
On Saturday, 23 April 2016 at 17:06:07 UTC, rcorre wrote: On Saturday, 23 April 2016 at 00:55:07 UTC, rcorre wrote: On Friday, 22 April 2016 at 10:25:34 UTC, Chris wrote: [...] No luck with cmain.d. Its definitely an environmental problem -- I have an almost identical Archlinux desktop that

Re: Linker error for d.o: relocation R_X86_64_32 against `__dmd_personality_v0'

2016-04-23 Thread rcorre via Digitalmars-d-learn
On Saturday, 23 April 2016 at 00:55:07 UTC, rcorre wrote: On Friday, 22 April 2016 at 10:25:34 UTC, Chris wrote: On Friday, 22 April 2016 at 09:49:02 UTC, Rene Zwanenburg wrote: On Thursday, 21 April 2016 at 16:29:14 UTC, rcorre wrote: - What happens when you compile a binary without phobos and

DlangUI translations

2016-04-23 Thread stunaep via Digitalmars-d-learn
I am wondering how to use other languages and how to NOT use other languages. I have all of the UI of my program translated to Russian, and I have the languages loading from the resource files, but I have no idea how to switch the language to Russian. Also, when adding file names to a StringLis

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

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

Why I can't pass to datetime.benchmark function with parameters?

2016-04-23 Thread Suliman via Digitalmars-d-learn
Working: void main() { auto r = benchmark!(foo)(1); } void foo() { } Do not working: void main() { auto r = benchmark!(foo())(1); } void foo() { } Error: expression foo() is void and has no value Do not working: void main() { auto r = benchmark!(4)(1); } void foo(int i) { writeln(i)

Re: Enabling Only Top-Level Unittests

2016-04-23 Thread Basile B via Digitalmars-d-learn
On Friday, 22 April 2016 at 18:18:39 UTC, Basile B. wrote: I think a DMD option should be added to allow the tests to be compiled but never called, something like -runTests. Because the first solution is much more attractive. Actually the first solution works with: https://dlang.org/phobos/co

Re: Newbie: Error parsing csv file with very long lines

2016-04-23 Thread Ivan Kazmenko via Digitalmars-d-learn
On Saturday, 23 April 2016 at 10:40:13 UTC, salvari wrote: It seems to be really simple, I read the columns name with no problem. But as soon as the program parses the first line of data, the array containing the columns names seems to be overwrited. Another possibility yet not mentioned is t

Re: Newbie: Error parsing csv file with very long lines

2016-04-23 Thread salvari via Digitalmars-d-learn
On Saturday, 23 April 2016 at 11:13:19 UTC, Nicholas Wilson wrote: On Saturday, 23 April 2016 at 10:57:04 UTC, salvari wrote: Fixed!!! Thanks a lot. :-) But I have to think about this. I don't understand the failure. stdin.byLine() reuses its buffer. so the old arrays in columns point to t

Re: Newbie: Error parsing csv file with very long lines

2016-04-23 Thread salvari via Digitalmars-d-learn
On Saturday, 23 April 2016 at 11:18:08 UTC, rikki cattermole wrote: On 23/04/2016 10:57 PM, salvari wrote: Fixed!!! Thanks a lot. :-) But I have to think about this. I don't understand the failure. .dup duplicates memory. What this means is, it allocates a new block of memory and copies th

Re: Newbie: Error parsing csv file with very long lines

2016-04-23 Thread rikki cattermole via Digitalmars-d-learn
On 23/04/2016 10:57 PM, salvari wrote: Fixed!!! Thanks a lot. :-) But I have to think about this. I don't understand the failure. .dup duplicates memory. What this means is, it allocates a new block of memory and copies the values across. What byLine does is, read up to \n and copies it i

Re: Newbie: Error parsing csv file with very long lines

2016-04-23 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 23 April 2016 at 10:57:04 UTC, salvari wrote: Fixed!!! Thanks a lot. :-) But I have to think about this. I don't understand the failure. stdin.byLine() reuses its buffer. so the old arrays in columns point to the data in byLine's buffer and they get overwritten by subsequent c

Re: Newbie: Error parsing csv file with very long lines

2016-04-23 Thread salvari via Digitalmars-d-learn
Fixed!!! Thanks a lot. :-) But I have to think about this. I don't understand the failure.

Re: Newbie: Error parsing csv file with very long lines

2016-04-23 Thread rikki cattermole via Digitalmars-d-learn
On 23/04/2016 10:40 PM, salvari wrote: Hello all! I'm trying to read a csv file (';' as separator) with very long lines. It seems to be really simple, I read the columns name with no problem. But as soon as the program parses the first line of data, the array containing the columns names seems

Newbie: Error parsing csv file with very long lines

2016-04-23 Thread salvari via Digitalmars-d-learn
Hello all! I'm trying to read a csv file (';' as separator) with very long lines. It seems to be really simple, I read the columns name with no problem. But as soon as the program parses the first line of data, the array containing the columns names seems to be overwrited. I'm using dmd:

Re: Using D in Android App

2016-04-23 Thread Joakim via Digitalmars-d-learn
On Saturday, 16 April 2016 at 04:04:24 UTC, Justice wrote: Is it difficult to create a D business like app and connect it to android through java for the interface? Not difficult, but it hasn't really been done yet. I don't anticipate JNI causing much of a problem, but I need to look into it