On Thursday, 29 June 2023 at 19:19:21 UTC, Adam D Ruppe wrote:
On Thursday, 29 June 2023 at 18:47:48 UTC, Josh Holtrop wrote:
$ ldc2 -of environment environment.d
Since you named the file `environment.d` and didn't use an
explicit `module name.thing;` declaration, the compiler assumes
I am trying to use `std.process.environment.get()` as described
here: https://dlang.org/library/std/process/environment.get.html
I wrote this program to test it:
```d
import std.stdio;
import std.process;
int main(string[] args)
{
string home = environment.get("HOME");
writeln("home
I am trying to use std.sumtype which seems to be just what I need
for some functions that can return various types of errors with
parameters or a success value with different parameters.
In this test I get a compilation error with ldc2:
```d
import std.stdio;
import std.sumtype;
struct Error
On Thursday, 6 April 2023 at 00:59:12 UTC, Mathias LANG wrote:
immutable ubyte[4] data = [1, 2, 3, 4];
Using a static array instead of a slice will do the trick. You
can leave the `__gshared` if you want, but it is redundant on a
global, initialized `immutable` variable.
Yes, thank you,
I am trying to port a small C project to D and am getting a
compilation error I don't understand.
I've simplified the situation down to the example here.
This C version compiles fine:
```c
#include
static const unsigned char data[] = {1, 2, 3, 4};
static const unsigned char * p = [0];
int
I'm trying to read in a text file that has many duplicated lines
and output a file with all the duplicates removed. By the end of
this code snippet, the memory usage is ~5x the size of the infile
(which can be multiple GB each), and when this is in a loop the
memory usage becomes unmanageable
On Wednesday, 28 October 2020 at 07:56:35 UTC, Mike Parker wrote:
On Wednesday, 28 October 2020 at 07:50:27 UTC, Josh Dredge
wrote:
developers would love to be working with! I will give Gtk a go
too - I've never programmed with it, but I used Ubuntu alot
back in the day and never really
On Wednesday, 28 October 2020 at 06:52:35 UTC, evilrat wrote:
On Tuesday, 27 October 2020 at 11:46:02 UTC, Josh Dredge wrote:
[...]
Welcome! If by web development you also have back-end
programming then you should be like 50% know how desktop
programming works.
[...]
Fantastic, thank
Hi all, I'm completely new to D and while I'm not new to
programming in general, I mostly do web development, and what
desktop development I've done has all been with easy
drag-and-drop GUI builders - so Visual Basic, C# and J# (if that
doesn't date me). I'm trying to experiment in new
On Monday, 20 May 2019 at 11:10:32 UTC, Boqsc wrote:
https://dlang.org/spec/float.html
I'm frozen in learning basics of D lang since I want to create
a simple game and I really would like a clean and simple code,
however to me floating points are magic.
https://wiki.dlang.org/Review_Queue
Thank you, that helps big time.
This is just more curiosity, but do you happen to know why I have
to use DList.linearRemove() instead of DList.remove()?
import std.stdio;
import std.container.dlist;
import std.algorithm;
import std.range;
void main()
{
auto list = make!DList("the",
Just started looking at D this weekend, coming from a
C++/Java/Go/Rust background and it's really not going well.
Trying to write something to play with the language and need a
linked list, looking in std.container you have a single or doubly
linked list...great.
Now how to I iterate over
I have a website (say https://website.com) that I need to log in
to, it will do a few 302 redirects and then I will end up with a
unique session ID in the URL (such as
https://website.com/welcome.html?s=636853677441448706). Is there
some way of extracting this ID (I'll need it later for other
ass=submit");
curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE,
(curl_off_t)52);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/7.57.0");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION,
(long)CURL_HTTP_VERSION_2TLS);
curl_easy_setopt(hnd, CURLOPT_
handle.set(CurlOption.useragent, "curl/7.57.0");
http.handle.set(CurlOption.maxredirs, 50);
//http.handle.set(CurlOption.cainfo,
"C:\\Users\\Josh\\Downloads\\curl-7.57.0-win64-mingw\\bin\\curl-ca-bundle.crt");
http.handle.set(CurlOption.cookiejar, "co
On Friday, 22 September 2017 at 03:26:36 UTC, Mike Parker wrote:
On Friday, 22 September 2017 at 02:22:46 UTC, Josh wrote:
src\mixer.d(80,22): Error: function pointer
Mix_ChannelFinished (extern (C) void function(int channel)) is
not callable using argument types (extern (C) void
delegate
On Friday, 22 September 2017 at 02:18:34 UTC, Mike Parker wrote:
On Thursday, 21 September 2017 at 22:05:22 UTC, Matt Jones
wrote:
On Thursday, 21 September 2017 at 20:21:58 UTC, Josh wrote:
I'm trying to write a callback function for SDL_mixer through
Derelict, but this is the first time I've
On Thursday, 21 September 2017 at 22:05:22 UTC, Matt Jones wrote:
On Thursday, 21 September 2017 at 20:21:58 UTC, Josh wrote:
I'm trying to write a callback function for SDL_mixer through
Derelict, but this is the first time I've tried to use a
function as a parameter, and so I think I'm just
I'm trying to write a callback function for SDL_mixer through
Derelict, but this is the first time I've tried to use a function
as a parameter, and so I think I'm just making a minor mistake
somewhere.
The C SDL docs say:
// make a
My goal with the code below is to eventually have my main
communicate with Foo and Bar classes listening for packets on a
different address/port, each in a separate thread. They would
then communicate with Foobaz and Barbaz threads respectively to
do other work. In trying to get just Foo
On Saturday, 23 January 2016 at 21:06:32 UTC, Adam D. Ruppe wrote:
Are you sure you correctly casted first?
Nope sorry. Thanks for the help!!
On Friday, 22 January 2016 at 23:44:34 UTC, Adam D. Ruppe wrote:
There's a .classinfo property that works on Objects.
If you have an interface, cast to Object first, and check for
null, then get .classinfo off that.
I tried this but it will return A not B
If I have:
interface A {}
class B : A {}
void printClass(A obj){
// Code here
}
Is there any way that I can find out what class obj is inside of
printClass? I know I can cast and check if(cast(B)obj) but I want
to just be able to do something along the lines of obj.class. I
can think of
I also ran into this issue because I upgraded VS and removed the
old version. A quick re-install with the dmd .exe fixed it.
On Friday, 15 January 2016 at 07:37:27 UTC, Josh Phillips wrote:
However I (of course) ran into new errors. Gl functions like
glGetString and glGetIntegerv cause the program to crash. It
appears that an opengl context is being created so I'm not sure
whats causing the problem
For anyone else
On Thursday, 14 January 2016 at 09:42:50 UTC, Dav1d wrote:
On Thursday, 14 January 2016 at 09:25:50 UTC, Dav1d wrote:
On Thursday, 14 January 2016 at 02:35:28 UTC, Josh Phillips
wrote:
Welcome to D and Windows. You can use GDC or LDC or try
http://wiki.dlang.org/Installing_DMD_on_64
So I started using Glad but I can't get WGL to work with it,
though I think this is more of a Win32 issue than WGL.
wndclass.lpfnWndProc =
Gives me an error no matter what:
Error: cannot implicitly convert expression (& WndProc) of type
int function(void* hWnd, uint message, uint wParam,
On Wednesday, 13 January 2016 at 18:37:09 UTC, Adam D. Ruppe
wrote:
You just need to explicitly mark it nothrow in the signature.
Add `nothrow` to the end of the param list:
extern(Windows)
LRESULT WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam) nothrow
and then you'll be
On Thursday, 14 January 2016 at 02:16:40 UTC, userABCabc123 wrote:
On Wednesday, 13 January 2016 at 19:05:30 UTC, Josh Phillips
wrote:
Oh wow that's easy. They should really make that more clear in
the dlang reference. They way it sounds there made me think
that if a function doesn't throw any
On Wednesday, 13 January 2016 at 20:08:55 UTC, Dav1d wrote:
Link with opengl32.lib
How? Everywhere I looked it says this cannot be done due to
conflicting formats between the dmd compiler and the windows one.
?
Thanks
Josh
, sequence!(n * a[0])(2));
trimmed = setDifference(trimmed, sequence!(n * a[0])(3));
Thanks,
Josh
On Friday, 14 February 2014 at 20:36:42 UTC, Jeremy DeHaan wrote:
Unless I am mistaken, it looks like the last time it was
updated was in 2011. You'd probably have to update a bunch of
stuff in the sources in order to get it to work properly.
I would recommend gtkD as a gui library.
I think
I recently downloaded and tried to use DGUI but I can't get it to
work. Is there any tutorials on how to build an use it? Or can
anyone help me and tel me a way on how I can get it to work?
I was wondering if people could suggest which libraries may be
best to use for building an application which would be a type of
text editor with multiple documents and branches. I need
something whereby I can create simple, custom windows and do
simple text editing, but then i need it to also
On Thursday, 22 August 2013 at 04:18:34 UTC, Josh wrote:
Windows 7, DMD 2.062
I was trying to use std.file.copy, and I kept getting a
FileException because it couldn't find the file, even though I
triple checked the name and that it existed in Explorer. So I
did a little test to illustrate
.dll I created by copying msvcrt.dll. I also can't find
msvcrt20/40.dll inside Explorer. Is there any reason why these
don't show the same results?
Thanks,
Josh
{
d = dirEntry(n);
if (d.isDir !canFind(d.name, Windows)
!canFind(d.name, Program Files) !canFind(d.name,
ProgramData) !canFind(d.name, Josh))
entries.put(scanDrive(n, saving).data
On Wednesday, 3 July 2013 at 04:51:06 UTC, Jonathan M Davis wrote:
On Wednesday, July 03, 2013 06:44:33 Josh wrote:
On Wednesday, 3 July 2013 at 04:32:15 UTC, Jonathan M Davis
wrote:
On Wednesday, July 03, 2013 06:23:12 Josh wrote:
writeln(to!double(151.42499));//prints 151.425
writeln(to!double(151.42499));//prints 151.425
Is there any way to stop this rounding?
Thanks,
Josh
On Wednesday, 3 July 2013 at 04:32:15 UTC, Jonathan M Davis wrote:
On Wednesday, July 03, 2013 06:23:12 Josh wrote:
writeln(to!double(151.42499));//prints 151.425
Is there any way to stop this rounding?
No. double can't hold the value 151.42499. There are _tons_ of
values that it
can't
, as I can compile other programs
that just use Phobos. I'm sure it's something really obvious that
I can't see, but I haven't had much luck with external libs. The
same sort of thing happened when I used GtkD...
Any help is welcomed.
Thanks,
Josh
On Saturday, 18 May 2013 at 08:26:09 UTC, Dicebot wrote:
On Saturday, 18 May 2013 at 02:09:49 UTC, Josh wrote:
Bearophile, is your findVar an AA? It looks like it is, I just
didn't think you could put refs in an AA.
Thanks
Josh
It is AA and it stores pointers, not references.
P.S
On Friday, 17 May 2013 at 22:15:09 UTC, bearophile wrote:
Josh:
Is something like this possible in D?
void main()
{
int x, y, z;
write(Increment which variable: );
string input = readln()[0..$ - 1];
findVar(input)++;
writeln(x, y, z);
}
The Go language and its standard
Is there a way in D to only accept input for a certain time,
instead of std.stdio.readln's behaviour? Something like Press a
key in 3 seconds to abort.
Thanks
Josh
On Tuesday, 14 May 2013 at 04:14:27 UTC, Ali Çehreli wrote:
On 05/13/2013 08:50 PM, Josh wrote:
Is there a way in D to only accept input for a certain time,
instead of
std.stdio.readln's behaviour? Something like Press a key in 3
seconds
to abort.
Thanks
Josh
An unlikely solution
On Sunday, 14 April 2013 at 13:34:07 UTC, Mike Wey wrote:
On 04/13/2013 07:00 AM, Josh wrote:
On Wednesday, 10 April 2013 at 20:17:36 UTC, Mike Wey wrote:
On 04/10/2013 03:20 PM, Josh wrote:
After trying to compile in 64 bit and failing, I've given up
and just
used 32 bit. So now I have GTK
On Wednesday, 10 April 2013 at 20:17:36 UTC, Mike Wey wrote:
On 04/10/2013 03:20 PM, Josh wrote:
After trying to compile in 64 bit and failing, I've given up
and just
used 32 bit. So now I have GTK-Runtime 3.6.1 32 bit, GtkD
2.1.1 and DMD
2.062. My program is still giving the no schemas
On Wednesday, 3 April 2013 at 20:41:47 UTC, Mike Wey wrote:
On 04/03/2013 05:38 AM, Josh wrote:
On Tuesday, 2 April 2013 at 20:50:16 UTC, Mike Wey wrote:
On 04/02/2013 02:38 PM, Josh wrote:
On Sunday, 31 March 2013 at 14:21:50 UTC, Mike Wey wrote:
On 03/30/2013 05:42 PM, Josh wrote
How can I find out which line of code is causing a thread to
throw a LinkTerminated? Every time I catch one, it always says
std\concurrency.d(262), which is just the LinkTerminated
constructor.
Thanks,
Josh
On Sunday, 31 March 2013 at 14:21:50 UTC, Mike Wey wrote:
On 03/30/2013 05:42 PM, Josh wrote:
On Saturday, 30 March 2013 at 16:17:22 UTC, Mike Wey wrote:
On 03/30/2013 03:49 PM, Josh wrote:
Sorry, I misread, I thought the xml files were the compiled
bits. When I
ran glib-compile-schemas.exe
On Tuesday, 2 April 2013 at 20:50:16 UTC, Mike Wey wrote:
On 04/02/2013 02:38 PM, Josh wrote:
On Sunday, 31 March 2013 at 14:21:50 UTC, Mike Wey wrote:
On 03/30/2013 05:42 PM, Josh wrote:
On Saturday, 30 March 2013 at 16:17:22 UTC, Mike Wey wrote:
On 03/30/2013 03:49 PM, Josh wrote:
Sorry, I
On Saturday, 30 March 2013 at 13:19:03 UTC, Mike Wey wrote:
On 03/30/2013 05:25 AM, Josh wrote:
This is the code causing the problem:
class myInputDialog : Dialog
...
this()
{
super(Please enter file location..., this,
GtkDialogFlags.MODAL |
GtkDialogFlags.DESTROY_WITH_PARENT, [StockID.OK
On Saturday, 30 March 2013 at 14:45:07 UTC, Josh wrote:
On Saturday, 30 March 2013 at 13:19:03 UTC, Mike Wey wrote:
On 03/30/2013 05:25 AM, Josh wrote:
This is the code causing the problem:
class myInputDialog : Dialog
...
this()
{
super(Please enter file location
On Saturday, 30 March 2013 at 16:17:22 UTC, Mike Wey wrote:
On 03/30/2013 03:49 PM, Josh wrote:
Sorry, I misread, I thought the xml files were the compiled
bits. When I
ran glib-compile-schemas.exe, I get the following:
warning: Schema 'org.gnome.system.proxy' has path
'/system/proxy
, findFile never runs and the problem
doesn't happen, except I can't browse for files.
Thanks,
Josh
false
false
true
true
true
true
F:\folder true
F:\folder true
Is anybody able to explain why a DirEntry can't seem to detect
whether a directory is in fact a directory, whereas plain isDir
and even a DirEntry inside dirEntries can?
Thanks,
Josh
On Saturday, 2 February 2013 at 11:16:50 UTC, FG wrote:
On 2013-02-02 07:49, Josh wrote:
But main's first writeln actually outputs after f.close().
Maybe because of output buffering and you need to add flush?
How do I do that? I've never heard of flush before.
The program uses ~1GB of RAM
to
C:\Documents and Settings. On Windows 7 that doesn't actually
exist, which is fine. What I'd like it to do is tell me that it
doesn't exist, but continue iterating anyway. I've tried
try-catch, but that just stops the iteration.
Any help is appreciated. Thanks :)
Josh
On Wednesday, 23 January 2013 at 15:00:16 UTC, bearophile wrote:
A possible solution: desugar the foreach range iteration
protocol of dirEntries and wrap the relevant method with a
try-catch.
Sorry, could you explain that a little? I'm not sure what desugar
means :/
Is there a way to do that? I've tried
getenv(PROCESSOR_ARCHITECTURE) and shell(echo
%PROCESSOR_ARCHITECTURE%), and both of them return x86 instead
of AMD64 like cmd. I want to use this to run a 64 bit version
of an external program if the OS is 64 bit, and the 32 bit
version if not.
I'm trying to make an installer application in D. I've checked
with various hashes and the file it's outputting is different to
the original, and therefore Windows is saying it's not a valid
Win32 application. I'm sure it's me doing something wrong and not
DMD's fault. Any help is appreciated.
Hi,
I wanted to give D a try today and port one of my applications to it. I am
currently stuck on this problem:
I have the following 3 files:
maindialog.d - contains the main() function form creation(using dfl and
Entice Designer)
private {
import dfl.all;
import common.Globals;
}
63 matches
Mail list logo