async socket programming in D?

2014-04-20 Thread Bauss via Digitalmars-d-learn
I know the socket has the nonblocking settings, but how would I actually go around using it in D? Is there a specific procedure for it to work correctly etc. I've taken a look at splat.d but it seems to be very outdated, so that's why I went ahead and asked here as I'd probably have to end

Invalid Assembly Generated

2014-10-04 Thread Bauss via Digitalmars-d-learn
I am not able to run the output file compiled. I am not sure if it might be an error with my commandline or not. Operating System: Windows 8 Commandline Arguments Try1: -c hello.d out\hello.exe Commandline Arguments Try2: -c hello.d -m32 out\hello.exe hello.d: import std.stdio; void main() {

Runtime execution

2014-10-19 Thread Bauss via Digitalmars-d-learn
Is there anyway to pull of a runtime compilation of D code or at the very least asm execution?

spawnProcess() not child?

2014-11-01 Thread Bauss via Digitalmars-d-learn
Is there a way to spawn a process that won't be a child process, because I can't seem to kill any processes created with spawnProcess() It keeps giving me access denied for the processes and it's necessary for me to kill a process, compile it and then spawn it again. Currently what I do is

Re: spawnProcess() not child?

2014-11-03 Thread Bauss via Digitalmars-d-learn
Is there nobody that knows a solution? :(

Access Violation Tracking

2014-11-05 Thread Bauss via Digitalmars-d-learn
Is there any way to track down access violations, instead of me having to look through my source code manually. I have a pretty big source code and an access violation happens at runtime, but it's going to be a nightmare looking through it all to find the access violation. Not to mention all

Re: Access Violation Tracking

2014-11-05 Thread Bauss via Digitalmars-d-learn
On Wednesday, 5 November 2014 at 11:27:02 UTC, thedeemon wrote: On Wednesday, 5 November 2014 at 11:09:42 UTC, Bauss wrote: Is there any way to track down access violations, instead of me having to look through my source code manually. I have a pretty big source code and an access violation

Re: Access Violation Tracking

2014-11-05 Thread Bauss via Digitalmars-d-learn
On Wednesday, 5 November 2014 at 11:39:21 UTC, Marc Schütz wrote: On Wednesday, 5 November 2014 at 11:09:42 UTC, Bauss wrote: Is there any way to track down access violations, instead of me having to look through my source code manually. I have a pretty big source code and an access violation

Re: Live without debugger?

2014-11-11 Thread Bauss via Digitalmars-d-learn
On Monday, 10 November 2014 at 10:50:49 UTC, Chris wrote: On Sunday, 9 November 2014 at 08:26:59 UTC, Suliman wrote: I know that a lot of people are using for programming tools like Sublime. I am one of them. But if for very simple code it's ok, how to write hard code? Do you often need

Compile for other OS's on Windows?

2015-01-05 Thread Bauss via Digitalmars-d-learn
Is it possible to compile for other OS's on Windows using dmd?

Re: Compile for other OS's on Windows?

2015-01-05 Thread Bauss via Digitalmars-d-learn
On Monday, 5 January 2015 at 12:54:00 UTC, Gary Willoughby wrote: On Monday, 5 January 2015 at 11:49:32 UTC, Bauss wrote: Is it possible to compile for other OS's on Windows using dmd? This is what's known as cross compiling and is not currently supported by DMD at this time. Any

Traits and functions

2015-01-10 Thread Bauss via Digitalmars-d-learn
Is there a way to get all functions within a module using traits? I tried allMembers and it seem to work, but I can't use getFunctionAttributes with it and if I use getAttributes then it won't find any applied attributes. What I do is having a package module with a staic constructor which

Re: Traits and functions

2015-01-10 Thread Bauss via Digitalmars-d-learn
On Saturday, 10 January 2015 at 23:23:52 UTC, Ali Çehreli wrote: On 01/10/2015 08:21 AM, Bauss wrote: Is there a way to get all functions within a module using traits? I tried allMembers and it seem to work, but I can't use getFunctionAttributes with it and if I use getAttributes then it

Re: Pointers and offsets

2015-01-13 Thread Bauss via Digitalmars-d-learn
On Wednesday, 14 January 2015 at 01:16:54 UTC, Bauss wrote: Is it possible to access a pointer by its offsets. Ex. write a 32bit integer to a byte pointer at ex. offset 4. To give an example in C# you can do this: fixed (byte* Packet = Buffer) // Buffer would be a byte array And then to set

Pointers and offsets

2015-01-13 Thread Bauss via Digitalmars-d-learn
Is it possible to access a pointer by its offsets. Ex. write a 32bit integer to a byte pointer at ex. offset 4. To give an example in C# you can do this: fixed (byte* Packet = Buffer) // Buffer would be a byte array And then to set the value of a specific offset *((TYPE*)(Packet + OFFSET))

Opening browser and url.

2015-06-25 Thread Bauss via Digitalmars-d-learn
In other programming languages you can open a website in the default browser by spawning a process using the url, but it does not seem to work with D using spawnProcess(). Do I have to do API calls to get the default browser and then call spawnProcess() with the url as an argument or is there

Re: Opening browser and url.

2015-06-25 Thread Bauss via Digitalmars-d-learn
On Thursday, 25 June 2015 at 14:05:54 UTC, MrSmith wrote: On Thursday, 25 June 2015 at 14:02:41 UTC, Bauss wrote: In other programming languages you can open a website in the default browser by spawning a process using the url, but it does not seem to work with D using spawnProcess(). Do I

Re: Get process

2016-01-05 Thread Bauss via Digitalmars-d-learn
Oh yeah I forgot to notice that by name would be preferred. Not title, but name.

Get process

2016-01-05 Thread Bauss via Digitalmars-d-learn
Looking at std.process I could not see a standard way of retrieving a process. Is there any and if not are the functions available for just windows somehow? I'm sure if there's no standard way I'd need to call the win api so if anyone could tell me which ones and/or the declarations if

Re: Dub selects wrong version

2016-05-20 Thread Bauss via Digitalmars-d-learn
On Saturday, 21 May 2016 at 05:03:14 UTC, ag0aep6g wrote: On 05/21/2016 06:54 AM, Bauss wrote: When I then compile with dub build I get this error: Selected package diamond 0.1.0 does not match the dependency specification >=0.2.1 <0.3.0 in package diamondtest. Need to "dub upgrade"? Have

Dub selects wrong version

2016-05-20 Thread Bauss via Digitalmars-d-learn
It seems like dub selects the wrong version of my package. I have tried the following: - Reinstall dub - Delete all packages - Clear dubs cache - Release new versions in the github repository - Update the dub package on code.dlang.org multiple times and it says it has the lates The issue is

Using -J with dub

2016-04-16 Thread Bauss via Digitalmars-d-learn
Is there a way to achieve using -J through dub, preferable through dub.json I can't seem to find anything through the dub.json docs on how to pass regular dmd flags.

Re: Which application is much suited and which is not.

2016-04-16 Thread Bauss via Digitalmars-d-learn
On Saturday, 16 April 2016 at 14:08:05 UTC, newB wrote: Let's say you have decided to use D programming language. For what kind of applications would you choose D programming language and For what kind of applications you won't choose D programming. I use D for pretty much everything. I

Re: Using -J with dub

2016-04-16 Thread Bauss via Digitalmars-d-learn
On Saturday, 16 April 2016 at 23:46:58 UTC, Zekereth wrote: On Saturday, 16 April 2016 at 20:57:10 UTC, Bauss wrote: Is there a way to achieve using -J through dub, preferable through dub.json I can't seem to find anything through the dub.json docs on how to pass regular dmd flags. For

Re: std.system reports win32 when running OS X

2017-02-02 Thread Bauss via Digitalmars-d-learn
On Thursday, 2 February 2017 at 08:42:44 UTC, Andrea Fontana wrote: On Wednesday, 1 February 2017 at 21:43:09 UTC, Ali Çehreli wrote: That's a local variable that you've defined. Since OS.init happens to be OS.win32, that's what you get. :) Maybe it should be "unknown" or "undefined" :)

Re: Compile to C?

2017-01-23 Thread Bauss via Digitalmars-d-learn
On Saturday, 21 January 2017 at 18:38:22 UTC, Nestor wrote: Hi friends, Is there a way to "compile" d code to C, similar to what nim does? That would be cool for greater portability. Nim is able to, because Nim doesn't really compile. The Nim compiler just translates Nim code to C code

Re: A bug?

2017-02-17 Thread bauss via Digitalmars-d-learn
On Wednesday, 15 February 2017 at 19:56:31 UTC, berni wrote: On Wednesday, 15 February 2017 at 16:11:36 UTC, drug wrote: No, you recursively call main() and get segfault (due to stack overflow) as expected I thought, that an stack overflow leeds to an exception. But that's not true, as I now

Re: Mixing libraries

2017-03-01 Thread bauss via Digitalmars-d-learn
On Tuesday, 28 February 2017 at 20:08:25 UTC, Jordan Wilson wrote: Hello, Been trying to learn the Simple Fast Multimedia Library (SFML) using the Derelict bindings, and noticed some functionality is offered by both SFML and the std library (for example, sfClock and sfMutex). Is there a

traits help

2016-09-18 Thread Bauss via Digitalmars-d-learn
I'm trying to retrieve all functions with a certain attribute. I know how to go about it and I can get it working with functions in the same module as the traits expression, but as soon as I nest modules in packages and import those packages then I don't get any functions. Is there a way to

Re: traits help

2016-09-18 Thread Bauss via Digitalmars-d-learn
On Sunday, 18 September 2016 at 13:28:15 UTC, ketmar wrote: https://issues.dlang.org/show_bug.cgi?id=11595 https://issues.dlang.org/show_bug.cgi?id=16044 Thanks that clarifies my issues... Do you if there are any statuses on that?

Re: Is there a way to identfy Windows version?

2016-11-23 Thread Bauss via Digitalmars-d-learn
On Tuesday, 22 November 2016 at 15:48:36 UTC, rumbu wrote: On Tuesday, 22 November 2016 at 11:00:52 UTC, Bauss wrote: [...] Obtaining the true Windows version is tricky starting with Windows 8. Be careful when using GetVersionEx, it's deprecated. VerifyVersionInfo is more reliable, but it

Re: Is there a way to identfy Windows version?

2016-11-22 Thread Bauss via Digitalmars-d-learn
On Monday, 21 November 2016 at 09:11:39 UTC, Jonathan M Davis wrote: On Monday, November 21, 2016 08:57:11 Bauss via Digitalmars-d-learn wrote: [...] Phobos doesn't have anything like that, but you can use the C functions from the Windows API to do it. A quick search turned up GetVersion

Is there a way to identfy Windows version?

2016-11-21 Thread Bauss via Digitalmars-d-learn
Is there a way to identify the Windows version? Such as if it's XP, Vista, 7, 8 or 10? Either some way to tweak with version flags or something in the standard library.

Re: is there "this"?

2016-11-02 Thread Bauss via Digitalmars-d-learn
On Wednesday, 2 November 2016 at 02:42:01 UTC, Konstantin Kutsevalov wrote: On Wednesday, 2 November 2016 at 02:33:10 UTC, Konstantin Kutsevalov wrote: On Wednesday, 2 November 2016 at 02:20:43 UTC, rikki cattermole wrote: On 02/11/2016 3:17 PM, Konstantin Kutsevalov wrote: [...] You forgot

Re: Easy sockets - don't exist yet?

2016-10-10 Thread Bauss via Digitalmars-d-learn
Wrote some pretty simple sockets that you could use (Based on vibe.d though.) https://github.com/bausshf/cheetah

Re: function is not callable using argument types ()

2016-12-12 Thread Bauss via Digitalmars-d-learn
On Saturday, 10 December 2016 at 08:41:56 UTC, Suliman wrote: import std.stdio; import std.concurrency; void main() { void sp(int i) { receive((int i) { writeln("i: ", i); }); } auto r = new Generator!int( { foreach(i; 1

Question about compile-time functions.

2016-12-13 Thread Bauss via Digitalmars-d-learn
If a function is only called during compile-time will it be available at runtime?

Re: Sanitizing forms in vibe.d. How?

2016-12-12 Thread Bauss via Digitalmars-d-learn
On Monday, 12 December 2016 at 10:25:05 UTC, aberba wrote: On Monday, 12 December 2016 at 00:42:54 UTC, Nicholas Wilson wrote: On Sunday, 11 December 2016 at 18:30:54 UTC, aberba wrote: You can enforce that the string that you receive is an email address with `isEmail` from `std.net.isemail`

Re: Get fils at compile-time

2016-12-14 Thread bauss via Digitalmars-d-learn
On Wednesday, 14 December 2016 at 20:47:23 UTC, bauss (wtf happend to my name took some old cached title LOL??) wrote: Is there a way to get all files in a folder at compile-time. To be more specific I want to import the content of all files within a specific folder during compile-time. I know

Re: Get fils at compile-time

2016-12-14 Thread Bauss via Digitalmars-d-learn
On Thursday, 15 December 2016 at 02:58:11 UTC, rikki cattermole wrote: I did a lot of work in this area. There are two solutions: 1) Use a package file and public import all modules via it. From this do some form of 'registration' in a module constructor. Using __traits(allMembers, retrieve

Re: Get fils at compile-time

2016-12-15 Thread Bauss via Digitalmars-d-learn
On Thursday, 15 December 2016 at 07:56:40 UTC, Jacob Carlborg wrote: On 2016-12-14 21:47, bauss (wtf happend to my name took some old cached title LOL??) wrote: [...] I would recommend creating a small script that iterates a directory and generates a D file with string imports for all the

Re: Using tango with dub

2016-12-17 Thread bauss via Digitalmars-d-learn
On Saturday, 17 December 2016 at 15:46:20 UTC, albert-j wrote: I am trying to use Tango in a dub project because I need a HashSet. I added Tango as a dependency to the dub.json, but now dub gives me a bunch of depreciation warnings and a few errors, like

Re: Auto recursive function

2017-01-12 Thread Bauss via Digitalmars-d-learn
On Thursday, 12 January 2017 at 00:30:33 UTC, Ignacious wrote: On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote: [...] If you change the return type to a void* your code basically works. void* makeMultidimensionalArray(T, Allocator)(auto ref Allocator alloc, size_t[]

Re: Use class template as a type

2016-11-30 Thread Bauss via Digitalmars-d-learn
On Tuesday, 29 November 2016 at 15:56:23 UTC, Jerry wrote: On Monday, 28 November 2016 at 11:26:41 UTC, dm wrote: ``` abstract class MyClass(T) { public: @property const(T) value(){return _value;} @property void value(T val){_value = val;} ... private: T _value; ... } To avoid

Re: Use class template as a type

2016-11-30 Thread Bauss via Digitalmars-d-learn
On Tuesday, 29 November 2016 at 09:58:16 UTC, ag0aep6g wrote: On 11/29/2016 02:21 AM, Basile B. wrote: The cast from a class type to a sub class in itself does absolutely nothing. That can't be right. A bad downcast gives you null, so it has to check the dynamic type information. Compare

Re: How to serialize a double.

2016-11-30 Thread Bauss via Digitalmars-d-learn
On Thursday, 1 December 2016 at 00:36:30 UTC, Jake Pittis wrote: How do I convert a double to a ubyte[]? I've tried all sorts of things including converting the double to a ulong and trying to serialize the ulong. For example test bellow fails. unittest { double d = 3.14; ulong

Re: Imports incorrectly part of "allMembers" trait output?

2017-01-02 Thread bauss via Digitalmars-d-learn
On Monday, 2 January 2017 at 18:56:40 UTC, Mike Bierlee wrote: When compiling the following code with DMD 2.072.2: class LeClass { import std.stdio; } void main() { foreach (memberName; __traits(allMembers, LeClass)) { pragma(msg, memberName); } } The

Re: String characters not extended

2017-01-02 Thread bauss via Digitalmars-d-learn
On Monday, 2 January 2017 at 21:07:37 UTC, Ignacious wrote: when one prints out a string with some extended(I guess it's unicode), writeln prints out the ascii versions that do not correspond to what they really are. e.g., an umlaut is printed out as 1/2 or something. how to get it to print

Re: returning struct, destructor

2016-12-21 Thread bauss via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 15:01:20 UTC, Eugene Wissner wrote: On Wednesday, 21 December 2016 at 14:15:06 UTC, John C wrote: On Wednesday, 21 December 2016 at 11:45:18 UTC, Eugene Wissner wrote: This prints 3 times "Destruct" with dmd 0.072.1. If I remove the if block, it prints

Re: How to continue after the book?

2017-03-28 Thread bauss via Digitalmars-d-learn
On Tuesday, 28 March 2017 at 07:27:31 UTC, I Lindström wrote: After getting the basics down, how did you continue when learning programming in general? I do have a need for which I've been trying out a few languages and D seems by far the best for me. Should I just start doing that project

Re: Howto catch SocketOSException?

2017-03-26 Thread bauss via Digitalmars-d-learn
On Sunday, 26 March 2017 at 11:46:39 UTC, Jolly James wrote: On Sunday, 26 March 2017 at 11:35:00 UTC, Jolly James wrote: [...] Found out something: You cannot catch any exception thrown in the listen()-method in general. ■ Original code: [...] ■ Modified one: [...] ■ Not working

Re: Why is this legal?

2017-03-30 Thread bauss via Digitalmars-d-learn
On Wednesday, 29 March 2017 at 10:08:02 UTC, abad wrote: Related question, it seems that final methods are allowed in interfaces. Obviously you can't implement them anywhere, so is this also on purpose and on what rationale? :) That is not necessarily true. Final doesn't imply it can't be

Re: Howto catch SocketOSException?

2017-03-25 Thread bauss via Digitalmars-d-learn
On Sunday, 26 March 2017 at 00:34:03 UTC, Jolly James wrote: How do you catch an std.socket.SocketOSException? The following does not work, as the exception occurs anyway and leads to a crash: import ae.net.asockets; void main(string[] args) { TcpServer tcp = new TcpServer();

Re: union.sizeof

2017-03-25 Thread bauss via Digitalmars-d-learn
On Saturday, 25 March 2017 at 23:36:07 UTC, kinke wrote: On Saturday, 25 March 2017 at 22:45:22 UTC, ketmar wrote: zabruk70 wrote: [...] `align(1) union Union1` will do the trick. what you did is members packing. but the union itself is padded to integer size too. i.e. internal `align`

Re: questions about dub

2017-03-21 Thread bauss via Digitalmars-d-learn
On Tuesday, 21 March 2017 at 21:01:31 UTC, thorstein wrote: Hi, I have questions regarding the usage of 'dub'. I'm learning D under Win7. I have installed VisualD for the community edition of Visual Studio and got some file i/o working. Next I would like to continue with the mir-tools for

Re: How to get inner most nested struct

2017-03-16 Thread bauss via Digitalmars-d-learn
On Friday, 17 March 2017 at 01:52:20 UTC, Hussien wrote: On Friday, 17 March 2017 at 01:19:54 UTC, Adam D. Ruppe wrote: On Friday, 17 March 2017 at 00:34:22 UTC, Hussien wrote: Anyway to do this? I don't think you can, the inner anonymous structs are just to organize the members and group

Re: Is there a more elegant way to do this?

2017-03-11 Thread bauss via Digitalmars-d-learn
On Sunday, 12 March 2017 at 05:13:41 UTC, bauss wrote: I was wondering if there's a more elegant way to do something like this? [...] I saw one improvement to it which would be BitSize!ChildType instead of taking parent type's bit size divided by two. Also value = ((highValue << 16 |

Is there a more elegant way to do this?

2017-03-11 Thread bauss via Digitalmars-d-learn
I was wondering if there's a more elegant way to do something like this? template BitSize(T) { enum BitSize = T.sizeof * 8; } struct Data(ParentType,ChildType) { @property { ChildType low() { return cast(ChildType)value; } void low(ChildType

Re: TLS

2017-03-10 Thread bauss via Digitalmars-d-learn
On Friday, 10 March 2017 at 07:33:44 UTC, M-exe wrote: On Friday, 10 March 2017 at 07:17:22 UTC, rikki cattermole wrote: D does not support Windows XP. If you absolutely require it, you will have to contact Walter about support. Let me care about it ;) I just need help with the TLS :) Mark

Re: Building a project with CMAKE

2017-03-02 Thread bauss via Digitalmars-d-learn
On Thursday, 2 March 2017 at 12:42:00 UTC, Russel Winder wrote: On Tue, 2017-02-28 at 17:09 +, berni via Digitalmars-d-learn wrote: [...] I do not have an immediate answer, but… CLion requires CMake, with CMake-D in a fit state we could use CLion with D – albeit very rough and ready

Re: Need help to get OpenSSL 64 work on Windows x64 | I hate D's GC!

2017-07-14 Thread bauss via Digitalmars-d-learn
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

Re: Fiber based UI-Toolkit

2017-07-09 Thread bauss via Digitalmars-d-learn
On Sunday, 9 July 2017 at 19:43:14 UTC, Christian Köstlin wrote: I wonder if there is any fiber based / fiber compatible UI-Toolkit out for dlang. The second question is, if it would make sense at all to have such a thing? christian It doesn't really make sense to have that, because most

Re: Fiber based UI-Toolkit

2017-07-10 Thread bauss via Digitalmars-d-learn
On Monday, 10 July 2017 at 08:40:15 UTC, Jacob Carlborg wrote: On 2017-07-09 23:12, bauss wrote: I believe OSX (possibly macOS too.) only allows it from the main thread. Yes, that's correct. But what's the difference between OSX and macOS ;) Well besides that it's newer versions of the

Re: Panda Antivirus puts the latest dmd installer in quarantine

2017-07-06 Thread bauss via Digitalmars-d-learn
On Thursday, 6 July 2017 at 18:33:35 UTC, Ecstatic Coder wrote: But no problem with any file stored inside the current .7z archive file. So I guess the problem comes from the installer executable itself. Please try to fix this as soon as possible, as this immediately drives people away

Re: Application settings

2017-07-07 Thread bauss via Digitalmars-d-learn
On Friday, 7 July 2017 at 22:52:22 UTC, FoxyBrown wrote: On Friday, 7 July 2017 at 20:45:36 UTC, Moritz Maxeiner wrote: On Friday, 7 July 2017 at 19:40:35 UTC, FoxyBrown wrote: What's the "best" way to do this? I want something I can simply load at startup in a convenient and easy way then

Auto-decoding

2017-07-14 Thread bauss via Digitalmars-d-learn
I understand what it is and how it works, but I don't understand anything of how it solves any problems? Could someone give an example of when auto-decoding actually is useful in contrast to not using it? Just trying to get an understanding of what exactly its purpose is. I did read

Re: Base class' constructor is not implicitly inherited for immutable classes. A bug or a feature?

2017-07-20 Thread bauss via Digitalmars-d-learn
On Wednesday, 19 July 2017 at 16:00:56 UTC, Piotr Mitana wrote: Hello, I have this code: immutable class Base { this() {} } immutable class Derived : Base {} void main() { new immutable Derived(); } I'd like class Derived to automatically inherit the default constructor from

Re: opEquals nothrow

2017-07-20 Thread bauss via Digitalmars-d-learn
On Thursday, 20 July 2017 at 14:38:03 UTC, Aldo wrote: Hello, im tring to add nothrow keyword in my code, but compilation fails : function 'object.opEquals' is not nothrow its a simple comparison between 2 objects. How to make opEquals nothrow ? thanks Could you show some code.

Re: D doesn't read the first character of a file (reads everything but the first chararacter) with either read() or readText()

2017-07-19 Thread bauss via Digitalmars-d-learn
On Wednesday, 19 July 2017 at 15:18:00 UTC, Steven Schveighoffer wrote: On 7/17/17 10:21 PM, Enjoys Math wrote: DMD32 D Compiler v2.074.1 import std.file; void main() { string bigInput = readText("input.txt"); } The file is 7 MB of ascii text, don't know if that matters... Should I

Get Function Body

2017-06-30 Thread bauss via Digitalmars-d-learn
Is there a way to retrieve the body of a function as a string? Scenario. I want to pass a function to a mixin template and just mixin the body of the function. Ex. mixin template Foo(alias fun) { void bar() { mixin(getBodyOfFun(fun)); } } I'm aware that I can pass a string

Re: Get Function Body

2017-06-30 Thread bauss via Digitalmars-d-learn
On Friday, 30 June 2017 at 16:43:33 UTC, Stefan Koch wrote: On Friday, 30 June 2017 at 16:38:45 UTC, bauss wrote: Is there a way to retrieve the body of a function as a string? Scenario. I want to pass a function to a mixin template and just mixin the body of the function. Ex. mixin

ReadProcessMemory + address from ollydbg

2017-06-30 Thread bauss via Digitalmars-d-learn
I'm currently getting garbage data when using ReadProcessMemory to read from another process. This is my definition: BOOL ReadProcessMemory(HANDLE hProcess, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, SIZE_T *lpNumberOfBytesRead); And I'm reading it like this: if

Re: ReadProcessMemory + address from ollydbg

2017-06-30 Thread bauss via Digitalmars-d-learn
On Friday, 30 June 2017 at 21:36:25 UTC, ag0aep6g wrote: On Friday, 30 June 2017 at 20:14:15 UTC, bauss wrote: This is my definition: BOOL ReadProcessMemory(HANDLE hProcess, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, SIZE_T *lpNumberOfBytesRead); And I'm reading it like this: if

Re: ReadProcessMemory + address from ollydbg

2017-06-30 Thread bauss via Digitalmars-d-learn
On Friday, 30 June 2017 at 23:41:19 UTC, bauss wrote: On Friday, 30 June 2017 at 21:36:25 UTC, ag0aep6g wrote: On Friday, 30 June 2017 at 20:14:15 UTC, bauss wrote: [...] I guess the first cast is necessary when `address` isn't typed as a pointer yet. But the other casts shouldn't be

Re: ReadProcessMemory + address from ollydbg

2017-06-30 Thread bauss via Digitalmars-d-learn
On Friday, 30 June 2017 at 23:56:10 UTC, Stefan Koch wrote: On Friday, 30 June 2017 at 23:53:19 UTC, bauss wrote: I suspect the address is wrong, but it's the static address I picked up from ollydbg, so I'm kinda lost as for how ollydbg can get the correct string and I get the wrong one

Re: ReadProcessMemory + address from ollydbg

2017-06-30 Thread bauss via Digitalmars-d-learn
On Saturday, 1 July 2017 at 00:23:36 UTC, ag0aep6g wrote: On 07/01/2017 01:41 AM, bauss wrote: string ReadWinString(HANDLE process, DWORD address, size_t stringSize, string defaultValue = "") { if (!process || !address) { return defaultValue; } SIZE_T bytesRead; char[1024]

Re: ReadProcessMemory + address from ollydbg

2017-06-30 Thread bauss via Digitalmars-d-learn
On Saturday, 1 July 2017 at 00:40:11 UTC, ag0aep6g wrote: On 07/01/2017 02:30 AM, bauss wrote: On Saturday, 1 July 2017 at 00:23:36 UTC, ag0aep6g wrote: On 07/01/2017 01:41 AM, bauss wrote: [...] if (!ReadProcessMemory(process, cast(PCVOID)address, cast(PVOID), The second cast

Re: ReadProcessMemory + address from ollydbg

2017-07-01 Thread bauss via Digitalmars-d-learn
On Saturday, 1 July 2017 at 00:48:01 UTC, bauss wrote: On Saturday, 1 July 2017 at 00:40:11 UTC, ag0aep6g wrote: [...] Yeah, the cast was unnecessary. So this is my code after the changes: string ReadWinString(HANDLE process, DWORD address, size_t stringSize, string defaultValue = "") {

Re: Finding all the interfaces and their inheritance relationships at runtime

2017-07-03 Thread bauss via Digitalmars-d-learn
On Monday, 3 July 2017 at 13:54:42 UTC, Jean-Louis Leroy wrote: I know how to find all the classes: foreach (mod; ModuleInfo) { foreach (c; mod.localClasses) { // use c.base to construct inheritance graph } } Can I do the same with all the interfaces? Looking at

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-27 Thread bauss via Digitalmars-d-learn
On Tuesday, 27 June 2017 at 10:14:16 UTC, Jonathan M Davis wrote: On Tuesday, June 27, 2017 09:54:19 John Burton via Digitalmars-d-learn wrote: [...] Arguably, std.socket should have used structs instead of classes for sockets for precisely this reason (though there are some advantages in

Re: avoid extra variable during void pointer cast

2017-05-15 Thread Bauss via Digitalmars-d-learn
On Sunday, 14 May 2017 at 21:07:36 UTC, Marco Leise wrote: Am Sun, 14 May 2017 20:18:24 + schrieb Kevin Brogan : [...] No, that is not possible. An alias can only be assigned a symbol. [...] Let the compiler optimize the assignment away and don't worry much about

Re: D equivalent of C++11's function local static initialization?

2017-05-17 Thread bauss via Digitalmars-d-learn
On Wednesday, 17 May 2017 at 03:08:39 UTC, Timothee Cour wrote: NOTE: curious about both cases: * thread local * shared On Tue, May 16, 2017 at 8:04 PM, Timothee Cour wrote: what's the best D equivalent of C++11's function local static initialization? ``` void

Re: Cheetah: Keeping track of multiple connected clients

2017-05-16 Thread bauss via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 16:01:49 UTC, aberba wrote: Does anyone know how to keep track of multiple clients in Cheetah socket lib such that one can directly message a client or broadcast to all connected clients. Something like: onMessage(... e) { ... // send to all

Re: GDC generate wrong .exe ("not a valid win32 application")

2017-06-22 Thread bauss via Digitalmars-d-learn
On Wednesday, 21 June 2017 at 15:55:27 UTC, David Nadlinger wrote: On Monday, 19 June 2017 at 14:08:56 UTC, Patric Dexheimer wrote: Fresh install of GDC. (tried with 32x ad 32_64x) Where did you get the GDC executable from? The GDC project doesn't currently offer any official builds that

Re: Clean Executable

2017-06-27 Thread bauss via Digitalmars-d-learn
On Tuesday, 27 June 2017 at 14:21:50 UTC, FoxyBrown wrote: How can we clean an exe from the junk library functions that are not actually used by an app. e.g., a hello world program shouldn't be 500+kb. I release there are necessary extras like the GC, but hell, in a hello world program is it

Re: Cheetah: Keeping track of multiple connected clients

2017-05-18 Thread bauss via Digitalmars-d-learn
On Thursday, 18 May 2017 at 11:44:57 UTC, aberba wrote: On Tuesday, 16 May 2017 at 21:56:16 UTC, aberba wrote: On Tuesday, 16 May 2017 at 17:49:07 UTC, bauss wrote: [...] It really awesome the way you responded quickly. About targeting a client, suppose I have clients A, B, and C. Message

Re: Which editor to use for editing DDOCs?

2017-05-23 Thread bauss via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 07:40:21 UTC, biocyberman wrote: On Monday, 22 May 2017 at 15:33:36 UTC, Russel Winder wrote: [...] Adding DDOC support for D Mode require some more work obviously. I will see if I can make some changes to that. For the time being, I would like to know which

Re: String Comparison Operator

2017-04-30 Thread bauss via Digitalmars-d-learn
On Sunday, 30 April 2017 at 16:15:41 UTC, Xinok wrote: On Sunday, 30 April 2017 at 15:31:39 UTC, Jolly James wrote: Is there a String Comparison Operator in D? Yeah, just the usual comparison operators: "abc" == "abc" "abc" != "ABC" ~ is for string concatenation, i.e.: "abc" ~ "def" ==

Re: alias can't find symbol or can't use symbol

2017-04-29 Thread bauss via Digitalmars-d-learn
On Sunday, 30 April 2017 at 00:17:37 UTC, Carl Sturtivant wrote: Consider the following. struct member { int n; } struct outer { member x; alias x this; alias n2 = n; } This does not compile: alias n2 = n; Error: undefined identifier 'n' On the other hand if change that into

Re: How to declare "abstract" delegates list?

2017-05-06 Thread bauss via Digitalmars-d-learn
On Friday, 5 May 2017 at 14:20:43 UTC, RedCAT wrote: Hello! Is it possible to create a list of slightly different delegates? For example, there is a class hierarchy: class Base; class DerivedOne : Base; class DerivedTwo : Base; And there are several delegates: void delegate(int, Base); void

Re: How to declare "abstract" delegates list?

2017-05-06 Thread bauss via Digitalmars-d-learn
On Saturday, 6 May 2017 at 06:07:01 UTC, bauss wrote: On Friday, 5 May 2017 at 14:20:43 UTC, RedCAT wrote: [...] I would do something like this: [...] You could also do use alias this to use the delegate instead of the class encapsulating the delegate.

Re: Productive vibe.d dev environment (IDE, debugger) on Linux?

2017-05-04 Thread bauss via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 17:43:07 UTC, kinke wrote: Hey guys, can anyone recommend a more or less production-ready dev environment for vibe.d on Linux? I'm evaluating vibe.d against Phoenix (Elixir/Erlang) for a new project. Today I gave Visual Studio Code a quick shot (with LDC 1.1.1 and

Re: How to call function with variable arguments at runtime?

2017-10-10 Thread bauss via Digitalmars-d-learn
On Tuesday, 10 October 2017 at 02:58:45 UTC, Mr. Jonse wrote: I need to store a hetrogeneous array of delegates. How can I do this but still call the function with the appropriate number of parameters at run time? I have the parameters as Variant[] params and a function/delegate

Re: How to make commented code to compile?

2017-10-10 Thread bauss via Digitalmars-d-learn
On Monday, 9 October 2017 at 15:22:54 UTC, Adam D. Ruppe wrote: On Monday, 9 October 2017 at 15:15:48 UTC, Zhuo Nengwen wrote: test(cast(ushort) 1, (m, c) => { writeln(m); writeln(m); }); Just remove the => (m, c) { // code here } Common mistake from people who worked with LINQ in

Re: Does D have an equivalent to C#'s String.IsNullOrWhiteSpace?

2017-10-13 Thread bauss via Digitalmars-d-learn
On Thursday, 12 October 2017 at 18:17:54 UTC, Adam D. Ruppe wrote: On Thursday, 12 October 2017 at 18:11:55 UTC, Nieto wrote: Does D have an equivalent to C#'s String.IsNullOrWhiteSpace() in the standard library? import std.string; if(str.strip().length == 0) { // is null, empty, or all

Re: High-level wrapper for readline package

2017-09-07 Thread bauss via Digitalmars-d-learn
On Thursday, 7 September 2017 at 14:00:36 UTC, Nordlöw wrote: On Thursday, 7 September 2017 at 13:44:52 UTC, Adam D. Ruppe wrote: [...] There's always room for usability improvements when wrapping C APIs... [...] Isn't it pointless to make "prompt" in?

Re: Web servers in D

2017-09-02 Thread bauss via Digitalmars-d-learn
On Friday, 25 August 2017 at 05:25:09 UTC, Hasen Judy wrote: What libraries are people using to run webservers other than vibe.d? Don't get me wrong I like the async-io aspect of vibe.d but I don't like the weird template language and the fact that it caters to mongo crowd. I think for D

Re: Web servers in D

2017-09-02 Thread bauss via Digitalmars-d-learn
On Saturday, 2 September 2017 at 20:18:17 UTC, bauss wrote: On Friday, 25 August 2017 at 05:25:09 UTC, Hasen Judy wrote: [...] Here is another template engine that can be used along with vibe. I actually made it for the same reason you don't wanna use vibe. Because I didn't like the

Re: ESR on post-C landscape

2017-11-14 Thread bauss via Digitalmars-d-learn
On Tuesday, 14 November 2017 at 04:31:43 UTC, Laeeth Isharc wrote: He mentions D, a bit dismissively. http://esr.ibiblio.org/?p=7724=1#comment-1912717 Couldn't read that without cringing.

Re: Is variable void?

2017-11-27 Thread bauss via Digitalmars-d-learn
On Monday, 27 November 2017 at 02:12:40 UTC, codephantom wrote: On Saturday, 25 November 2017 at 15:34:21 UTC, John Chapman wrote: Is there any way of determining whether a variable has been initialized or not? For example, if something is declared like this: int x = void; can I check if

  1   2   3   4   >