curl error msg

2022-02-19 Thread MichaelBi via Digitalmars-d-learn
when running the example in the std.net.curl on my windows, got following msg: std.net.curl.CurlException@std\net\curl.d(4239): Failed to load curl, tried "libcurl.dll", "curl.dll" does it mean i don't have those dll files? thx.

Re: how to handle very large array?

2022-02-14 Thread MichaelBi via Digitalmars-d-learn
On Saturday, 12 February 2022 at 20:31:29 UTC, H. S. Teoh wrote: On Sat, Feb 12, 2022 at 06:41:14PM +, Era Scarecrow via Digitalmars-d-learn wrote: [...] [...] That was not my point. My point was to question whether the OP has discovered the insight that would allow him to accomplish

how to handle very large array?

2022-02-09 Thread MichaelBi via Digitalmars-d-learn
day6 of the advent of code 2021 needs to handle an array of 10^12 length, or even bigger... plus change elements and append elements. normal implementation such as length, appender and ref element etc, seems cannot handle that big array? is there any alternative data structure or algorithm can

Re: how to handle very large array?

2022-02-09 Thread MichaelBi via Digitalmars-d-learn
On Wednesday, 9 February 2022 at 10:03:21 UTC, MichaelBi wrote: day6 of the advent of code 2021 needs to handle an array of 10^12 length, or even bigger... plus change elements and append elements. normal implementation such as length, appender and ref element etc, seems cannot handle that big

Re: how to handle very large array?

2022-02-09 Thread MichaelBi via Digitalmars-d-learn
On Wednesday, 9 February 2022 at 10:05:23 UTC, MichaelBi wrote: On Wednesday, 9 February 2022 at 10:03:21 UTC, MichaelBi wrote: day6 of the advent of code 2021 needs to handle an array of 10^12 length, or even bigger... plus change elements and append elements. normal implementation such as

Re: how to handle very large array?

2022-02-09 Thread MichaelBi via Digitalmars-d-learn
On Wednesday, 9 February 2022 at 19:48:49 UTC, H. S. Teoh wrote: [...] thanks, very helpful! i am using a assocArray now...

how to print "111000" out into 0b111000

2022-01-19 Thread michaelbi via Digitalmars-d-learn
as captioned... thx.

why there is a [] at the end of assocArray

2022-01-19 Thread michaelbi via Digitalmars-d-learn
input: 00100 0 10110 10111 10101 0 00111 11100 1 11001 00010 01010 code: void main() { foreach(line; File("input.txt").byLine.map!(a=>a.idup).array.transposed){ auto sortgroup = line.array.strip.sort.group.assocArray;

Re: why there is a [] at the end of assocArray

2022-01-19 Thread michaelbi via Digitalmars-d-learn
On Wednesday, 19 January 2022 at 13:21:32 UTC, Stanislav Blinov wrote: On Wednesday, 19 January 2022 at 13:15:35 UTC, michaelbi wrote: foreach(line; > File("input.txt").byLine.map!(a=>a.idup).array.transposed) so why there is a [] at the end of assocArray printed? thanks. ...because

Re: how to print "111000" out into 0b111000

2022-01-19 Thread MichaelBi via Digitalmars-d-learn
On Wednesday, 19 January 2022 at 15:41:31 UTC, Brian Callahan wrote: On Wednesday, 19 January 2022 at 15:01:29 UTC, michaelbi wrote: as captioned... thx. ```d import std.stdio; import std.conv; void main() { writefln("0b%b", to!int("111000", 2)); } ``` Got it, thanks

Re: why there is a [] at the end of assocArray

2022-01-19 Thread MichaelBi via Digitalmars-d-learn
On Wednesday, 19 January 2022 at 16:36:36 UTC, Ali Çehreli wrote: On 1/19/22 06:06, michaelbi wrote: On Wednesday, 19 January 2022 at 13:21:32 UTC, Stanislav Blinov wrote: On Wednesday, 19 January 2022 at 13:15:35 UTC, michaelbi wrote: [...] [...] ...because there's an empty line at

Re: Help, in vibe.d, how to get configure var of mongodb in heroku?

2022-05-13 Thread MichaelBi via Digitalmars-d-learn
On Friday, 13 May 2022 at 06:01:29 UTC, rikki cattermole wrote: On 13/05/2022 5:52 PM, MichaelBi wrote: struct Camera{ @name("_id") BsonObjectID id; // represented as "_id" in the database string brand; string model; } the structure is mapping of database field structure. how

Re: Help, in vibe.d, how to get configure var of mongodb in heroku?

2022-05-13 Thread MichaelBi via Digitalmars-d-learn
On Friday, 13 May 2022 at 06:43:30 UTC, rikki cattermole wrote: On 13/05/2022 6:23 PM, MichaelBi wrote:     render!("index.dt", showData()); There ya go, template arguments are run at compile time. Unh, then how to dynamically generate pages by using vibe.d

Help, in vibe.d, how to get configure var of mongodb in heroku?

2022-05-12 Thread MichaelBi via Digitalmars-d-learn
there are online documents of heroku on how to access config var value from code, and several code samples without D. link here: https://devcenter.heroku.com/articles/config-vars#accessing-config-var-values-from-code. i have code here: auto uri = environment.get("MONGODB_URI");

Re: Help, in vibe.d, how to get configure var of mongodb in heroku?

2022-05-12 Thread MichaelBi via Digitalmars-d-learn
On Friday, 13 May 2022 at 05:41:33 UTC, rikki cattermole wrote: On 13/05/2022 5:18 PM, MichaelBi wrote:     i have code here:     auto uri = environment.get("MONGODB_URI");     MongoClient conn = connectMongoDB(uri);     MongoDatabase eqpdb = conn.getDatabase("MbEqpHeroku");

Re: Help, in vibe.d, how to get configure var of mongodb in heroku?

2022-05-13 Thread MichaelBi via Digitalmars-d-learn
On Friday, 13 May 2022 at 06:12:01 UTC, rikki cattermole wrote: Okay that is fine, now we need to see where showData is being called. thanks, here's the code: import vibe.vibe; import std.process; import std.conv : to; void main() { auto settings = new HTTPServerSettings;

how to set REST path for gcloud api in vibe.d?

2022-06-14 Thread MichaelBi via Digitalmars-d-learn
I need to use gcloud NLP api which has the url and endpoint like this "https://language.googleapis.com/v1beta2/documents:analyzeSentiment;. The ":" between documents and analyzeSentiment make a lot trouble for me. Just don't know how to setup the @path in RestInterface for such endpoint. I tried

Re: Deploy vibe.d application on Heroku : App not compatible with buildpack

2022-05-09 Thread MichaelBi via Digitalmars-d-learn
On Monday, 28 June 2021 at 16:25:20 UTC, vnr wrote: On Monday, 28 June 2021 at 16:14:07 UTC, Andre Pany wrote: On Monday, 28 June 2021 at 13:53:05 UTC, vnr wrote: [...] Hi, Heroku is Cloud Foundry? If yes, you can make use of the binary buildpack or deploying your app as container too.

Re: range result in Tuple! and how to convert into assocArray by sort?

2022-05-09 Thread MichaelBi via Digitalmars-d-learn
On Tuesday, 10 May 2022 at 03:38:08 UTC, rikki cattermole wrote: If I am understanding the problem correctly, this is a super expensive method for doing something pretty simple. Even if it is a bit more code, this won't require memory allocation which in this case wouldn't be cheap (given how

Re: range result in Tuple! and how to convert into assocArray by sort?

2022-05-09 Thread MichaelBi via Digitalmars-d-learn
On Tuesday, 10 May 2022 at 04:21:04 UTC, Ali Çehreli wrote: On 5/9/22 20:38, rikki cattermole wrote: > [...] Yes! :) Assuming the data is indeed validated in some way, the following should be even faster. It validates the data after the fact: [...] this is cool! thanks for your time and

range result in Tuple! and how to convert into assocArray by sort?

2022-05-09 Thread MichaelBi via Digitalmars-d-learn
s is the string, and print result as following: s.array.sort!("athen how to transfer into [['A',231],['C',247],['G',240],['T',209]]? tried map!, but can only sortout key or value... tried array(), but result is not sorted then...thanks in advance.

how to install the new dmd on Mac M1?

2022-08-25 Thread MichaelBi via Digitalmars-d-learn
I downloaded the new dmd 2.1 on Mac, but with fail message of "unsupported Arch arm64". how can I do? thanks.

Re: how to install the new dmd on Mac M1?

2022-08-25 Thread MichaelBi via Digitalmars-d-learn
On Thursday, 25 August 2022 at 14:37:01 UTC, Steven Schveighoffer wrote: On 8/25/22 10:19 AM, MichaelBi wrote: I downloaded the new dmd 2.1 on Mac, but with fail message of "unsupported Arch arm64". how can I do? thanks. DMD is x86 only. M1 macs can run x86 via rosetta. I haven't had this

Re: how to install the new dmd on Mac M1?

2022-08-25 Thread MichaelBi via Digitalmars-d-learn
On Thursday, 25 August 2022 at 16:06:49 UTC, Ben Jones wrote: On Thursday, 25 August 2022 at 15:19:56 UTC, Steven Schveighoffer wrote: On 8/25/22 10:44 AM, MichaelBi wrote: On Thursday, 25 August 2022 at 14:37:01 UTC, Steven Schveighoffer wrote: On 8/25/22 10:19 AM, MichaelBi wrote: Is

Re: how to install the new dmd on Mac M1?

2022-08-25 Thread MichaelBi via Digitalmars-d-learn
On Thursday, 25 August 2022 at 15:19:56 UTC, Steven Schveighoffer wrote: On 8/25/22 10:44 AM, MichaelBi wrote: On Thursday, 25 August 2022 at 14:37:01 UTC, Steven Schveighoffer wrote: [...] it's simple as following: -iMac ~ % curl -fsS https://dlang.org/install.sh | bash -s dmd Unsupported

Re: how to install the new dmd on Mac M1?

2022-08-25 Thread MichaelBi via Digitalmars-d-learn
On Friday, 26 August 2022 at 00:55:05 UTC, Nicholas Wilson wrote: On Friday, 26 August 2022 at 00:34:30 UTC, MichaelBi wrote: when using ldc2, has this error "ld: library not found for -lssl" after dub build --compiler=ldc2 So where is your ssl library located and how (if at all) are you