Re: Project setup for DUB
On 01/01/2020 9:11 PM, Ankush Bhardwaj wrote: I am now stuck here not knowing what should I do next or how should I compile. Compile what? You successfully compiled and ran your dub build. Please note the default action is to run, so using `dub` by itself is equivalent to `dub run`. Hence the recursive executions. Use `dub build` if all you want to do is build.
Project setup for DUB
Hello everyone, I was interested in contributing to the DUB project. So, I forked the repo, installed DMD and libcurl as instructed in the README. I ran build.sh inside the repo. It then creates a dub executable inside of bin folder. After that I was stuck as there was no documentation on how to make changes or how to compile the thing. I then ran ./bin/dub and it started some compilation. The linking also worked. After that I see this : Performing "debug" build using dmd for x86-64. dub 1.19.0-rc.1+commit.20.g14cc8e5: building configuration "application"... Serializing composite type BuildRequirements which has no serializable fields Serializing composite type BuildOptions which has no serializable fields Linking... Running ./bin/dub Performing "debug" build using dmd for x86_64. dub 1.19.0-rc.1+commit.20.g14cc8e5: target for configuration "application" is up to date. To force a rebuild of up-to-date targets, run again with --force. Running ./bin/dub Performing "debug" build using dmd for x86_64. dub 1.19.0-rc.1+commit.20.g14cc8e5: target for configuration "application" is up to date. To force a rebuild of up-to-date targets, run again with --force. Running ./bin/dub Performing "debug" build using dmd for x86_64. dub 1.19.0-rc.1+commit.20.g14cc8e5: target for configuration "application" is up to date. To force a rebuild of up-to-date targets, run again with --force. ... I am now stuck here not knowing what should I do next or how should I compile. I'm using WSL (Windows subsystem for linux) I believe this is a beginner's issue so please help me out here. Thanks.
Re: How to debug in vscode Windows?
On Friday, 27 December 2019 at 18:48:50 UTC, cfcd14f496326e429ce03c48650b7966 wrote: Hello. I spent many time to searching for find a solutions. Many posts not clearly or tell like brief. :( I tried "Microsoft C/C++(ms-vscode.cpptools)" and "Native Debug (webfreak.debug )" plugin. And I found this post: https://forum.dlang.org/post/jxnnfzjsytoneqvxe...@forum.dlang.org Yeah, "Native Debug" is not work on windows. I guess, can only use a GDB with "Microsoft C/C++(ms-vscode.cpptools)" for debug on windows. But I can't find setup guide for D clearly. You can use visual studio (works in 2019, havent tried earlier versions) to debug any exe you want. You do this... Go to File menu, then Open, then Project/Solution Make sure "all project files" is selected, then find the exe you want to debug, click Open. Now you can debug that exe inside Visual Studio (as long as its been compiled with debug info) You can also save the solution so next time you just open the solution and you're ready to debug. You can drop source files into visual studio and set breakpoints, but it will also automatically pull up the source when it hits an exception. Although you might need adjust VS settings so it breaks on all exceptions IIRC... explains how on this page... https://docs.microsoft.com/en-us/visualstudio/debugger/managing-exceptions-with-the-debugger?view=vs-2019 Its pretty much all working, except you cant see dynamic array contents and occasionally it steps a line out of sync. I never managed to get any debugger working in VSCode. But this way you get the Visual Studio debugger which as good as it gets, and its just a couple of clicks away. Oh I'm using LDC to compile so I'm not sure how well it works with DMD, haven't tried, but should work the same I imagine.
LLD-link doesn't work, how do I change linkers?
I cannot do any work, since LLD-link is broken and doesn't want to link for anything. It just gives me a bunch of errors for missing symbols, that supposed to be in the core libraries. How can I set up the Microsoft linker instead?
Re: Blog Post #0096: Hardware III - Keyboard and Mouse
On Wednesday, 1 January 2020 at 02:30:10 UTC, bauss wrote: Happy new year and thank you for your gtkd blogs :) Thanks, bauss. And you're welcome. :)
Re: How to use ResizerWidget in Dlangui app..?
On Monday, 30 December 2019 at 23:32:37 UTC, ShadoLight wrote: dragging with the left mouse button does nothing. Window window = Platform.instance.createWindow("DlangUI example", null); I'm not familiar with this toolkit, but my guess is that you didn't pass in a `flags` value and therefore you aren't using the appropriate overload of the createWindow() function to achieve what you're after. The following is from the DLangUI GitHub site (https://github.com/buggins/dlangui/wiki/Getting-Started). Take a look at the third argument: Window createWindow( dstring windowCaption, // window caption Window parent, // parent window, pass null for main (first) window. uint flags = WindowFlag.Resizable, // various flags - bit fields from WindowFlag enum values uint width = 0,// initial window width uint height = 0// initial window height );
Re: How to debug in vscode Windows?
On Friday, 27 December 2019 at 18:48:50 UTC, cfcd14f496326e429ce03c48650b7966 wrote: Hello. I spent many time to searching for find a solutions. Many posts not clearly or tell like brief. :( I tried "Microsoft C/C++(ms-vscode.cpptools)" and "Native Debug (webfreak.debug )" plugin. And I found this post: https://forum.dlang.org/post/jxnnfzjsytoneqvxe...@forum.dlang.org Yeah, "Native Debug" is not work on windows. I guess, can only use a GDB with "Microsoft C/C++(ms-vscode.cpptools)" for debug on windows. But I can't find setup guide for D clearly. hi, if you have the latest code-d version for vscode (webfreak.code-d) you can check in the User Guide (F1 -> code-d user guide) that it has a section about debugging you can check out which should guide you through all the steps to debug. In there you should find all information you need.
Re: Project setup for DUB
On Wednesday, 1 January 2020 at 08:37:43 UTC, rikki cattermole wrote: On 01/01/2020 9:11 PM, Ankush Bhardwaj wrote: I am now stuck here not knowing what should I do next or how should I compile. Compile what? You successfully compiled and ran your dub build. Please note the default action is to run, so using `dub` by itself is equivalent to `dub run`. Hence the recursive executions. Use `dub build` if all you want to do is build. In addition to that, there are different ways how you can contribute to Dub: - enhancing the dub help on code.dlang.org - finding duplicate/already solved issues on the github issue tracker Especially the issues list is a good starting point for new contributors to get some ideas how to contribute. Kind regards Andre
Re: How to debug in vscode Windows?
On Wednesday, 1 January 2020 at 14:46:01 UTC, NaN wrote: You can use visual studio (works in 2019, havent tried earlier versions) to debug any exe you want. You do this... Go to File menu, then Open, then Project/Solution Make sure "all project files" is selected, then find the exe you want to debug, click Open. Now you can debug that exe inside Visual Studio (as long as its been compiled with debug info) You can also save the solution so next time you just open the solution and you're ready to debug. You can drop source files into visual studio and set breakpoints, but it will also automatically pull up the source when it hits an exception. Although you might need adjust VS settings so it breaks on all exceptions IIRC... explains how on this page... https://docs.microsoft.com/en-us/visualstudio/debugger/managing-exceptions-with-the-debugger?view=vs-2019 Its pretty much all working, except you cant see dynamic array contents and occasionally it steps a line out of sync. I never managed to get any debugger working in VSCode. But this way you get the Visual Studio debugger which as good as it gets, and its just a couple of clicks away. Oh I'm using LDC to compile so I'm not sure how well it works with DMD, haven't tried, but should work the same I imagine. I usually just make an empty project and set up the exe file to the one that dub creates instead.
Re: How to debug in vscode Windows?
On Wednesday, 1 January 2020 at 16:21:32 UTC, solidstate1991 wrote: On Wednesday, 1 January 2020 at 14:46:01 UTC, NaN wrote: Its pretty much all working, except you cant see dynamic array contents and occasionally it steps a line out of sync. I never managed to get any debugger working in VSCode. But this way you get the Visual Studio debugger which as good as it gets, and its just a couple of clicks away. Oh I'm using LDC to compile so I'm not sure how well it works with DMD, haven't tried, but should work the same I imagine. I usually just make an empty project and set up the exe file to the one that dub creates instead. I guess it results in the same thing? Just an empty solution with a single exe in the explorer panel?
Re: How to use ResizerWidget in Dlangui app..?
On Wednesday, 1 January 2020 at 10:52:02 UTC, Ron Tarrant wrote: On Monday, 30 December 2019 at 23:32:37 UTC, ShadoLight wrote: dragging with the left mouse button does nothing. Window window = Platform.instance.createWindow("DlangUI example", null); I'm not familiar with this toolkit, but my guess is that you didn't pass in a `flags` value and therefore you aren't using the appropriate overload of the createWindow() function to achieve what you're after. The following is from the DLangUI GitHub site (https://github.com/buggins/dlangui/wiki/Getting-Started). Take a look at the third argument: Window createWindow( dstring windowCaption, // window caption Window parent, // parent window, pass null for main (first) window. uint flags = WindowFlag.Resizable, // various flags - bit fields from WindowFlag enum values uint width = 0,// initial window width uint height = 0// initial window height ); Thanks for the reply, Ron. Yes, as you say WindowFlag.Resizable is the default value for the 'flags' argument in the createWindow call, so that was the setting I had. But the problem is actually not in resizing the full app window (that actually works - including keeping the relative proportions of the widget children sizes), but rather in resizing 2 widgets that are separated by a ResizerWidget inside the app window. The app window size should actually not be affected since, as 1 widget on one side of the ResizerWidget shrinks by N pixels in height or width (depending on the orientation of the ResizerWidget), the opposite widget should grow by the same N pixels in height/width, leaving the parent size unaffected. I can see that is actually what is coded, but it is not working when I run the app. But I thought you may be on to something and I should check if children widgets of the app window inherits some settings from the parent, so I checked the WindowFlag flags. According to [1] you can have: - Fullscreen - Modal - Resizable However, checking the code there are additional options: /// window creation flags enum WindowFlag : uint { /// window can be resized Resizable = 1, /// window should be shown in fullscreen mode Fullscreen = 2, /// modal window - grabs input focus Modal = 4, /// measure window size on window.show() - helps if you want scrollWindow but on show() you want to set window to mainWidget measured size MeasureSize = 8, /// window without decorations Borderless = 16, /// expand window size if main widget minimal size is greater than size defined in window constructor ExpandSize = 32, } So it looks like the documentation isn't completely up to date either. Anyway, I also tried to pass WindowFlag.Resizable | WindowFlag.MeasureSize as flags argument in the call to createWindow, but it did not help. I was hoping for a quick answer on the forum from someone who has run into the same, but I think I'm going to need to dig into dlangui code to figure out what is going wrong. [1]: http://buggins.github.io/dlangui/ddox/dlangui/platforms/common/platform/WindowFlag.html
Re: How to use ResizerWidget in Dlangui app..?
On Thursday, 2 January 2020 at 05:24:33 UTC, Rémy Mouëza wrote: On Monday, 30 December 2019 at 23:32:37 UTC, ShadoLight wrote: Hi, I suspect I'm missing something obvious, but ResizerWidget is not working for me on Windows - it shows the 'dragging'-cursor when hovering the mouse on the ResizerWidget, but dragging with the left mouse button does nothing. I ran into the same issue. The resizeEvent callback is not implemented yet. Below is my custom implementation. [snip] OK, I suspected as much. But thanks a lot Rémy! You are saving me a lot of work - much appreciated!
Re: Concatenation/joining strings together in a more readable way
On Wednesday, 25 December 2019 at 12:39:08 UTC, BoQsc wrote: Are there any other ways to join two strings without Tilde ~ character? I can't seems to find anything about Tilde character concatenation easily, nor the alternatives to it. Can someone share some knowledge on this or at least point out useful links/resources? import std; import std: Format = format; // Function format() string format(T...)(string text, T args){ foreach(n, i; args){ text = text.replace("{%d}".Format(n+1), "%s$s".Format("%" ~ to!string(n+1))); } return text.replace("{}", "%s").Format(args); } void main(){ writeln("Hi {} how are you {}?".format("Marcone", "today")); // Hi Marcone how are you today? writeln("My name is {2} and I live in {1}.".format("Brazil", "Marcone")); // My name is Marcone and I live in Brazil. writeln("We are {2} and {1}. I am {} and you {}. ".format("Marcone", "Paul")); // We are Paul and Marcone. I am Marcone and you Marcone. }
Re: How to use ResizerWidget in Dlangui app..?
On Monday, 30 December 2019 at 23:32:37 UTC, ShadoLight wrote: Hi, I suspect I'm missing something obvious, but ResizerWidget is not working for me on Windows - it shows the 'dragging'-cursor when hovering the mouse on the ResizerWidget, but dragging with the left mouse button does nothing. I ran into the same issue. The resizeEvent callback is not implemented yet. Below is my custom implementation. /** A completed resizer widget. As of 2016-12-30, the ResizerWidget does not work out of the box. This class implement the missing piece. */ class Resizer : ResizerWidget { /// Default initialization. this () { super (); initResizeCb (); } /// Create with ID parameter. this (string ID, Orientation orient = Orientation.Vertical) { super (ID, orient); initResizeCb (); } /// Initialize the resize on drag behaviour callback. protected void initResizeCb () { this.resizeEvent = (ResizerWidget source, ResizerEventType event, int currentPosition) { if (event != ResizerEventType.Dragging) { return; } if (_orientation == Orientation.Horizontal) { auto delta = _previousWidget.width - currentPosition; auto pw= max (0, _previousWidget.width - delta); auto mw= max (0, _nextWidget.width + delta); _previousWidget .minWidth (pw) .maxWidth (pw); _nextWidget .minWidth (mw) .maxWidth (mw); } else if (_orientation == Orientation.Vertical) { auto delta = _previousWidget.height - currentPosition; auto pw= max (0, _previousWidget.height - delta); auto mw= max (0, _nextWidget.height + delta); _previousWidget .minHeight (pw) .maxHeight (pw); _nextWidget .minHeight (mw) .maxHeight (mw); } parent.requestLayout (); }; } }