I want to implement operation feasible?

2014-12-15 Thread Brian via Digitalmars-d-learn
package com.kerisy.mod.base interface BaseMod { auto getInstance(); } package com.kerisy.mod.a class A : BaseMod { A getInstance() { return (new A); } void hello() { // in A writeln(in A);

Storing and Searching large text lists

2015-12-31 Thread brian via Digitalmars-d-learn
I have a large list, B, of string items. For each item in that large list, I need to see if it is in the smaller list, A. I have been using a simple string array for the storage of A string[] A and then using foreach to go through all the items of B and check they are in A

Password Storage

2015-11-26 Thread brian via Digitalmars-d-learn
I'm starting to build a small web-based application where I would like to authenticate users, and hence need to store passwords. After reading this: http://blog.codinghorror.com/youre-probably-storing-passwords-incorrectly/ and many other posts that I zombie-surfed to from that page, I'm now

Re: Password Storage

2015-11-26 Thread brian via Digitalmars-d-learn
On Friday, 27 November 2015 at 02:05:49 UTC, H. S. Teoh wrote: ... At no time is the password ever sent over the network, encrypted or not. --T So, I understand what you are trying to say, but I'm stuck on the specifics of implementation, if you'll bear with me. For authentication, the

Re: Password Storage

2015-11-26 Thread brian via Digitalmars-d-learn
On Friday, 27 November 2015 at 00:42:09 UTC, Alex Parrill wrote: On Friday, 27 November 2015 at 00:17:34 UTC, brian wrote: I'm starting to build a small web-based application where I would like to authenticate users, and hence need to store passwords. After reading this:

Getting the body of a HTTP Request

2016-01-27 Thread brian via Digitalmars-d-learn
Hello forumites I am using vibe to connect to an (internal) API however, an am expecting to get back an authorization token with the body of a HTTP POST response. /* start code snippet */ shared static this() {

Re: Getting the body of a HTTP Request

2016-01-27 Thread brian via Digitalmars-d-learn
On Wednesday, 27 January 2016 at 23:50:34 UTC, Chris Wright wrote: On Wed, 27 Jan 2016 23:42:54 +, brian wrote: Body: vibe.stream.counting.EndCallbackInputStream Body to String: Body to String: HTTP/1.1 302 Found You got an HTTP redirect as a response. There should be a header called

Re: Creating an array of user-defined structs

2016-08-21 Thread brian via Digitalmars-d-learn
Thanks Adam. Couple of follow up questions, if you don't mind: On Sunday, 21 August 2016 at 23:37:38 UTC, Adam D. Ruppe wrote: testStruct[int] testStructArray; That's not actually an array per se, that is a key/value map where the keys are ints. I understand it's a map, but does my syntax not

Re: Creating an array of user-defined structs

2016-08-22 Thread brian via Digitalmars-d-learn
On Monday, 22 August 2016 at 06:19:00 UTC, Mike Parker wrote: Terminology wise, we distinguish between associative arrays (AA) and arrays. The former should never simply be called 'array', otherwise people will assume you are referring to either or both of foo[] (dynamic array/slice) or foo[N]

Simple Function Parameter question...

2016-10-04 Thread brian via Digitalmars-d-learn
Howdy folks This might be a really stupid question, but ya know, if you don't ask ... So, anytime I am calling a function, I have to include everything that the function needs all the time. My simplistic example is: #!/usr/bin/rdmd import std.stdio; void test(string firstinput, string

Re: Simple Function Parameter question...

2016-10-04 Thread brian via Digitalmars-d-learn
On Tuesday, 4 October 2016 at 13:16:35 UTC, Adam D. Ruppe wrote: I'd put your repeated variables together in a struct, then pass it around to the functions. At least then you pass just one param at a time, without losing the info. That's not a bad idea. I have been creating "ids" to point to

Re: template library like Jinja

2016-12-08 Thread Brian via Digitalmars-d-learn
On Wednesday, 21 November 2012 at 20:56:04 UTC, Masahiro Nakagawa wrote: On Tuesday, 20 November 2012 at 11:38:46 UTC, Tobias Pankrath wrote: Is there any template library like Jinja? (jinja.pocoo.org). I'm pretty sure we can do even better by leveraging CTFE and a precompiler, but speed is

Re: WebCam or Video in D

2017-08-15 Thread brian via Digitalmars-d-learn
On Monday, 14 August 2017 at 13:19:30 UTC, Guillaume Piolat wrote: It wouldn't be very hard to write a minimal OpenCV loader (for example based on DerelictUtil) with only the few functions you need in OpenCV. Do you know of any simple examples that I could try mimic? I've looked through

WebCam or Video in D

2017-08-13 Thread brian via Digitalmars-d-learn
Howdy folks. Has anyone gotten an example of using D as mechanism to read in video files, specifically from a webcam? I don't see any OpenCV libraries, and the example in the DCV library that uses FFMPEG, I can't get to work (I've raised an issue in Github here

Re: Simplest multithreading example

2017-09-04 Thread Brian via Digitalmars-d-learn
On Friday, 1 September 2017 at 20:02:23 UTC, ag0aep6g wrote: On 09/01/2017 07:27 AM, Brian wrote: double [] hugeCalc(int i){ // Code that takes a long time } so if I do double[][int] _hugeCalcCache; foreach(i ; I) _hugeCalcCache[i] = hugeCalc(i); of course the required time is

Simplest multithreading example

2017-08-31 Thread Brian via Digitalmars-d-learn
Hello, I am trying to get the most trivial example of multithreading working, but can't seem to figure it out. I want to split a task across threads, and wait for all those tasks to finish before moving to the next line of code. The following 2 attempts have failed :

Re: Simplest multithreading example

2017-08-31 Thread Brian via Digitalmars-d-learn
On Friday, 1 September 2017 at 04:43:29 UTC, Ali Çehreli wrote: On 08/31/2017 06:59 PM, Brian wrote: > Hello, I am trying to get the most trivial example of multithreading > working, but can't seem to figure it out. > I want to split a task across threads, and wait for all those tasks to >

Re: Is HibernateD dead?

2018-05-05 Thread Brian via Digitalmars-d-learn
On Thursday, 3 May 2018 at 10:27:47 UTC, Pasqui23 wrote: Last commit on https://github.com/buggins/hibernated was almost a year ago So what is the status of HibernateD?Should I use it if I need an ORM? Or would I risk unpatched security risks? You can use Entity & Database library:

I want delete or change class's member name on compile-time

2018-06-08 Thread Brian via Digitalmars-d-learn
Like: class A { string b; string c; } compile-time to: class A { string _b; string c; } or: class A { string c; }

Re: I want to transmit the class name and the member name in the method

2018-01-05 Thread Brian via Digitalmars-d-learn
On Friday, 5 January 2018 at 12:19:11 UTC, thedeemon wrote: On Friday, 5 January 2018 at 07:40:14 UTC, Brian wrote: I think code style like: db.select(User).where(email.like("*@hotmail.com")).limit(10); You need to read about templates in D, here's a good guide:

Re: I want to transmit the class name and the member name in the method

2018-01-05 Thread Brian via Digitalmars-d-learn
On Friday, 5 January 2018 at 15:38:17 UTC, Binghoo Dang wrote: On Friday, 5 January 2018 at 07:40:14 UTC, Brian wrote: I think code style like: ~~ struct User { int id; string name; string email; } class ORM { } auto db

I want to transmit the class name and the member name in the method

2018-01-04 Thread Brian via Digitalmars-d-learn
I think code style like: ~~ struct User { int id; string name; string email; } class ORM { } auto db = new ORM; auto users = db.select(User).where(email.like("*@hotmail.com")).limit(10); foreach(user; users) {

Re: How to use annotation get key name?

2018-03-27 Thread Brian via Digitalmars-d-learn
On Monday, 26 March 2018 at 08:50:31 UTC, Simen Kjærås wrote: On Monday, 26 March 2018 at 08:29:31 UTC, Brian wrote: Rust sample code: #[cfg(name = "users")] PHP sample code: /* @Table(name = "users") */ Java sample code: @Table(name = "users") How to use dlang get key name? If I

How to use annotation get key name?

2018-03-26 Thread Brian via Digitalmars-d-learn
Rust sample code: #[cfg(name = "users")] PHP sample code: /* @Table(name = "users") */ Java sample code: @Table(name = "users") How to use dlang get key name?

How to define class type array?

2018-12-15 Thread Brian via Digitalmars-d-learn
Java code: ```java class A extends Node {} class B extends Node {} class C extends Node {} @Override public Set> getNodes() { return new HashSet<>(Arrays.asList( A.class, B.class, C.class )); } ``` For dlang like this?

Struct assignment fails, why?

2021-06-16 Thread Brian via Digitalmars-d-learn
Hello all -- I have a question about assigning to structs. I want to be able to create an array of structs that may contain different contents depending on user input. I have reduced the test case down. The following fails to compile: ```d import std.stdio; struct item { string name;

Re: Struct assignment fails, why?

2021-06-16 Thread Brian via Digitalmars-d-learn
On Wednesday, 16 June 2021 at 20:54:07 UTC, H. S. Teoh wrote: On Wed, Jun 16, 2021 at 08:44:46PM +, Brian via Digitalmars-d-learn wrote: [...] struct item { string name; int type; }; [...] new_item = { "item1", 1 }; The {...} initializer syntax is only

code.dlang.org package search subtly broken?

2021-03-27 Thread Brian via Digitalmars-d-learn
Hello -- When I go to https://code.dlang.org and use the search function on the top right corner, it usually works fine. However, there was one package I knew I specifically wanted (png-d) but when I typed png-d into the search bar, I was greeted with an error page, reproduced at the bottom

Re: code.dlang.org package search subtly broken?

2021-03-27 Thread Brian via Digitalmars-d-learn
On Saturday, 27 March 2021 at 14:53:52 UTC, Imperatorn wrote: Yeah, the search is broken sadly. I made a PR about it some time ago. Partial searches doesn't work Good to know. Thank you.

Forbidden file names?

2021-03-14 Thread Brian via Digitalmars-d-learn
Hello -- Apologies if this is answered somewhere in the documentation. I was trying out the sample code on the dlang.org home page. When I got to the "Sort an Array at Compile-Time" example, I saved it on my machine as sort.d. When I tried to build sort.d, the compile failed. But when I

Re: Forbidden file names?

2021-03-14 Thread Brian via Digitalmars-d-learn
On Sunday, 14 March 2021 at 20:57:39 UTC, Paul Backus wrote: This is the error you get when you try to call a function that has the same name as the current module. The best way to fix it is to rename the module, but if you can't, you can use an alias to disambiguate: alias sort =

OpenXR library bindings etc

2022-09-09 Thread brian via Digitalmars-d-learn
I'd like to use D for some visualisation in XR, but without OpenXR, I'm stuck before I even start. I have tried before to write the library bindings (https://github.com/infinityplusb/OpenXR-D), but got stuck and honestly don't know enough about what needs doing to fix it. Apparently it is