threads, fibers and GPU kernels
Modern GPU have thousands of GPU kernels, it's far from CPU kernels, but it's interesting for me is there any chance that in future they be used in same maner as CPU kernels? If yes is there any reasons of exit for fibers? Or it would be easier to map one thread to one kernel? On system with 1k kernels/cores I do not see any reason for fibers for exiten. Also here was few topics about D3. But what about about you are thinging about threading model? I think in next 10 yers even CPU would have 32-64 cores.
Re: Visual Studio Code code-d serve-d beta release
Could anybody make Sublime plugin please?
Re: dlang-requetst: openssl 1.1 compatible release
Moving any third party code to std library have both "pro" and "contra" and it was discussed several times. From my point of view there is nothing wrong with modules outside of std library as long as these modules are visible to newcomers, well documented and have developer support. HTTP *very* important part in present time. Every modern language should have good native http-lib out of the box. I understand that it's can be done as outside module, but JSON also can be outside, and files can be outside. But I do not think that it's good idea. http-request is much more friendly and powerful than curl. It's much better to move curl as external package.
Re: dlang-requetst: openssl 1.1 compatible release
On Thursday, 3 August 2017 at 10:02:24 UTC, Temtaime wrote: On Thursday, 3 August 2017 at 09:57:11 UTC, Suliman wrote: On Thursday, 3 August 2017 at 06:33:38 UTC, ikod wrote: Hello, Since version 0.5.0 dlang-requests has become compatible with both 1.0.x and 1.1.x versions of openssl library. Please try and report any issues on github. Thanks! dlang-requests is HTTP/FTP client library, inspired by python-requests with goals: small memory footprint performance simple, high level API native D implementation https://code.dlang.org/packages/requests https://github.com/ikod/dlang-requests Vote for including it in Phobos instead curl! Curl is well-tested and has a great number of features. But it's native and I think it's already have 90% of futures needed in real-life. Community should force native libs, or D always would be languages that live only by C-bindings.
Re: dlang-requetst: openssl 1.1 compatible release
On Thursday, 3 August 2017 at 06:33:38 UTC, ikod wrote: Hello, Since version 0.5.0 dlang-requests has become compatible with both 1.0.x and 1.1.x versions of openssl library. Please try and report any issues on github. Thanks! dlang-requests is HTTP/FTP client library, inspired by python-requests with goals: small memory footprint performance simple, high level API native D implementation https://code.dlang.org/packages/requests https://github.com/ikod/dlang-requests Vote for including it in Phobos instead curl!
Redox + D
I think most of people have heard about https://redox-os.org It is pretty modern micro-kernel OS written in Rust. I am not Rust fan, but if it solve some low-level task and allow to build on top of it more hight-level tools why not to use it? Now it have port of GCC, Python and some other languages. Few days ago I wrote to Michael Aaron Murphy, man who did port of GCC and asked him about D. Here is his answer: "I wouldn't count out Rust as being too low level, as it has a lot of high level abstractions, and crates to provide even higher level abstractions for more specific fields. That said, when Redox becomes self-hosting, it should be capable of running any software that depends on libc, D included"
Why D have two function contains and canFind?
Why D have two function `contains` and `canFind` if C# have only contains and it's enough?
Re: How to replace pairs tags with regexp
On Friday, 21 July 2017 at 07:30:07 UTC, Antonio Corbi wrote: On Friday, 21 July 2017 at 07:08:34 UTC, Suliman wrote: On Friday, 21 July 2017 at 06:19:43 UTC, Suliman wrote: There reason of issue above is spaces before "#". What wrong with next regex https://dpaste.dzfl.pl/024a47ed2a56 I expect that it will select: #Header my header text ##SubHeader my sub header text Because: ^#{3} Have you tried https://regex101.com/ It gives you results and explanations about your regex in realtime. A. Corbi I tried. But I am getting different behavior in online editor and in the code.
Re: How to replace pairs tags with regexp
On Friday, 21 July 2017 at 06:19:43 UTC, Suliman wrote: There reason of issue above is spaces before "#". What wrong with next regex https://dpaste.dzfl.pl/024a47ed2a56 I expect that it will select: #Header my header text ##SubHeader my sub header text Because: ^#{3}
Re: How to replace pairs tags with regexp
There reason of issue above is spaces before "#".
Re: How to replace pairs tags with regexp
Ali Thanks! I opened answer form before you answered me!
Re: How to replace pairs tags with regexp
Question above do not actual now. Now I have got next problem. import std.stdio; import std.regex; import std.file; void main() { auto text = "#Header my header text ##SubHeader my sub header text ###Sub3Header my sub 3 text #Header2 my header2 text"; auto l1 = regex(`(^|\n)#([^#]*)\n([\^]*)(?=\n#[^#]|$)`, ['g', 'm']); foreach(t; text.matchAll(l1)) { writeln(t.hit); } } This code is print to console: #Header my header text How can I modify regex to get it print: #Header my header text ##SubHeader my sub header text ? I tried different combination, some of them are working in online regexp editors, but do not working in D.
How to replace pairs tags with regexp
I have got next code: import std.stdio; import std.regex; import std.file; void main() { auto text = readText("book.txt"); auto inlineCodeBlock = regex("`([^`\n]+)`"); auto bigCodeBlock = regex(r"`{3}[\s\S]*?`{3}"); foreach(t; text.matchAll(bigCodeBlock)) { string t1 = t.hit.replaceFirst(regex("`"),``); string t2 = t1.replaceFirst(regex("`"),``); } } Here I am replacing `foo` to foo. But got replaced data as copy, not in original document. But I need to get replacing in original document. replaceAll is not suitable for it because it's not clear how to get open and close tags ( and ).
Re: DMD library available as DUB package
Could you explain where it can be helpful?
Re: Need help to get OpenSSL 64 work on Windows x64 | I hate D's GC!
On Friday, 14 July 2017 at 14:50:04 UTC, bauss wrote: On Friday, 14 July 2017 at 13:16:17 UTC, Suliman wrote: It's look that GC in D is really suxx. There is already second toy-project where I am getting stuck on Windows with D for last 3 month. I'm using 32-bit build, because I can't understand which libs I should use to get OpenSSL 64 bit work with dlang-request. 32-bit version compile and works fine, but it's fail during downloading 300MB file with next error: core.exception.OutOfMemoryError@src\core\exception.d(696): Memory allocation failed You might wanna read the file in chunks and write in chunks. It's helped, but it's obviously that D on Windows should have 64-bit linker out of the box. Because GC on 32-bit machine show a lot of bugs.
Need help to get OpenSSL 64 work on Windows x64 | I hate D's GC!
It's look that GC in D is really suxx. There is already second toy-project where I am getting stuck on Windows with D for last 3 month. I'm using 32-bit build, because I can't understand which libs I should use to get OpenSSL 64 bit work with dlang-request. 32-bit version compile and works fine, but it's fail during downloading 300MB file with next error: core.exception.OutOfMemoryError@src\core\exception.d(696): Memory allocation failed code: import std.stdio; import std.conv; import std.file; import std.path; import std.string; import std.algorithm; import std.regex; import requests; pragma(lib, "ssl"); pragma(lib, "eay"); void main() { string login = "Suliman1"; string pass = "Infinity8"; //* string url = "https://n5eil01u.ecs.nsidc.org/SMAP/SPL3SMP_E.001/2017.07.11/;; Request request; request.addHeaders(["User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0"]); request.authenticator = new BasicAuthentication(login, pass); auto rs = request.get(url); string content = to!string(rs.responseBody); string fname = content.matchFirst(`(SMAP_[^"]+)`).hit; string h5_file = url ~ fname; string isoXML_file = url ~ fname ~ `.iso.xml`; string qa_file = url ~ fname.replace(`h5`, `qa`); string [] arrayFullURLs; arrayFullURLs ~= h5_file; arrayFullURLs ~= isoXML_file; arrayFullURLs ~= qa_file; foreach(f; arrayFullURLs) { writeln("Loading file: ", f); auto rs1 = request.get(f); File file = File(baseName(f), "w"); file.write(rs1.responseBody); } } dub.sdl: name "parser" dependency "requests" version="~>0.4.2" dependency "progress" version="~>4.0.3" -- * please do now hack account because I publish this pass to get it's reproduce error easier. So could anybody explain step-by-step how to get OpenSSL 64 work on 64-bit Windows. On my PC this app eat 500MB of RAM and then failure with error above.
Re: How to add authentificaion method to request?
Compiler require libssl32.dll for run dlang-request based app. Where I can get it? I installed, OpenSSL, but can't find this lib in C:\OpenSSL-Win64
How to add authentificaion method to request?
I am using dlang-requests. I need authentificate on https://scihub.copernicus.eu/dhus/login and than do some data-parsing. MultipartForm form; form.add(formData("login_username", "Suliman")); form.add(formData("login_password", "123")); // changed auto content = postContent("https://scihub.copernicus.eu/dhus/login;, form); writeln("Output:"); writeln(content); Return error about login pass. So it's seems that I need to add BasicAuthentication method type. But how to add it? Browser console show next: https://snag.gy/VXaq2R.jpg
Re: Compile without generating code
On Wednesday, 5 July 2017 at 22:05:53 UTC, Stefan Koch wrote: On Wednesday, 5 July 2017 at 21:58:45 UTC, Lewis wrote: I was reading https://blog.rust-lang.org/2017/07/05/Rust-Roadmap-Update.html, which mentioned that the Rust compiler now has a mode to go through the motions of compiling and show errors, but without generating any code. This way you can do a much faster build while iterating until you have no compile errors, then do a single build with code generation once everything looks good. [...] We already have it. use -o- and it'll disable codegen. How to use this parameter with dub?
Re: Diet template is crush
It's look like issue in another part of code...
Diet template is crush
I can't understand why follow code is crushing: string error = "503 Server error!"; int error_code = 503; res.render!("error.dt", error, error_code); on res string (last in code above) I am getting error: CoreTaskFiber was terminated unexpectedly: Access Violation error.dt http://paste.code123.org/91ea2dc1-7396 If delete part: div.errorPageText #{error} div.errorPageImg - if (error_code == 404) img(src='img/error_404.png') - else img(src='img/error_503.png') All work fine. It's seems that something wrong with args `error, error_code`.
Re: past.code123.org new service for sharing D code.
On Saturday, 24 June 2017 at 12:59:50 UTC, Suliman wrote: Sorry! Domain should be not `past` `but` `paste` http://paste.code123.org/ version 0.2 split-view support: http://paste.code123.org/86fc5ded-90e1 P.S. WIP
Re: past.code123.org new service for sharing D code.
Sorry! Domain should be not `past` `but` `paste` http://paste.code123.org/
past.code123.org new service for sharing D code.
http://past.code123.org/ I did small paste-bin service for sharing D code. Now it's deep alpha it's powered by vibed. It's simply works and nothing more. It's support basic syntax highlighting (after page refresh) for few language besides D. I hope to finish it in next few days, but you can try use it's now. I do not plan to touch DB.
How to add class in DIET template
I need to get external variable and make class by it's value - string mystr = "lng-" ~ language; - foreach(i, line; arrayOfLines ) li code.mystr #{line} I need to get HTML code like this: some D code But class name become "mystr" and I am getting: some D code How to fix it?
Re: Isn't it about time for D3?
But C++ will still be big in 10 years. Ok, let's assume it will be poplar in 10 years. But it's very short time. D exists almost 17 years. And not every people need to interfacing with C/C++. For me it's more important to have static-typing and compilable alternative to Python. And a lot of people whom I know want same.
Re: Isn't it about time for D3?
Why for example not Rust (i am not its fan). I do not see any real perspective in C++. What to do in next 5 years if C++ will start loosing it's popularity? Implement D4? Plus any backwards compatibility make implementation new ideas in language very hard.
Re: Isn't it about time for D3?
On Saturday, 17 June 2017 at 04:32:41 UTC, Liam McGillivray wrote: On Wednesday, 14 June 2017 at 12:08:16 UTC, Mike wrote: > THINGS TO DROP -- * C++ interoperabiliy Walter's right: memory safety is going to kill C and C++ will go with it. Don't waste time on this; it's not going to matter in 10 or 20 years. Totally agree! C++ now in 90% of cases is legacy projects. At current time is more important to out of the box interoperability with Rust or Julia. Time show that C++ do not want to migrate to D. Only few people come from C++ world, because all of them waiting of new C++ standard c++x2035 (or whatever)
Re: Replacing Make for the DMD build
Also looks good https://github.com/jasonwhite/button
Re: Isn't it about time for D3?
Should D really move to GC-free? I think there is already enough GC-free language on the market. D even now is very complected language, and adding ways to manually managing memory will make it's more complicated. A lot of people need more powerful static-typing alternative to Python/C# for common tasks that allow to build stand-alone executable files. I think it's bad idea to mix to paradigms. People who do not need GC at all already use Rust.
Re: Isn't it about time for D3?
There is already something like D3 exists. https://github.com/VoltLang
Re: How to cleanup array of structs?
// Will reuse the array, overwriting existing data. // If other parts of the program are using existing data // in the array, this will lead to hard-to-track-down bugs. mytracks.length = 0; mytracks.assumeSafeAppend(); Could you give an example where it can lead bugs? Do you mean multi-thread apps?
How to cleanup array of structs?
I remember that there was topic about remobing data from struct/arrays of structs. But I do not remember what is idiomatic way to do it, and can't google it. something like: struct MyTrack { ulong id; string recordDate; int velocity; int maxAllowedSpeedForRoad; } MyTrack mytrack; MyTrack [] mytracks; // filling mytracks.clean() or what?
Re: Best way for handle missing args in REST interface in vibed
I had post question here http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/43511/
Re: Best way for handle missing args in REST interface in vibed
@rootPathFromName interface API { @path("mytrack") @method(HTTPMethod.GET)Json doTrackSpeedAnalyze(int trackid, string startDateTime, string endDateTime); } class MyRouter : API { Config config; Database database; this(Config config, Database database) { this.config = config; this.database = database; } @path("/") void foo(string _error = null) // I expect that this will be called if exception happen in doTrackSpeedAnalyze { writeln("Error in console"); // does not writing on console } override: @errorDisplay!foo Json doTrackSpeedAnalyze(int trackid, string startDateTime, string endDateTime) // /api/mytrack?trackid=123=2000=2010 { if(endDateTime == "0") { throw new Exception("Some fields are empty"); } return Json.emptyObject; } } What I am doing wrong? Should I do override for foo? Should foo present in `interface`?
Re: Best way for handle missing args in REST interface in vibed
I wrote next code: void foo(string _error = null) { writeln("Error"); } override: @errorDisplay!foo Json doTrackSpeedAnalyze(int trackid, string startDateTime, string endDateTime) // /api/mytrack?trackid=123=2000=2010 { if(endDateTime.length == 0) { throw new Exception("End Date must not be empty"); } return Json.emptyObject; } If I access to url: /api/mytrack?trackid=123=2000 (witout endDateTime) I am expecting execution foo() block, but it does not happens. Why? And what do Exception here? Why should handle it?
Re: Best way for handle missing args in REST interface in vibed
On Monday, 29 May 2017 at 12:23:59 UTC, Suliman wrote: I am doing REST interface with vibed. And thinking about handling errors, if users forgot to pass all expected args in function. For example: foo(int x, int y) // get request { } /api/foo?x=111 And if user is forgot to pass `y` we will get error in the browser. What is the right way to handle curch cases? Wrap is with try-catch looks wrong. It's seems I found how to do it http://vibed.org/api/vibe.web.web/errorDisplay
Best way for handle missing args in REST interface in vibed
I am doing REST interface with vibed. And thinking about handling errors, if users forgot to pass all expected args in function. For example: foo(int x, int y) // get request { } /api/foo?x=111 And if user is forgot to pass `y` we will get error in the browser. What is the right way to handle curch cases? Wrap is with try-catch looks wrong.
Re: Faster Command Line Tools in D
std.string, std.array, and std.algorithm all have cross-polination when it comes to array operations. It has to do with the history of when the modules were introduced. Is there any plan to deprecate all splitters and make one single. Because now as I understand we have 4 functions that make same task.
Re: Anyone tried to emscripten a D/SDL game?
On Wednesday, 24 May 2017 at 17:06:55 UTC, Guillaume Piolat wrote: On Wednesday, 24 May 2017 at 17:00:51 UTC, Nick Sabalausky "Abscissa" wrote: Anyone have any experience (successful or unsuccessful) attempting this? Any info on the current state of it, or pitfalls, or pointers for getting started? http://code.alaiwan.org/wp/?p=103 It's seems that Dart can be compiled to WASM https://medium.com/dartlang/dart-on-llvm-b82e83f99a70 It's it's possible to do same with D?
Re: Trip notes from Israel
On Monday, 22 May 2017 at 15:12:42 UTC, Andrei Alexandrescu wrote: On 05/22/2017 11:05 AM, Andrei Alexandrescu wrote: http://dlang.org/blog/2017/05/22/introspection-introspection-everywhere/ -- Andrei Submitted to reddit as well: https://www.reddit.com/r/programming/comments/6cntso/from_the_d_blog_introspection_introspection/ -- Andrei Perfect! I have been in Weka.IO in this january too! Big thanks guys!
Getopt default int init and zero
I would like to check if user specified `0` as getopt parameter. But the problem that `int`'s are default in `0`. So if user did not specified nothing `int x` will be zero, and all other code will work as if it's zero. In std.typecons I found Nullable that allow init int to zero. I tried to do: Nullable!int dateInterval; try { auto helpInformation = getopt(args, "interval|i", "Interval of selection in dayes", ); } But I am getting error: conv.d(194,24): Error: template std.conv.toImpl cannot deduce function from argument types !(Nullable!int)(string), candidates are: conv.d(435,11):std.conv.toImpl(T, S)(S value) if (isImplicitlyConvertible!(S, T) && !isEnumStrToStr!(S, T) && !isNullToStr!(S, T)) conv.d(549,11):std.conv.toImpl(T, S)(ref S s) if (isStaticArray!S) conv.d(565,11):std.conv.toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, T) && is(typeof(S.init.opCast!T()) : T) && !isExactSomeString!T && !is(typeof(T(value conv.d(616,11):std.conv.toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, T) && is(T == struct) && is(typeof(T(value conv.d(665,11):std.conv.toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, T) && is(T == class) && is(typeof(new T(value conv.d(194,24):... (9 more, -v to show) ... getopt.d(894,56): Error: template instance std.conv.to!(Nullable!int).to!string error instantiating getopt.d(749,46):instantiated from here: handleOption!(Nullable!int*) getopt.d(758,23):instantiated from here: getoptImpl!(string, string, Nullable!int*, string, string, bool*) getopt.d(436,15):instantiated from here: getoptImpl!(string, string, int[]*, string, string, Nullable!int*, string, string, bool*) source\app.d(41,32):instantiated from here: getopt!(string, string, int[]*, string, string, Nullable!int*, string, string, bool*)
Re: dmd download spike
How often the stat are recalculating?
Re: "Programming in D" is up-to-date
On Saturday, 13 May 2017 at 23:22:41 UTC, Ali Çehreli wrote: I've updated the book to 2.074.0. I've updated all paper and electronic versions at all publishers. However, I recommend that you wait a week or so before ordering (e.g. from Amazon) so that you get the latest version. (The copyright and Preface pages should say May 2017.) You can download the up-to-date versions here: http://ddili.org/ders/d.en/index.html The fonts are indeed embedded in the PDF, EPUB, and AZW3 formats. You may have to experiment with configuration settings of your e-reader to enable the embedded fonts. YMMV. :/ Ali Big thanks!!!
How to write parser?
I am trying to learn how to write text parser. I have example doc with follow format: #Header my header text ##SubHeader my sub header text ###Sub3Header my sub 3 text #Header21 my header2 text ##SubHeader21 my header2 text ###SubHeader22 my header3 text I would like to wrap all level(#) tags to HTML div's, to get it's look like: #Header my header text ##SubHeader my sub header text ###Sub3Header my sub 3 text #Header21 my header2 text ##SubHeader21 my header2 text ###SubHeader22 my header3 text It's seems that I wrong understand parser logic. I am trying to do it's in next way: bool isH1Open; bool isH2Open; bool isH3Open; string newcontent; foreach(line; content.lineSplitter) { if(line.length > 3) // to prevent access to line < 3 symblos { if(!isH1Open && line[0] == '#' && line[1] != '#') { isH1Open = true; line = `` ~ "\n" ~ line ; newcontent ~= line; continue; } if(isH2Open && line[1] == '#' && line[2] != '#') { isH2Open = false; line = "\n" ~ `` ~ "\n"; newcontent ~= line; continue; } if(isH1Open && line[0] == '#' && line[1] != '#') { isH1Open = false; line = "\n" ~ `` ~ "\n"; newcontent ~= line; continue; } if(!isH2Open && line[1] == '#' && line[2] != '#') { isH2Open = true; line = "\n" ~ `` ~ "\n" ~ line ; newcontent ~= line; continue; } } But I am getting wrong output: #Header ##SubHeader #Header31 ##SubHeader31 it's there any better way to parse such format?
Re: File Input
On Sunday, 7 May 2017 at 13:57:47 UTC, JV wrote: Hi guys I'd like to know how to get an input from the user to be stored in a .txt file using import std.file and is it possible to directly write in a .txt file without using a variable to store the user input? Thanks for the answer in advance my mind is kinda jumbled about this since im new to this language. http://nomad.so/2015/09/working-with-files-in-the-d-programming-language/
Re: problem with std.variant rounding
On Tuesday, 2 May 2017 at 08:02:23 UTC, Suliman wrote: On Saturday, 29 April 2017 at 08:57:09 UTC, Petar Kirov [ZombineDev] wrote: On Friday, 28 April 2017 at 18:08:38 UTC, H. S. Teoh wrote: On Fri, Apr 28, 2017 at 04:42:28PM +, via Digitalmars-d-learn wrote: [...] writefln(text("%.", i, "f"), x); [...] There's no need to use text() here: writefln("%.*f", i, x); does what you want. T Thanks, I missed the fact that * could be used for specifying the precision, in addition to the width. I need co concatenate string with variant type (I am doing SQL query). What is the best way to put it? It's seems that if I am doing simple `replace` string sql = "..." sql.replace(`37.72308`, to!string(cargpspoint.lon)).replace(`55.47957`, to!string(cargpspoint.lat)) I am loosing accuracy. Is there any better way? I did: sql_distance.replace(`37.72308`, format("%f",cargpspoint.lon)) It's seems that it's work ok. But is there any better way, or it's ok?
Re: problem with std.variant rounding
On Saturday, 29 April 2017 at 08:57:09 UTC, Petar Kirov [ZombineDev] wrote: On Friday, 28 April 2017 at 18:08:38 UTC, H. S. Teoh wrote: On Fri, Apr 28, 2017 at 04:42:28PM +, via Digitalmars-d-learn wrote: [...] writefln(text("%.", i, "f"), x); [...] There's no need to use text() here: writefln("%.*f", i, x); does what you want. T Thanks, I missed the fact that * could be used for specifying the precision, in addition to the width. I need co concatenate string with variant type (I am doing SQL query). What is the best way to put it? It's seems that if I am doing simple `replace` string sql = "..." sql.replace(`37.72308`, to!string(cargpspoint.lon)).replace(`55.47957`, to!string(cargpspoint.lat)) I am loosing accuracy. Is there any better way?
Re: problem with std.variant rounding
On Friday, 28 April 2017 at 16:49:18 UTC, kinke wrote: On Friday, 28 April 2017 at 16:24:55 UTC, Suliman wrote: import std.stdio; import std.variant; void main() { Variant b = 56.051151; float x = b.coerce!float; writeln(x); } 56.0512 void main() { import core.stdc.stdio; import std.stdio; double d = 56.051151; writeln(d); printf("%g %f %a\n\n", d, d, d); real r = 56.051151L; writeln(r); printf("%Lg %Lf %La\n", r, r, r); } => 56.0512 56.0512 56.051151 0x1.c068c1db0142fp+5 56.0512 56.0512 56.051151 0x1.c068c1db0142f61ep+5 So using write[ln]() to check floating-point values isn't a good idea as you may lose precision; hex formatting (or a proper debugger) is a much better choice. Additionally, your value isn't *exactly* representable; you may want to read up on floating-point representations if that's unclear. Yeah! It was issue with rounding during writeln
Re: problem with std.variant rounding
On Friday, 28 April 2017 at 15:45:25 UTC, Suliman wrote: I am using https://github.com/mysql-d/mysql-native It's return from DB variant data-type. My DB include value: 56.051151 (double type in DB) I need to extract it. I tried several variants: writeln(point[3].coerce!float); writeln(point[3].coerce!string); writeln(point[3].coerce!double); but all of them return me it as: 56.0512 How to return exactly 56.051151 ? import std.stdio; import std.variant; void main() { Variant b = 56.051151; float x = b.coerce!float; writeln(x); } 56.0512
problem with std.variant rounding
I am using https://github.com/mysql-d/mysql-native It's return from DB variant data-type. My DB include value: 56.051151 (double type in DB) I need to extract it. I tried several variants: writeln(point[3].coerce!float); writeln(point[3].coerce!string); writeln(point[3].coerce!double); but all of them return me it as: 56.0512 How to return exactly 56.051151 ?
Re: Can't break App execution by ctrl+c
Just catch the empty result exception. I do not want to go to catch block if I have empty result. I just want to get there if any other error type occur. If result is empty that simply skip this step.
Re: Can't break App execution by ctrl+c
On Thursday, 27 April 2017 at 12:25:11 UTC, Adam D. Ruppe wrote: On Thursday, 27 April 2017 at 12:17:12 UTC, Suliman wrote: Before my code handle empty result in `catch` block. You must be catching the ctrl+c exception... don't do that. Just catch the empty result exception. The issue is gone after removing http://code.dlang.org/packages/consoled it's look like that it's produced error. Now ctrl+c is woking fine...
Can't break App execution by ctrl+c
Before my code handle empty result in `catch` block. Then I moved it's checking to main loop, and now I can't abort App execution by ctrl+c. It's simply continue working. Here is my code: foreach(cargpspoint; cargpspoints) { auto cmd_dist = new PGCommand(pgconnection, sql_query)); try { auto nresult = cmd_dist.executeQuery(); auto nanswer = nresult.array; nresult.close(); if(nanswer.empty) { continue; } } OS: Windows.
Re: How to fix date format?
On Wednesday, 26 April 2017 at 05:21:32 UTC, Jonathan M Davis wrote: On Wednesday, April 26, 2017 04:02:12 Suliman via Digitalmars-d-learn wrote: I tried to do: writeln(DateTime.toISOExtString(DateTime.fromSimpleString(point[1].coerce! string))); But got error: Error: function std.datetime.DateTime.toISOExtString () const is not callable using argument types (DateTime) Error: function database.Database.getSingleTrackInfo no return exp; or assert(0); at end of function toISOExtString is a normal member function on DateTime, not a static member function. If point[1].coerce!string is giving you a string in Boost's "simple time" format (e.g. "2016-Jan-04 12:19:17"), then DateTime.fromSimpleString(point[1].coerce!string) will give you a DateTime. Then if you called toISOExtString() on that, e.g. DateTime dt = DateTime.fromSimpleString(point[1].coerce!string); string str = dt.toISOExtString(); then the string would be in the ISO extended format (e.g. "2016-01-04T12:19:17"). If you then wanted that in the format "2016-01-04 12:19:17", then you could just replace the 'T' with ' ', e.g. DateTime dt = DateTime.fromSimpleString(point[1].coerce!string); string str = dt.toISOExtString().replace("T", " "); And if you have "2016-01-04 12:19:17", and you want to convert that to the Boost simple time format, you could do DateTime dt = DateTime.fromISOExtString(str.replace(" ", "T")) auto simpleStr = dt.toSimpleString(); Hopefully, that helps. - Jonathan M Davis Thanks! That's work! But why I can't do it in single line like: string dt = DateTime.toISOExtString(DateTime.fromSimpleString(point[1].coerce!string)); "Error: function std.datetime.DateTime.toISOExtString () const is not callable using argument types (DateTime)" And should do: DateTime dt = DateTime.fromSimpleString(point[1].coerce!string); string str = dt.toISOExtString();
Re: How to fix date format?
I tried to do: writeln(DateTime.toISOExtString(DateTime.fromSimpleString(point[1].coerce!string))); But got error: Error: function std.datetime.DateTime.toISOExtString () const is not callable using argument types (DateTime) Error: function database.Database.getSingleTrackInfo no return exp; or assert(0); at end of function
Re: How to fix date format?
On Tuesday, 25 April 2017 at 20:10:02 UTC, Jonathan M Davis wrote: On Tuesday, April 25, 2017 17:41:25 Suliman via Digitalmars-d-learn wrote: I am using mysql native. Date in DB have next format: 2016-11-01 06:19:37 But every tile when I am trying to get it I am getting such format: 2016-Oct-31 15:37:24 I use next code: writeln(point[1].coerce!string); Why coerce is forcing format changing? How I can extract result as without month name between digits or easily convert it in proper data format? What types are dealing with here? What is point[1]? - Jonathan M Davis writeln(point[1].coerce!string); writeln(point[1].type); std.datetime.DateTime std.variant.VariantN!20LU.VariantN
How to fix date format?
I am using mysql native. Date in DB have next format: 2016-11-01 06:19:37 But every tile when I am trying to get it I am getting such format: 2016-Oct-31 15:37:24 I use next code: writeln(point[1].coerce!string); Why coerce is forcing format changing? How I can extract result as without month name between digits or easily convert it in proper data format?
Why File is exists in std.stdio and in std.file?
Just interesting. Is there any rational reasons for this decision?
Re: Vibed + osv.io
On Monday, 24 April 2017 at 15:10:29 UTC, Suliman wrote: I have found very interesting project http://osv.io Has anybody to use it with vibed? I am not sure if it's yet-another-linux distrib or OS written from scratch. I found link on Redox page https://github.com/redox-os/redox/issues/925 It would be nice to have way to get run vibed from something very lightweight. Am I right understand that if Redox have port of libc it would be possible to write D apps for Redox?
Vibed + osv.io
I have found very interesting project http://osv.io Has anybody to use it with vibed? I am not sure if it's yet-another-linux distrib or OS written from scratch. I found link on Redox page https://github.com/redox-os/redox/issues/925 It would be nice to have way to get run vibed from something very lightweight.
Re: The app hanging after reach 1750MB of RAM
The problem is solved. See for more detail https://github.com/mysql-d/mysql-native/issues/104
Re: {OT} Youtube Video: newCTFE: Starting to write the x86 JIT
On Thursday, 20 April 2017 at 12:56:11 UTC, Stefan Koch wrote: Hi Guys, I just begun work on the x86 jit backend. Because right now I am at a stage where further design decisions need to be made and those decisions need to be informed by how a _fast_ jit-compatible x86-codegen is structured. Since I do believe that this is an interesting topic; I will give you the over-the-shoulder perspective on this. At the time of posting the video is still uploading, but you should be able to see it soon. https://www.youtube.com/watch?v=pKorjPAvhQY Cheers, Stefan Could you explain where it can be helpful?
Re: The app hanging after reach 1750MB of RAM
On Wednesday, 19 April 2017 at 15:18:32 UTC, crimaniak wrote: On Tuesday, 18 April 2017 at 11:43:24 UTC, Suliman wrote: I am writing app that extract data from DB to array of structures. void getSingleTrackInfo() { foreach(item; getTablesGPSSensorList) { ResultRange result = mysqlconnection.query(sqlquery); auto MySQLPointsLonLat = result.array; Is ResultRange closing query when exhausted? Did you try to call .close() on it after work? Yes I tried: ResultRange result = mysqlconnection.query(sqlquery); auto MySQLPointsLonLat = result.array; result.close(); Did not help :(
Re: The app hanging after reach 1750MB of RAM
I have added GC.stat https://dlang.org/library/core/memory/gc.stats.html here the result: freeSize: 49698640 | usedSize: 170502320 freeSize: 41174592 | usedSize: 217823680 freeSize: 53868576 | usedSize: 247072736 freeSize: 86494800 | usedSize: 307769776 freeSize: 58176640 | usedSize: 499665792 freeSize: 148233232 | usedSize: 534389744 freeSize: 148141376 | usedSize: 534481600 freeSize: 108467312 | usedSize: 641264528 freeSize: 55118432 | usedSize: 694613408 freeSize: 80579472 | usedSize: 803370096 freeSize: 7880 | usedSize: 1006831680 freeSize: 291629360 | usedSize: 860755664 freeSize: 242912736 | usedSize: 976581152 freeSize: 241673232 | usedSize: 977820656 freeSize: 168092160 | usedSize: 1118510592 freeSize: 128405616 | usedSize: 1426632592 freeSize: 73146272 | usedSize: 1616109664 freeSize: 17962320 | usedSize: 1671293616 freeSize: 20342912 | usedSize: 1736021888 on the last value app is hanging.
Re: The app hanging after reach 1750MB of RAM
auto mymem = cargpspoints.length * typeof(cargpspoints[0]).sizeof; writeln(mymem); And it's print: 16963440 it's about 16MB... What is takes all other memory? 1. You're measuring it wrong. Array length is already measured in terms of type size. So should I do: cargpspoints.length * cargpspoints[0].sizeof ? Btw, `cargpspoints.length * typeof(cargpspoints[0]).sizeof` and `cargpspoints.length * cargpspoints[0].sizeof` show same result.
Re: The app hanging after reach 1750MB of RAM
On Tuesday, 18 April 2017 at 14:15:59 UTC, Stanislav Blinov wrote: On Tuesday, 18 April 2017 at 14:09:28 UTC, Stanislav Blinov wrote: foreach(row; result) { arr ~= row.toStruct(cargpspoint); } Sorry, this should be foreach(row; result) { row.toStruct(cargpspoint); arr ~= cargpspoint; } Thanks I will try! But why in my code memory do not released? Do you have any idea?
Re: The app hanging after reach 1750MB of RAM
Also I can't understand why app take so much memory? I checked array of structures size with this code: auto mymem = cargpspoints.length * typeof(cargpspoints[0]).sizeof; writeln(mymem); And it's print: 16963440 it's about 16MB... What is takes all other memory?
The app hanging after reach 1750MB of RAM
I am writing app that extract data from DB to array of structures. void getSingleTrackInfo() { foreach(item; getTablesGPSSensorList) { ResultRange result = mysqlconnection.query(sqlquery); auto MySQLPointsLonLat = result.array; carGPSPoint cargpspoint; // create struct carGPSPoint [] cargpspoints; // create array of structures foreach(i, point;MySQLPointsLonLat) { cargpspoint.id = point[0].coerce!ulong; cargpspoint.recordDate = point[1].coerce!string; cargpspoint.velocity = point[2].coerce!double; cargpspoint.lat = point[3].coerce!string; cargpspoint.lon = point[4].coerce!string; cargpspoints ~=cargpspoint; } } } I expected that on every step: `foreach(item; getTablesGPSSensorList)` structures `carGPSPoint` will be recreated and memory will be free. But App after starting begin eat memory, and do it till reach 1750 of RAM. After it it's not crush, but simply stop other processing. 1. By the code on every iterate `carGPSPoint` should be recreated and memory should be free, why this does not happen? 2. How to free my memory?
Re: Can't build simple project. Very strange errors
On Friday, 14 April 2017 at 15:53:18 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 15:42:33 UTC, Suliman wrote: On Friday, 14 April 2017 at 15:40:18 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 15:31:21 UTC, Suliman wrote: On Friday, 14 April 2017 at 15:22:49 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 09:49:09 UTC, Suliman wrote: on: dub build --compiler=ldc2 link OPTLINK (R) for Win32 Release 8.00.17 Optlink isn't able to link object files produced by ldc. Could you try an x64_86 build? You'll need the Microsoft linker. I do not have VS on my PC :( You don't need VS, the Windows SDK should be fine too. It's a free download :) How to check if it's installed and how to use linker from it? If it's installed you can find it in the programs and features list as 'Windows Software Development Kit for Windows X'. The DMD installer will look for it during installation, so reinstalling DMD after installing the SDK should work. I'm not sure how LDC does it, but last time I installed LDC it also just worked. I checked, it's installed. I reinstall dmd, but got same error with linker.
Re: Can't pass data from filter to each
New question. Can I put result of filtering in itself without creation of new variables like x: auto x = MySQLTablesRange.array.filter!(a=>a[0].coerce!string.canFind("_"));
Can't pass data from filter to each
I am writing lambda function. I need filter data at first step and than do dome operation on them (for start simply print on the screen. I wrote next code: MySQLTablesRange.filter!(a=>a[0].coerce!string.canFind("_")).each!(a => to!int(a[0].coerce!string.split("_")[1]).writeln); But it's seem that each do not handle any data. I tested if data is corectly filtered and next code successfully print it's output. auto t = MySQLTablesRange.array.filter!(a=>a[0].coerce!string.canFind("_")); t.each!(a=>a[0].coerce!string.writeln); But what is wrong with first code?
Re: Why map return [] ?
On Friday, 14 April 2017 at 15:55:13 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 15:49:00 UTC, Suliman wrote: I found problem! ResultRange should be converted to array before it can be `map`ed That shouldn't be necessary. Can you post your complete code? ResultRange MySQLTablesRange = mysqlconnection.query(`SELECT table_name FROM information_schema.tables;`); auto x = MySQLTablesRange.map!(a=>a[0].coerce!string.split("_")[1]); writeln(x); output: [] while: MySQLTablesRange.array.map!... output result
Re: Why map return [] ?
On Friday, 14 April 2017 at 15:38:19 UTC, Suliman wrote: On Friday, 14 April 2017 at 15:35:15 UTC, cym13 wrote: On Friday, 14 April 2017 at 15:29:33 UTC, Suliman wrote: auto x = MySQLTablesRange.map!(a=>a); writeln(x); return: [] while next code: MySQLTablesRange.each!(a=>a.writeln); return data line by line. Why? What library is that supposed to be? http://code.dlang.org/packages/mysql-native I found problem! ResultRange should be converted to array before it can be `map`ed
Re: Can't build simple project. Very strange errors
On Friday, 14 April 2017 at 15:40:18 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 15:31:21 UTC, Suliman wrote: On Friday, 14 April 2017 at 15:22:49 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 09:49:09 UTC, Suliman wrote: on: dub build --compiler=ldc2 link OPTLINK (R) for Win32 Release 8.00.17 Optlink isn't able to link object files produced by ldc. Could you try an x64_86 build? You'll need the Microsoft linker. I do not have VS on my PC :( You don't need VS, the Windows SDK should be fine too. It's a free download :) How to check if it's installed and how to use linker from it?
Re: Why map return [] ?
On Friday, 14 April 2017 at 15:35:15 UTC, cym13 wrote: On Friday, 14 April 2017 at 15:29:33 UTC, Suliman wrote: auto x = MySQLTablesRange.map!(a=>a); writeln(x); return: [] while next code: MySQLTablesRange.each!(a=>a.writeln); return data line by line. Why? What library is that supposed to be? http://code.dlang.org/packages/mysql-native
Re: Can't build simple project. Very strange errors
On Friday, 14 April 2017 at 15:22:49 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 09:49:09 UTC, Suliman wrote: on: dub build --compiler=ldc2 link OPTLINK (R) for Win32 Release 8.00.17 Optlink isn't able to link object files produced by ldc. Could you try an x64_86 build? You'll need the Microsoft linker. I do not have VS on my PC :(
Why map return [] ?
auto x = MySQLTablesRange.map!(a=>a); writeln(x); return: [] while next code: MySQLTablesRange.each!(a=>a.writeln); return data line by line. Why?
Re: Can't build simple project. Very strange errors
On Friday, 14 April 2017 at 10:40:00 UTC, Suliman wrote: I checked all possible combination of dmd and vibed (0.7.30 brunch). No result. Only a little bit another error: Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html .dub\build\application-debug-windows-x86-dmd_2073-5BBFAE5ECCC36FEC42565956CE2F0D0A\roadpoint.obj(roadpoint) Error 42: Symbol Undefined _D4vibe4http6serv╤10listenHTTPFCАТЯ8АДЩSАЕМщttingsАТж24АКжRequestHandlerZSАТ╙2АДнLАЕЎer .dub\build\application-debug-windows-x86-dmd_2073-5BBFAE5ECCC36FEC42565956CE2F0D0A\roadpoint.obj(roadpoint) Error 42: Symbol Undefined _D4vibe4http6router9URLRouter7__ClassZ .dub\build\application-debug-windows-x86-dmd_2073-5BBFAE5ECCC36FEC42565956CE2F0D0A\roadpoint.obj(roadpoint) Error 42: Symbol Undefined _D4vibe4http6router9URLRouter6__ctorMFAyaZC4vibe4http6router9URLRouter .dub\build\application-debug-windows-x86-dmd_2073-5BBFAE5ECCC36FEC42565956CE2F0D0A\roadpoint.obj(roadpoint) Error 42: Symbol Undefined _D4vibe4http6server18HTTPServerSettings7__ClassZ .dub\build\application-debug-windows-x86-dmd_2073-5BBFAE5ECCC36FEC42565956CE2F0D0A\roadpoint.obj(roadpoint) Error 42: Symbol Undefined _D4vibe4http6server18HTTPServerSettings6__ctorMFZC4vibe4http6server18HTTPServerSettings .dub\build\application-debug-windows-x86-dmd_2073-5BBFAE5ECCC36FEC42565956CE2F0D0A\roadpoint.obj(roadpoint) Error 42: Symbol Undefined _D4vibe3web10validation10ValidEmail11__xopEqualsFKxS4vibe3web10validation10ValidEmailKxS4vibe3web10validation10ValidEmailZb I can build project only in release mode with: `dub --build=release` Otherwise I am getting errors descripted above
Re: Can't build simple project. Very strange errors
I checked all possible combination of dmd and vibed (0.7.30 brunch). No result. Only a little bit another error: Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html .dub\build\application-debug-windows-x86-dmd_2073-5BBFAE5ECCC36FEC42565956CE2F0D0A\roadpoint.obj(roadpoint) Error 42: Symbol Undefined _D4vibe4http6serv╤10listenHTTPFCАТЯ8АДЩSАЕМщttingsАТж24АКжRequestHandlerZSАТ╙2АДнLАЕЎer .dub\build\application-debug-windows-x86-dmd_2073-5BBFAE5ECCC36FEC42565956CE2F0D0A\roadpoint.obj(roadpoint) Error 42: Symbol Undefined _D4vibe4http6router9URLRouter7__ClassZ .dub\build\application-debug-windows-x86-dmd_2073-5BBFAE5ECCC36FEC42565956CE2F0D0A\roadpoint.obj(roadpoint) Error 42: Symbol Undefined _D4vibe4http6router9URLRouter6__ctorMFAyaZC4vibe4http6router9URLRouter .dub\build\application-debug-windows-x86-dmd_2073-5BBFAE5ECCC36FEC42565956CE2F0D0A\roadpoint.obj(roadpoint) Error 42: Symbol Undefined _D4vibe4http6server18HTTPServerSettings7__ClassZ .dub\build\application-debug-windows-x86-dmd_2073-5BBFAE5ECCC36FEC42565956CE2F0D0A\roadpoint.obj(roadpoint) Error 42: Symbol Undefined _D4vibe4http6server18HTTPServerSettings6__ctorMFZC4vibe4http6server18HTTPServerSettings .dub\build\application-debug-windows-x86-dmd_2073-5BBFAE5ECCC36FEC42565956CE2F0D0A\roadpoint.obj(roadpoint) Error 42: Symbol Undefined _D4vibe3web10validation10ValidEmail11__xopEqualsFKxS4vibe3web10validation10ValidEmailKxS4vibe3web10validation10ValidEmailZb
Re: Can't build simple project. Very strange errors
On Friday, 14 April 2017 at 09:51:55 UTC, Suliman wrote: But I tested it on 2.073.0 too Not 2.073.0 but v2.073.2 I checked v2.073.1 too and he reported that it's buildable with v2.073.1 on his PC. Any ideas?
Re: Can't build simple project. Very strange errors
But I tested it on 2.073.0 too Not 2.073.0 but v2.073.2
Can't build simple project. Very strange errors
I am getting very strange bug on very simple project. Here is sources http://rgho.st/7j5LQLZxb (blue button for downloading). On: dub build I am getting error: Unexpected OPTLINK Termination at EIP=0040F60A EAX=0393 EBX=00438C70 ECX=0EE6 EDX=02CE ESI=0104 EDI=03930468 EBP=0019FF38 ESP=0019FEF0 First=00402000 on: dub build --compiler=ldc2 It's buildable, but I am getting error on execution. The error says that file is corrupted. If comment mysql driver. database.d: import std.stdio; import std.string; import core.thread; import ddb.postgres; // import mysql; // <-- here import vibe.d; import config; the project begin buildable with dmd and ldc2 and run ok. I haven't seen such error before. I tried to clean link OPTLINK (R) for Win32 Release 8.00.17 DMD32 D Compiler v2.074.0 But I tested it on 2.073.0 too Also I tried to cleanup folder: AppData\Roaming\dub but it did not help :( Any ideas? Windows 10
Re: Single exe vibe.d app
On Friday, 7 April 2017 at 07:15:44 UTC, rikki cattermole wrote: I'm going to give you a very bad but still a good place to begin with explanation. So, what is an executable? Well in modern operating systems that is a file with a very complex structure inside, like PE-COFF or ELF. It has a bunch of things as part of this, a dynamic relocation table, sections and symbols. Now, there is a very important symbol it provides a "main" function. Normally the libc takes ownership of this and then on calls to the c-main that we all know and love (druntime uses this and then passes it to another symbol called _Dmain). What is the difference between a shared library and an executable? Well not much, no main function for starters (although Win32 based ones do have something like it in its place) and a couple of attributes stored in the file. Executables like shared libraries are final binaries, they cannot be further linked with, at least with the most common formats + linkers anyway. You asked about the difference between a static library and a shared library, it isn't quite the right comparison. You should be asking about static libraries versus object files. In essence a static library is just a group of object files. Not too complicated. Ok, but what about Go? I have heard that it's compile all code to single exe? What is the way it's done there?
Re: Single exe vibe.d app
On Thursday, 6 April 2017 at 17:39:15 UTC, Stefan Koch wrote: On Wednesday, 5 April 2017 at 12:13:38 UTC, Satoshi wrote: Hi, How can I build single exe application with vibe.d (windows)? now it require zlib.dll, libeay32.dll and ssleay32.dll But I need it as single app. One solution would be to compile vibe.d without ssl support that way it will not need libeay32 and ssleay32 It should not need zlib, really as zlib is already linked into phobos. Could anybody give very easy explanation about what different between static and dynamic libs. I read a lot of information that dynamic lib allow to loading at runtime and bla-bla-bla, but still do not understand what different between compilation at dynamic and static lib. For example: 1. Does every lib can be compiler as static and as dynamic? 2. Can already compiled lib be converted to from static to dynamic and vise-versa. 3. If I have any dynamic lib, the only way is distribute it with app (or use import) or there is way to embed code from it to app? Personaly I like if I can get single bin without any external dependence. In a lot of cases size do not important, it's better to have single bin, than heap of libs.
Re: shared: Has anyone used it without a lot of pain?
On Thursday, 6 April 2017 at 09:00:33 UTC, Kagamin wrote: On Wednesday, 5 April 2017 at 14:01:24 UTC, Guillaume Piolat wrote: My pet peeve with shared is the RoI. Risk of infection? Return of Investment :)
Can vibed be fast as Go or Python?
I found very interesting Python async framework japronto https://github.com/squeaky-pl/japronto Test show that in some cases japronto may work as fast as Go. Can vibed be competitor (or even better) than Go and Python for micro-services?
Re: Introducing Diskuto - an embeddable comment system
On Friday, 17 March 2017 at 16:42:28 UTC, Sönke Ludwig wrote: Am 17.03.2017 um 16:42 schrieb cym13: On Wednesday, 15 March 2017 at 02:14:34 UTC, Sönke Ludwig wrote: Am 14.03.2017 um 21:56 schrieb Daniel Kozak via Digitalmars-d-announce: Dne 14.3.2017 v 21:24 Sönke Ludwig via Digitalmars-d-announce napsal(a): Did you delete the comments yourself? The time limit for deletion/editing currently isn't enforced on the server (ticket already open), so anyone can delete their own tickets currently at any time. I've noted the other issues and will tackle those tomorrow. I have deleted not only my comments, I can delete enyone comment Okay, that was supposed to be implemented before 1.0.0, but then I forgot about it: https://github.com/rejectedsoftware/diskuto/blob/d8376f3e54a03574f69af13a0b41b5e994b6ce44/source/diskuto/web.d#L107 You'll also want a CSRF token for that, checking that the user is the author isn't enough. True, I have that and some other standard measures planned, but for now I wanted to concentrate on getting the general functionality and layout done. On the "security" side, simple moderation and registered user support is now in but still needs some additions, and the spam filter integration still needs a little work. IMO, those are the most important things for the start, because realistically nobody is going to implement a CSRF attack against this in the foreseeable future, and even if, the impact would be extremely limited (since only posts of the last 15 minutes can be changed anyways). Please add oAuth with Google instead anti-spam. I really captcha end other stupid system where computer make decision enough am I human or no. Also auth with Telegram is very good thing. I think it would enough for 90% of users.
Re: What is PostgreSQL driver is most stable?
The retrieval of records is done via the execution of a (prepared) sql query, that returns a range object (PGResultSet), and the element of that range is the DBRow, in one of its form. So, basically, the elements are retrieved on demand while you popFront that range, leveraging what the PostgreSQL stream protocol provide. --- Paolo Could you give an example when it's better to use DBRow and where to get data in structure?
Re: [vibe.d] How to create authentication system via REST interface?
On Wednesday, 15 March 2017 at 13:24:07 UTC, NX wrote: I'm trying to understand how to create some json-rest api that would return data (in json format) related to that specific logged in user. I see the documentation covers these but I'm totally new to vibe.d so can't quite figure out putting these two things together and make them work. Some easy to follow sample would be incredibly helpful, though any help is appreciated. You need to look at JWT. There is few good video on youtube about it and packed on code.dlang.org I did not seen ready to use examples :( If will need implement client side look at Vue.js it is very best of existen JS frameworks.
Re: What is PostgreSQL driver is most stable?
On Tuesday, 14 March 2017 at 13:36:04 UTC, Daniel Kozak wrote: Dne 14.3.2017 v 14:21 Daniel Kozak napsal(a): Dne 14.3.2017 v 14:13 Suliman via Digitalmars-d-learn napsal(a): I need to develop App that should work on Linux and Windows. It need PostgreSQL driver. I tried Vadim's ddbc for PostgreSQL but it's fail on x64 version of PostgreSQL and possible will not on x64 PG on Linux (I can't test it now). Could anybody advice me good driver without problems? I seen some pg-wrapers on code.dlang.ru, but do not have test all of them. ddbc works fine for me s/ddbc/ddb/ Am I rightn understand that DBRow! is allow to get only single row, and if I need array of rows I need to use foreach? If I am wrong could you provide an example please.
Re: So no one is using Amazon S3 with D, why?
On Tuesday, 14 March 2017 at 20:21:44 UTC, aberba wrote: Amazon S3 seem like a common solution for object storage these days[1] but I'm seeing almost no activity in this area (stable native D API). Why? [1] https://trends.builtwith.com/cdn/Amazon-S3 How much the lowest vibed ready instance cost? I am looking for a cheapest solution for site.
Re: What is PostgreSQL driver is most stable?
On Tuesday, 14 March 2017 at 13:21:39 UTC, Paolo Invernizzi wrote: On Tuesday, 14 March 2017 at 13:13:31 UTC, Suliman wrote: I need to develop App that should work on Linux and Windows. It need PostgreSQL driver. I tried Vadim's ddbc for PostgreSQL but it's fail on x64 version of PostgreSQL and possible will not on x64 PG on Linux (I can't test it now). Could anybody advice me good driver without problems? I seen some pg-wrapers on code.dlang.ru, but do not have test all of them. I'm using ddb [1], a full-D implementation of the PostgreSQL protocol. Not everything it's in place, but it does its works, and the codebase is pretty simple, so it's not difficult to contribute if you need to add some feature that's missing for your use case. [1] https://github.com/pszturmaj/ddb --- Paolo Does it work fine on Linux with x64 Postgres?
What is PostgreSQL driver is most stable?
I need to develop App that should work on Linux and Windows. It need PostgreSQL driver. I tried Vadim's ddbc for PostgreSQL but it's fail on x64 version of PostgreSQL and possible will not on x64 PG on Linux (I can't test it now). Could anybody advice me good driver without problems? I seen some pg-wrapers on code.dlang.ru, but do not have test all of them.
Re: Where do you test syntax of D regexp online?
On Friday, 10 March 2017 at 14:36:48 UTC, Suliman wrote: On Thursday, 9 March 2017 at 16:47:18 UTC, Adam D. Ruppe wrote: On Thursday, 9 March 2017 at 16:40:13 UTC, Suliman wrote: How should I write to file result without \r\n\ symbols? auto x = content.matchFirst(bigCodeBlock); File f = File("foo.txt", "w"); f.write(x); Just f.write(x[0]); to write out the whole hit instead of the collection of references. What can be wrong with this regexp? https://regex101.com/r/8e7nPL/3 it's crush D compiler, and I can't find out why I need simply select parts from one first-level # to another. like: #header some text and some code ^ first matching #header2 some text2 and some code2 ^ second matching
Re: Where do you test syntax of D regexp online?
On Thursday, 9 March 2017 at 16:47:18 UTC, Adam D. Ruppe wrote: On Thursday, 9 March 2017 at 16:40:13 UTC, Suliman wrote: How should I write to file result without \r\n\ symbols? auto x = content.matchFirst(bigCodeBlock); File f = File("foo.txt", "w"); f.write(x); Just f.write(x[0]); to write out the whole hit instead of the collection of references. What can be wrong with this regexp? https://regex101.com/r/8e7nPL/3 it's crush D compiler, and I can't find out why
Re: Where do you test syntax of D regexp online?
On Thursday, 9 March 2017 at 16:23:23 UTC, Adam D. Ruppe wrote: On Thursday, 9 March 2017 at 16:14:28 UTC, Suliman wrote: But now output is: [["```\r\nvoid foo()\r\n{\r\n\twriteln(\"ppp\");\r\n}\r\n```"]] But I do not \r\n\ symbols... That's just the writeln array formatter. The matchFirst function returns an array of hits (that allows captures, btw you might need to use \( instead of ( to get the capture, god i hate regex) so writeln tries to print the whole array and that's how it does embedded newlines. So you have the correct result, just written strangely. How should I write to file result without \r\n\ symbols? auto x = content.matchFirst(bigCodeBlock); File f = File("foo.txt", "w"); f.write(x); foo.txt: ["```\r\nvoid foo()\r\n{\r\n\twriteln(\"ppp\");\r\n}\r\n```"]
Re: Where do you test syntax of D regexp online?
Adding "r" helped: auto bigCodeBlock = regex(r"`{3}[\s\S]*?`{3}"); But now output is: [["```\r\nvoid foo()\r\n{\r\n\twriteln(\"ppp\");\r\n}\r\n```"]] But I do not \r\n\ symbols...
Re: Where do you test syntax of D regexp online?
On Thursday, 9 March 2017 at 15:22:00 UTC, rikki cattermole wrote: On 10/03/2017 4:17 AM, Suliman wrote: I would use dpaste and write a quick script but here is where I think your problem is: regex("/.*/g") It should be: regex(".*", "g") As per[0]. [0] http://dlang.org/phobos/std_regex.html#.regex Sorry, but what regexp are you talking? There is nothing like: `regex("/.*/g")` in my code... Yes there was: auto bigCodeBlock = regex("/`{3}[\\s\\S]*?`{3}/g"); I still can't get it work in real code :(
Re: Where do you test syntax of D regexp online?
I would use dpaste and write a quick script but here is where I think your problem is: regex("/.*/g") It should be: regex(".*", "g") As per[0]. [0] http://dlang.org/phobos/std_regex.html#.regex Sorry, but what regexp are you talking? There is nothing like: `regex("/.*/g")` in my code...