www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - diet-ng Live mode and announcing dietpc

reply Steven Schveighoffer <schveiguy gmail.com> writes:
Since October I have been using an experimental feature I created for 
the diet-ng package [1] that allows one to alter just the HTML portions 
of a diet template and have the server re-render those pages. It has 
saved me significant development time as I can e.g. alter a class on an 
html element, add javascript, just about anything that doesn't have to 
do with running actual D code, and I do not need to rebuild my entire 
application. Those of you who watched my dconf 2018 presentation may 
have heard me talk about the issue of vibe.d build times.

Today, Sönke merged and released my experimental feature called "Live 
Mode" into diet-ng, so it is now available for everyone to play with 
under version 1.7.0 of diet-ng. Go check out the README, and please let 
me know if you find any issues with it. Note it definitely is still 
experimental, and doesn't support everything you can do in a diet 
template (see the README for details).

In order to do this, I had to make all the code that diet-ng runs using 
templates runnable at runtime. In addition, because vibe.d generally 
wants everything  safe, diet-ng should now be fully  safe.

In addition to this, I have also been using the DietUseCache feature of 
diet-ng, another experimental feature, which allows to skip the entire 
compilation step of diet templates, and just import a cached version of 
the compiled file (again see README of diet-ng for details). However, 
this has a significant limitation -- you need to build the template once 
without caching so it can be put out as a cached file during the first 
run of the application. As I was running up against memory limitations 
on my system for running this CTFE, and the Live mode forced me to make 
everything doable at runtime, I decided to build a "pre-compiler" for 
the templates, that builds the cache files before the compilation step. 
In my project, this lowered my build time from 38 seconds down to 11, 
and the caching saves about 25% of the compiler memory consumption.

This utility I called dietpc I'm very happy to say is now available as a 
dub package for your usage [2]. Please file any bugs for it there or on 
the diet-ng package as appropriate, and I will work on making sure 
everything works as expected.

Thank you to Sönke for accepting this feature and the whole vibe.d team 
for these great projects!

-Steve

[1] https://code.dlang.org/packages/diet-ng
[2] https://code.dlang.org/packages/dietpc
Mar 24 2020
next sibling parent reply norm <norm.rowtree gmail.com> writes:
On Tuesday, 24 March 2020 at 15:03:33 UTC, Steven Schveighoffer 
wrote:
 Since October I have been using an experimental feature I 
 created for the diet-ng package [1] that allows one to alter 
 just the HTML portions of a diet template and have the server 
 re-render those pages. It has saved me significant development 
 time as I can e.g. alter a class on an html element, add 
 javascript, just about anything that doesn't have to do with 
 running actual D code, and I do not need to rebuild my entire 
 application. Those of you who watched my dconf 2018 
 presentation may have heard me talk about the issue of vibe.d 
 build times.

 [...]
Hi, When I try to access the documentation for dietpc I get the error below. --- Downloading package info... Downloading source code for version master from https://github.com/schveiguy/dietpc/archive/master.zip... Failed: X-Geo-Block-List: --- From the dub package page it links to https://dietpc.dpldocs.info Cheers, Norm
Mar 24 2020
next sibling parent reply norm <norm.rowtree gmail.com> writes:
On Tuesday, 24 March 2020 at 23:20:20 UTC, norm wrote:
 On Tuesday, 24 March 2020 at 15:03:33 UTC, Steven Schveighoffer 
 wrote:
 Since October I have been using an experimental feature I 
 created for the diet-ng package [1] that allows one to alter 
 just the HTML portions of a diet template and have the server 
 re-render those pages. It has saved me significant development 
 time as I can e.g. alter a class on an html element, add 
 javascript, just about anything that doesn't have to do with 
 running actual D code, and I do not need to rebuild my entire 
 application. Those of you who watched my dconf 2018 
 presentation may have heard me talk about the issue of vibe.d 
 build times.

 [...]
Hi, When I try to access the documentation for dietpc I get the error below. --- Downloading package info... Downloading source code for version master from https://github.com/schveiguy/dietpc/archive/master.zip... Failed: X-Geo-Block-List: --- From the dub package page it links to https://dietpc.dpldocs.info Cheers, Norm
and this time I got a bit more info come up in the browser although I don't know if it helps much; --- The project build failed. copy/paste this link to adam so he can fix the bug. core.exception.AssertError /home/me/arsd/http2.d(1154): X-Geo-Block-List: ---------------- ??:? _d_assert_msg [0x5c6f9a] /home/me/arsd/http2.d:1154 void arsd.http2.HttpRequest.handleIncomingData(scope const(ubyte[])).parseLastHeader() [0x5abd5b] /home/me/arsd/http2.d:1229 bool arsd.http2.HttpRequest.handleIncomingData(scope const(ubyte[])) [0x5aaa1d] /home/me/arsd/http2.d:1027 int arsd.http2.HttpRequest.advanceConnections().__foreachbody3(ref std.socket.Socket, ref arsd.http2.HttpRequest) [0x5aa259] ??:? _aaApply2 [0x5ccad0] /home/me/arsd/http2.d:1010 int arsd.http2.HttpRequest.advanceConnections() [0x5a9f14] /home/me/arsd/http2.d:809 arsd.http2.HttpResponse arsd.http2.HttpRequest.waitForCompletion() [0x5a90ca] dl.d:358 void dl.app(arsd.cgi.Cgi) [0x528e3d] /home/me/arsd/cgi.d:3815 void arsd.cgi.doThreadScgiConnection!(arsd.cgi.Cgi, dl.app(arsd.cgi.Cgi), 5000000L).doThreadScgiConnection(std.socket.Socket) [0x546edf] /home/me/arsd/cgi.d:4361 void arsd.cgi.ConnectionThread.run() [0x53b344] ??:? void core.thread.Thread.run() [0x5c893d] ??:? thread_entryPoint [0x6158db] ??:? [0x7fbaea3706da] ---
Mar 24 2020
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Tuesday, 24 March 2020 at 23:23:53 UTC, norm wrote:
 When I try to access the documentation for dietpc I get the 
 error below.
There is no API documentation, but the github readme has some: https://github.com/schveiguy/dietpc
Mar 24 2020
prev sibling parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 3/24/20 7:20 PM, norm wrote:
 On Tuesday, 24 March 2020 at 15:03:33 UTC, Steven Schveighoffer wrote:
 Since October I have been using an experimental feature I created for 
 the diet-ng package [1] that allows one to alter just the HTML 
 portions of a diet template and have the server re-render those pages. 
 It has saved me significant development time as I can e.g. alter a 
 class on an html element, add javascript, just about anything that 
 doesn't have to do with running actual D code, and I do not need to 
 rebuild my entire application. Those of you who watched my dconf 2018 
 presentation may have heard me talk about the issue of vibe.d build 
 times.

 [...]
Hi, When I try to access the documentation for dietpc I get the error below. --- Downloading package info... Downloading source code for version master from https://github.com/schveiguy/dietpc/archive/master.zip... Failed: X-Geo-Block-List: --- From the dub package page it links to https://dietpc.dpldocs.info Cheers, Norm
Hm... I didn't create any DDOC documentation, all the docs are in the readme. It's an application. But I think the error above seems unrelated, it seems it can't download the zipfile or something. See readme on code.dlang.org or on the github page. -Steve
Mar 24 2020
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Tuesday, 24 March 2020 at 23:33:21 UTC, Steven Schveighoffer 
wrote:
 Hm... I didn't create any DDOC documentation, all the docs are 
 in the readme. It's an application.
yeah. you might just change teh documentation thing in the code.dlang.org "manage this package" screen to link back to your readme or something in this case.
 But I think the error above seems unrelated, it seems it can't 
 download the zipfile or something.
yeah. sometimes github or dub randomly block/fail on my doc generator. it automatically retries the next day... but that means there's a good chunk of time where it just shows the error page.
Mar 24 2020
parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 3/24/20 7:37 PM, Adam D. Ruppe wrote:
 On Tuesday, 24 March 2020 at 23:33:21 UTC, Steven Schveighoffer wrote:
 Hm... I didn't create any DDOC documentation, all the docs are in the 
 readme. It's an application.
yeah. you might just change teh documentation thing in the code.dlang.org "manage this package" screen to link back to your readme or something in this case.
Ah, I didn't know about this, done. Thanks. -Steve
Mar 24 2020
prev sibling next sibling parent Martin Tschierschke <mt smartdolphin.de> writes:
On Tuesday, 24 March 2020 at 15:03:33 UTC, Steven Schveighoffer 
wrote:
[...]
 I decided to build a "pre-compiler" for the templates, that 
 builds the cache files before the compilation step. In my 
 project, this lowered my build time from 38 seconds down to 11, 
 and the caching saves about 25% of the compiler memory 
 consumption.
[...]
 Thank you to Sönke for accepting this feature and the whole 
 vibe.d team for these great projects!

 -Steve

 [1] https://code.dlang.org/packages/diet-ng
 [2] https://code.dlang.org/packages/dietpc
Thank you! I still have to check it out and try, but it really looks like a way to speed up vibe.d development! Great! I took some time to work on the idea to structure my small project in a way, that it is split in very small modules including the diet templates, avoiding as much recompilation as possible, but the result until now not so convincing. Regards mt.
Apr 27 2020
prev sibling parent reply Greatsam4sure <greatsam4sure yahoo.com> writes:
On Tuesday, 24 March 2020 at 15:03:33 UTC, Steven Schveighoffer 
wrote:
 Since October I have been using an experimental feature I 
 created for the diet-ng package [1] that allows one to alter 
 just the HTML portions of a diet template and have the server 
 re-render those pages. It has saved me significant development 
 time as I can e.g. alter a class on an html element, add 
 javascript, just about anything that doesn't have to do with 
 running actual D code, and I do not need to rebuild my entire 
 application. Those of you who watched my dconf 2018 
 presentation may have heard me talk about the issue of vibe.d 
 build times.

 [...]
Thanks, the live mode is really lovely.it really saves a lot of time building your UI. Chrome and edge browser are not working on my windows 10 but firefox is working greatly. Maybe be I need to update them
Apr 29 2020
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 4/29/20 9:23 AM, Greatsam4sure wrote:
 On Tuesday, 24 March 2020 at 15:03:33 UTC, Steven Schveighoffer wrote:
 Since October I have been using an experimental feature I created for 
 the diet-ng package [1] that allows one to alter just the HTML 
 portions of a diet template and have the server re-render those pages. 
 It has saved me significant development time as I can e.g. alter a 
 class on an html element, add javascript, just about anything that 
 doesn't have to do with running actual D code, and I do not need to 
 rebuild my entire application. Those of you who watched my dconf 2018 
 presentation may have heard me talk about the issue of vibe.d build 
 times.

 [...]
Thanks, the live mode is really lovely.it really saves a lot of time building your UI. Chrome and edge browser are not working on my windows 10 but firefox is working greatly. Maybe be I need to update them
Nice! The live mode shouldn't affect what HTML is sent, it basically should be equivalent to the compiled mode. It just changes when the HTML strings are generated. If your browsers are not consistent, that strongly points to something outside diet-ng (perhaps something to do with your content). If you have a use case, I can look into it. -Steve
Apr 29 2020
parent reply Greatsam4sure <greatsam4sure yahoo.com> writes:
On Wednesday, 29 April 2020 at 13:43:12 UTC, Steven Schveighoffer 
wrote:
 On 4/29/20 9:23 AM, Greatsam4sure wrote:
 On Tuesday, 24 March 2020 at 15:03:33 UTC, Steven 
 Schveighoffer wrote:
 [...]
Thanks, the live mode is really lovely.it really saves a lot of time building your UI. Chrome and edge browser are not working on my windows 10 but firefox is working greatly. Maybe be I need to update them
Nice! The live mode shouldn't affect what HTML is sent, it basically should be equivalent to the compiled mode. It just changes when the HTML strings are generated. If your browsers are not consistent, that strongly points to something outside diet-ng (perhaps something to do with your content). If you have a use case, I can look into it. -Steve
For chrome and edge refresh does not effect changes in HTML content but restart
Apr 29 2020
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 4/29/20 1:25 PM, Greatsam4sure wrote:
 
 For chrome and edge refresh does not effect changes in HTML content but 
 restart
What about shift-refresh, which should reload the whole thing? Sometimes the caching gets in the way (it depends on the headers your server is sending). -Steve
Apr 29 2020
parent Greatsam4sure <greatsam4sure yahoo.com> writes:
On Wednesday, 29 April 2020 at 18:47:47 UTC, Steven Schveighoffer 
wrote:
 On 4/29/20 1:25 PM, Greatsam4sure wrote:
 
 For chrome and edge refresh does not affect changes in HTML 
 content but restart
What about shift-refresh, which should reload the whole thing? Sometimes the caching gets in the way (it depends on the headers your server is sending). -Steve
After a rebooting of my system, all browser now works
Apr 29 2020