Video playback

2014-05-18 Thread Dmitry via Digitalmars-d-learn
Hi everyone! I want to play video in my D-application (maybe WebM or Theora). However didn't find any library for operation with video in D. I am a beginner in D, experience of transfer of libraries with C/C++, certainly isn't present. Maybe somebody will prompt something? P.S. My

Re: Video playback

2014-05-18 Thread Dmitry via Digitalmars-d-learn
On Sunday, 18 May 2014 at 07:37:33 UTC, Rikki Cattermole wrote: My suggestion would be to go the direction of libvlc[0]. I did find a forum post from SFML that may help you. It is a c library so it shouldn't be too hard to create a binding to. Perhaps something along the lines of

Re: Programming a Game in D? :D

2014-05-24 Thread Dmitry via Digitalmars-d-learn
On Saturday, 24 May 2014 at 09:49:30 UTC, evilrat wrote: why not just use Xamarin Studio with Mono-D? But only the trial of Xamarin Studio is for free, and I used eclipse for Java before and really like it :P actually not. you don't even need to register at all. just go to

Re: Programming a Game in D? :D

2014-05-25 Thread Dmitry via Digitalmars-d-learn
On Saturday, 24 May 2014 at 18:00:05 UTC, evilrat wrote: there is a plugin for linux for GDB i believe, and another plugin for Windows which i can't remember the name, the latter one disappeared from XS 5.0 by some reason. search the extensions for it. I use Windows. Thanks, I think I found

Re: Programming a Game in D? :D

2014-05-25 Thread Dmitry via Digitalmars-d-learn
On Sunday, 25 May 2014 at 09:44:18 UTC, evilrat wrote: sorry, forgot to add - Mono-D is moving to XS 5.0 (alpha), so if XS 4.0 not working for you, try to switch on alpha channel updates. on the contrary, I have now XS 5.0 and I have a reply: aBothe commented an hour ago It's not there for

Re: Natural sorted list of files

2017-02-06 Thread Dmitry via Digitalmars-d-learn
On Monday, 6 February 2017 at 18:57:17 UTC, Ali Çehreli wrote: I think it's now std.algorithm.chunkBy. Please fix Rosetta Thank you! I fixed, but anyway it works incorrect (it doesn't any changes): Code: https://rosettacode.org/wiki/Natural_sorting#D Result: http://pastebin.com/hhSB4Vpn

Re: Natural sorted list of files

2017-02-06 Thread Dmitry via Digitalmars-d-learn
On Monday, 6 February 2017 at 17:35:02 UTC, Jonathan M Davis wrote: You have to import std.range to use groupBy. Of course, "import std.range" already done. I tested it also with full rosetta's code: import std.stdio, std.string, std.algorithm, std.array, std.conv, std.ascii, std.range;

Natural sorted list of files

2017-02-06 Thread Dmitry via Digitalmars-d-learn
Hi. I'm need get list of files in the directory, with natural sort, like: file_2 file_8 file_10 file_11 file_20 file_100 etc. Found this https://rosettacode.org/wiki/Natural_sorting#D but there is error on ".groupBy!isDigit" (Error: no property 'groupBy' for type 'string'). with deleted line

Re: Natural sorted list of files

2017-02-07 Thread Dmitry via Digitalmars-d-learn
On Wednesday, 8 February 2017 at 07:41:29 UTC, Ali Çehreli wrote: test.naturalSort would sort the array in place before calling writeln and 'test' would appear naturally sorted as well. I've fixed it like this: Great! Thank you!

hidden passing of __FILE__ and __LINE__ into function

2017-04-17 Thread Dmitry via Digitalmars-d-learn
Hi there. Currently for messages about errors I use code like this: void add(string name, ref Scene scene) { if (name in listOfScenes) { EError(__FILE__, __LINE__, "scene already exists".L, quoted(name)); } ... } Is there way for avoid

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-17 Thread Dmitry via Digitalmars-d-learn
On Monday, 17 April 2017 at 10:55:30 UTC, Jonathan M Davis wrote: They works, but it results in a new template being instantiated for every call, so you really shouldn't use __FILE__ or __LINE__ as template arguments if you can avoid it. Does it matter if I anyway use template (S...) ? And

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-17 Thread Dmitry via Digitalmars-d-learn
On Monday, 17 April 2017 at 14:23:50 UTC, Jonathan M Davis wrote: So, if you're okay with explicitly instantiating your variadic function template instead of having the types inferred, then it Yes, it's my case. That's a game engine, so some kilobytes isn't a problem. Moreover, possible that

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-18 Thread Dmitry via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 13:48:57 UTC, Stanislav Blinov wrote: There's a much more concise workaround, both in code written and generated ;) import std.stdio; template func(string file = __FILE__, int line = __LINE__) { auto func(T...)(auto ref T args) { writeln("called

Re: CSV crash: "Quote located in unquoted token"

2017-10-13 Thread Dmitry via Digitalmars-d-learn
On Friday, 13 October 2017 at 09:00:52 UTC, rikki cattermole wrote: Write a purpose built csv parser using ranges. It should take only about half an hour. I know, I know not very helpful. But a custom built parser will work better for you I think. Yep, I can parse it myself, but I want to try

Re: CSV crash: "Quote located in unquoted token"

2017-10-13 Thread Dmitry via Digitalmars-d-learn
On Friday, 13 October 2017 at 10:11:39 UTC, rikki cattermole wrote: Something along the lines of: .byLine.map!(a => a.fixQuotes).joiner("\n").csvReader!... Yep, it works. Either way, you're using ranges! Its even the same amount of code, if not less. I see. Thank you!

Re: debugging in vs code on Windows

2017-10-15 Thread Dmitry via Digitalmars-d-learn
On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote: Has anyone been able to debug in VS code on Windows? What am I doing wrong? Yep, it work for me. How do you start debugging? I noticed that the bottom button (small bug) at status bar doesn't work for me. But when I use Debug →

Re: debugging in vs code on Windows

2017-10-17 Thread Dmitry via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 08:38:20 UTC, Arjan wrote: Before this will work, one must install the Microsoft C/C++ Addin i.e. ms-vscode.cpptools. Start debugging and select the C++ debugger. Yep https://forum.dlang.org/post/xwsvxphjtzgwjyrgd...@forum.dlang.org

Re: CSV crash: "Quote located in unquoted token"

2017-10-13 Thread Dmitry via Digitalmars-d-learn
On Friday, 13 October 2017 at 18:53:37 UTC, Jesse Phillips wrote: You can use Malformed.ignore[1], but your data will come out like: You are about to remove ""{0}"" from view ""{1}"" This would leave you needing to modify the "". 1. https://dlang.org/phobos/std_csv.html#.Malformed I'll

Re: debugging in vs code on Windows

2017-10-16 Thread Dmitry via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 02:32:49 UTC, Domain wrote: Can you share your tasks.json and launch.json? tasks.json - I don't have this file. launch.json: { "version": "0.2.0", "configurations": [ { "name": "(Windows) Launch", "type": "cppvsdbg",

CSV crash: "Quote located in unquoted token"

2017-10-13 Thread Dmitry via Digitalmars-d-learn
Hi there. When I load csv, it crashes ("Quote located in unquoted token") on lines with quotes, like this: ResourceNode_RemoveFromView_Confirm,You are about to remove ""{0}"" from view ""{1}"". Continue?,You are about to remove ""{0}"" from view ""{1}"". Continue?,,Resource Tree -

Re: debugging in vs code on Windows

2017-10-18 Thread Dmitry via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 10:09:12 UTC, Dmitry wrote: On Tuesday, 17 October 2017 at 08:38:20 UTC, Arjan wrote: Before this will work, one must install the Microsoft C/C++ Addin i.e. ms-vscode.cpptools. Start debugging and select the C++ debugger. Yep

Tried C++ to D. Wrong result.

2017-11-27 Thread Dmitry via Digitalmars-d-learn
I tried translate C++ programm to D, but result is different. original: https://github.com/urraka/alpha-bleeding/blob/master/src/alpha-bleeding.cpp result (with removed alpha): https://github.com/urraka/alpha-bleeding/blob/master/media/alpha-bleeding-opaque.png my: https://pastebin.com/GzZQ7WHt

Re: Tried C++ to D. Wrong result.

2017-11-27 Thread Dmitry via Digitalmars-d-learn
On Monday, 27 November 2017 at 14:14:12 UTC, rikki cattermole wrote: Did you confirm that the image was loaded originally correctly? Yes. This image was used: https://github.com/urraka/alpha-bleeding/blob/master/media/original.png

Re: Tried C++ to D. Wrong result.

2017-11-28 Thread Dmitry via Digitalmars-d-learn
On Tuesday, 28 November 2017 at 09:01:47 UTC, Temtaime wrote: https://pastebin.com/xJXPBh0n Converted it and it works as expected. What did you use for it? In future I'll be needed to convert some more C++ code. P.S. /And it works wrong, because uses unsafe pointer (ubyte *image). So, it

Re: Tried C++ to D. Wrong result.

2017-11-27 Thread Dmitry via Digitalmars-d-learn
On Monday, 27 November 2017 at 17:01:29 UTC, Adam D. Ruppe wrote: In the C++ version they are declared std::vector pending; std::vector pendingNext; Ah, indeed. I thought that pending.reserve(N); pendingNext.reserve(N); initializes them (last time I used C++ about 17 years ago...) I

Re: Tried C++ to D. Wrong result.

2017-11-27 Thread Dmitry via Digitalmars-d-learn
On Monday, 27 November 2017 at 14:35:39 UTC, Stefan Koch wrote: First I'd make sure that what you get out of dlib load is the same as the c++ version gets. Just use standard debugging techniques. Yes, it's same. As you can see, the top-middle area of the result is same. I wrote a video of

Re: Tried C++ to D. Wrong result.

2017-11-27 Thread Dmitry via Digitalmars-d-learn
On Monday, 27 November 2017 at 18:40:41 UTC, Ali Çehreli wrote: So, it looks like the original code was accessing out of bounds and probably that's why you inserted the ((index + 3) < N) check in the D version because D was catching that error at runtime. Yes, it is. Which of course would

Re: Tried C++ to D. Wrong result.

2017-11-27 Thread Dmitry via Digitalmars-d-learn
On Monday, 27 November 2017 at 17:21:05 UTC, Dmitry wrote: It fixed a delay (you can see it on video I posted before), but result is same. It seems I found the problem. C++ version (line 93): if (image[index + 3] != 0) I changed to if (image[index] != 0) and it works. I don't understand

Re: Email validation

2017-11-28 Thread Dmitry via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 03:49:56 UTC, codephantom wrote: string domainRequired = "@hotmail.com"; string emailAddress = "vino.bhee...@hotmail.com"; emailAddress.endsWith(domainRequired) ? writeln("domain ok") : writeln("invalid domain"); Also you need check that

Re: Tried C++ to D. Wrong result.

2017-11-27 Thread Dmitry via Digitalmars-d-learn
On Monday, 27 November 2017 at 19:01:28 UTC, Ali Çehreli wrote: P.S. I think you have an unnecessary 'ref' on the D version because a slice is already a reference to elements: Fixed, thank you.