Re: Bug after update to 2.072?

2016-11-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 6 November 2016 at 01:11:34 UTC, Alex wrote: dub dustmite ../dm2 --program-status=11 Try --program-status=139 (139 is 128 + 11)

Re: Dustmite can't handle my memory segfault

2016-10-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 20 October 2016 at 21:33:59 UTC, Nordlöw wrote: I need your help here, I'm complete stuck. Vladimir? If you see output even after redirecting stdout and stderr, the program is probably writing to /dev/tty or similar. I'm not sure what the "proper" way is to run a program without

Re: Why can't static arrays be sorted?

2016-10-04 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 4 October 2016 at 20:05:15 UTC, TheGag96 wrote: I was writing some code today and ran into this oddity that I'd never come across before: import std.algorithm : sort; int[10] arr = [0, 3, 4, 6, 2, 1, 1, 4, 6, 9]; thing.sort(); This doesn't compile. Obviously the .sort p

Re: Macintosh text file with invalid line breaks are created

2016-09-28 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 28 September 2016 at 06:52:51 UTC, Andre Pany wrote: Hi, following application creates a text file with strange content: void writeTextFile(string filePath, string text) { import std.stdio: File; auto f = File(filePath, "w"); f.write(text); f.close(

Re: Problem parsing IPv4/IPv6 addresses with std.socket.parseAddress

2016-09-28 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 28 September 2016 at 15:34:56 UTC, Dsciple wrote: I don't understand what prevents such function (in turn calling some OS-level C function) from doing its job at compile time too. Guess it's a very challanging thing to do at compile-time, or should I open an issue with the std.soc

Re: Does D has any support for thunks?

2016-06-25 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 25 June 2016 at 13:44:48 UTC, Andre Pany wrote: Does D/Phobos has any support for thunks? Made this a while ago: http://stackoverflow.com/a/8656294/21501

Re: vibe.d - asynchronously wait() for process to exit

2016-06-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 20 June 2016 at 19:39:42 UTC, Steven Schveighoffer wrote: On 6/20/16 12:29 PM, Vladimir Panteleev wrote: On Monday, 20 June 2016 at 16:16:32 UTC, Steven Schveighoffer wrote: What is the OS support for waitid (http://man7.org/linux/man-pages/man2/waitpid.2.html)? Seems to have

Re: vibe.d - asynchronously wait() for process to exit

2016-06-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 20 June 2016 at 16:16:32 UTC, Steven Schveighoffer wrote: What is the OS support for waitid (http://man7.org/linux/man-pages/man2/waitpid.2.html)? Seems to have support for async waiting of multiple processes (at least it can return immediately if no child has exited). One considera

Re: Different struct sizeof between linux and windows

2016-06-17 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 17 June 2016 at 16:16:48 UTC, Kagamin wrote: On Friday, 17 June 2016 at 13:21:04 UTC, Vladimir Panteleev wrote: Windows does not have the concept of "time_t". The C runtime in use does. The D bindings don't copy that behavior. D defining C runtime type different

vibe.d - asynchronously wait() for process to exit

2016-06-17 Thread Vladimir Panteleev via Digitalmars-d-learn
std.process.wait() will wait for a child process to exit and return its exit code. How can this be done in Vibe.d, without blocking other fibers and without creating a new thread? In my library I did it like this: https://github.com/CyberShadow/ae/blob/master/sys/process.d (register a SIGCHLD

Re: Different struct sizeof between linux and windows

2016-06-17 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 17 June 2016 at 13:11:35 UTC, Kagamin wrote: time_t is 64-bit on windows: https://msdn.microsoft.com/en-us/library/1f4c8f33.aspx Windows does not have the concept of "time_t". The C runtime in use does. We use the DigitalMars C runtime for the 32-bit model, which is the default o

Re: Different struct sizeof between linux and windows

2016-06-17 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 17 June 2016 at 06:54:36 UTC, Andre Pany wrote: Is this behavior correct? Yes. time_t is defined as C long on Linux (meaning it'll be 64-bit in 64-bit programs), however it's always 32-bit on the Windows C runtimes we use.

Re: An Alternative to Deimos' OpenSSL Bindings

2016-06-12 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 12 June 2016 at 19:12:37 UTC, Meta wrote: I wanted to use OpenSSL from D but I noticed that the Deimos bindings are for version 1.0.0e, which according to OpenSSL.org is an out of date version. Are there any bindings for the latest version, or an alternative that I could use? I know

Re: core.sys.windows so lean?

2016-06-06 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 6 June 2016 at 16:51:20 UTC, Jonathan Marler wrote: Hmmm...it seems to be missing quite alot though. You could've mentioned you meant just the winsock modules. They have not been brought over because they were not explicitly under an open-source license.

Re: core.sys.windows so lean?

2016-06-06 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 6 June 2016 at 16:04:30 UTC, Jonathan Marler wrote: I'm writing some platform specific D code and I've found that what the druntime exposes for the windows platform is pretty lean. I'm guessing that the purpose of the druntime version of the windows api is to implement the minimum r

Re: Small-Size-Optimized Array

2016-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 16 May 2016 at 11:05:40 UTC, Nordlöw wrote: Does Phobos contain any standard small-size-optimized (SSO) array that starts with a stack array and union-converts into a standard builtin D-array when grown beyond the size of the stack array? Have a look at tempCString, but it's for in

Re: Is it bug compiler?

2016-05-12 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 12 May 2016 at 13:20:35 UTC, MGW wrote: Windows 7 32bit --- import std.stdio; import std.conv; class CFormaMain { ~this() { char[] zz = [ 'A', 'B', 'C' ]; writeln(to!string(zz)); } } int main(string[] args) {

Re: What is up with building DMD (et al.) on Windows?

2016-05-11 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 10 May 2016 at 04:48:23 UTC, Jeremy DeHaan wrote: After DMD is built, other things keep getting built by DMC. I get more than a few errors due to having an eof character on the first line of some .h files, or something like that. I've never seen such an error. Do you have the detai

Re: static import (v2.071.0)

2016-05-11 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 11 May 2016 at 14:26:37 UTC, Vladimir Panteleev wrote: On Wednesday, 11 May 2016 at 14:24:03 UTC, Chris wrote: I was wondering if `static import std.file;` `if (exists(file))` will only import `std.file.exists` or the whole lot of `std.file`? I want to find out what the best

Re: static import (v2.071.0)

2016-05-11 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 11 May 2016 at 14:24:03 UTC, Chris wrote: I was wondering if `static import std.file;` `if (exists(file))` will only import `std.file.exists` or the whole lot of `std.file`? I want to find out what the best strategy for imports is now. Modules are always imported wholesale as

Re: static import (v2.071.0)

2016-05-11 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 11 May 2016 at 14:11:46 UTC, Chris wrote: I'm updating my code to 2.071.0 at the moment. Naturally, I get a lot of warnings like `module std.uni is not accessible here, perhaps add 'static import std.uni;'` Will `static import` bloat my exe or simply access the members I use?

Re: Getting the current module as a symbol

2016-04-13 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 13 April 2016 at 11:36:07 UTC, Mithun Hunsur wrote: Yeah, that also works; you have to define a symbol (if you don't have one you can already use) in order to get to it, so it's a little wasteful. Still useful to know, though! No, it's not necessary. You should be able to walk th

Re: Getting the current module as a symbol

2016-04-12 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 12 April 2016 at 13:44:07 UTC, Mithun Hunsur wrote: Hi all, I'm looking for the equivalent of `typeof(this)` in module scope (so that it gets the current module). My use-case is iterating over the members of the module - right now I'm doing `mixin(iterateOverModule!(module.name.h

Re: Is it legal to use std.windows modules?

2016-04-11 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 12 April 2016 at 02:23:40 UTC, Vladimir Panteleev wrote: http://dlang.org/phobos-prerelease/std_windows_syserror.html Due to a simple omission, the documentation has not propagated from /phobos-prerelease/ to /phobos/: Err, to correct/expand on that, the documentation has

Re: Is it legal to use std.windows modules?

2016-04-11 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 8 April 2016 at 22:50:05 UTC, FreeSlave wrote: std.windows.syserror and others have documentation comments, but they are not listed in online documentation on dlang.org. Is it ok to use functions and classes from this modules in D applications? They were documented a while ago: ht

Re: State of windows DLL support

2016-04-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 3 April 2016 at 15:32:00 UTC, rikki cattermole wrote: On 04/04/2016 2:34 AM, Vladimir Panteleev wrote: [...] LabVIEW is the one that calls the functions. You declare the signature there. Nothing fancy pretty much limited to c here. From what I've ready anyway. So ho

Re: State of windows DLL support

2016-04-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 3 April 2016 at 14:19:17 UTC, rikki cattermole wrote: The link is there as a backup plan. I made the assumption that it may not be possible to have more than one D shared lib loaded during the lifetime. The idea is simple. Have a D shared lib that acts as a dynamic dispatch to the ap

Re: State of windows DLL support

2016-04-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 3 April 2016 at 13:50:20 UTC, rikki cattermole wrote: On 04/04/2016 12:55 AM, Nicholas Wilson wrote: On Sunday, 3 April 2016 at 12:20:33 UTC, rikki cattermole wrote: I'm just guessing context here. Oh. Needed functionality is in DLL. Need it in LV. Can't / don't know how to in LV.

Re: Direntries seems to on other drives. (windows)

2016-04-02 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 1 April 2016 at 02:05:23 UTC, Taylor Hillegeist wrote: Even though i just checked for a valid path. [...] if(!args[1].buildNormalizedPath.isValidPath){writeln("Path is invalid! "); return;} From https://dlang.org/library/std/path/is_valid_path.html : It does *not* check whet

Re: Dustmiting a dmft assert

2016-03-30 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 09:06:20 UTC, Nicholas Wilson wrote: object.Exception@dustmite.d(244): Initial test fails Works for me: $ cat src/test.d import std.stdio; void main() { writeln("foo"); writeln("bar"); } $ dustmite src "cat test.d 2>&1 | grep -qF foo && dmd -c t

Re: Trying to use Dustmite on windows

2016-03-22 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 22 March 2016 at 09:11:52 UTC, Jerry wrote: So I want to pass my DUB project to Dustmite and use findstr For reducing dub projects, try the "dub dustmite" command, e.g. "--compiler-regex=Assertion failure".

Re: dub dustmite: Initial test fails

2016-02-23 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 23 February 2016 at 11:09:00 UTC, denizzzka wrote: Hi! I have a code with segfault. I decided to try to take advantage with dub dustmite: $ dub dustmite ~/ssd/pgator_dustmite0 --program-status=139 -- --config=my_pgator.conf --debug=true Shells process signal exit codes in a spe

Re: Assert failure on 2.070.0 without stack trace

2016-01-28 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 28 January 2016 at 18:01:09 UTC, Nordlöw wrote: After upgrading to 2.070.0 I get an assert failure in my application that wasn't there before: core.exception.AssertError@knet/linking.d(235): Assertion failure Why isn't there any stacktrace? I thought has been fixed. Please help

Re: socketpair

2015-12-30 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 31 December 2015 at 02:37:07 UTC, sanjayss wrote: OK; one way I realized was to put the network socket select in one thread and the watching for keypress in another thread and then use the concurrency primitives to message pass events to the main thread -- may be a little expensive

Re: win32 from master: unicode functions by default?

2015-11-13 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 13 November 2015 at 08:10:12 UTC, Kagamin wrote: On Thursday, 12 November 2015 at 15:58:53 UTC, Jonathan M Davis wrote: It seems pretty wrong for the A versions to be the default though... For my money it's a plain bug in bindings :) Yep, we don't support non-Unicode Windows versi

Can't call nested template function unless it's anonymous?

2015-11-04 Thread Vladimir Panteleev via Digitalmars-d-learn
/ test.d / // Call alias with a parameter. void callAlias(alias f)() { f(42); } alias Identity(alias X) = X; void main() { int local; // Declare an anonymous function template // which writes to a local. alias a = Identity!((i)

Re: Can't get winapi working

2015-11-01 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 1 November 2015 at 17:52:08 UTC, dozksaw wrote: I have copied the win32 directory from his github. Try the official repository: https://github.com/smjgordon/bindings/tree/master/win32 These headers will also be available as core.sys.windows.* starting with D 2.070.

Re: Compilation time profiling

2015-10-25 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 25 October 2015 at 12:21:33 UTC, tired_eyes wrote: On Saturday, 24 October 2015 at 22:16:35 UTC, Vladimir Panteleev wrote: On Saturday, 24 October 2015 at 21:56:05 UTC, tired_eyes wrote: Hi, are there any tools for compilation time profiling? I'm trying to find what part of the

Re: Compilation time profiling

2015-10-24 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 24 October 2015 at 21:56:05 UTC, tired_eyes wrote: Hi, are there any tools for compilation time profiling? I'm trying to find what part of the code increases compilation time and don't want to stumble around. There's this: https://github.com/CyberShadow/DBuildStat Example output

Re: What's wrong in this templatized operator overload ?

2015-10-21 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 22 October 2015 at 03:21:35 UTC, MobPassenger wrote: On Thursday, 22 October 2015 at 03:18:25 UTC, MobPassenger wrote: code: Plz don't reply, there's been a forum bug while posting. What forum bug would that be?

Re: AWS API Dlang, hmac sha256 function.

2015-10-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 5 October 2015 at 19:43:39 UTC, holo wrote: @Vladimir where can i check or do you know when next version of phobos will be available? You can use Digger to get the latest version of D: https://github.com/CyberShadow/Digger

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 3 October 2015 at 03:11:06 UTC, holo wrote: Last but not least, how to write such function in D: def sign(key, msg): return hmac.new(key, msg.encode("utf-8"), hashlib.sha256).digest() ? I can't find in standard libraryt hmac function, is it existing? The next version of D

Re: Unexpected behavior when casting away immutable

2015-09-22 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 03:39:02 UTC, Mike Parker wrote: ``` immutable int x = 10; int* px = cast(int*)&x; *px = 9; writeln(x); ``` It prints 10, where I expected 9. This is on Windows. I'm curious if anyone knows why it happens. Essentially, because x is immutable, the compiler op

Re: text wrap

2015-09-19 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 20 September 2015 at 00:22:17 UTC, Joel wrote: What is simple way to wrap a string into strings? Eg from: I went for a walk and fell down a hole. To (6 max width): I went for a walk and fell down a hole. http://dlang.org/phobos/std_string.html#.wrap

Re: Why is sort allocating in this case?

2015-09-18 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 18 September 2015 at 02:21:13 UTC, Jack Stouffer wrote: The docs explicitly say that SwapStrategy.unstable is non-allocating, but this code (which is for finding the statistical mode of a range) will fail to compile. Perhaps related to this issue you filed? https://issues.dlang.org

Re: MmFile : Is this std.mmFile BUG?

2015-09-01 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 26 August 2015 at 17:30:29 UTC, Alex Parrill wrote: it shouldn't segfault though. The segfault is because of: https://issues.dlang.org/show_bug.cgi?id=14993 It "should've" been an InvalidMemoryOperationError, which in turn was caused by: https://issues.dlang.org/show_bug.cgi?

Re: How to use Registry Windows ?

2015-08-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 29 August 2015 at 09:44:06 UTC, medhi558 wrote: I just tried with administrator rights, but it doesn't work. You need to use a REGSAM value (e.g. KEY_ALL_ACCESS) to open the key with write access: /// test.d /// import std.windows.registry; void

Re: How to use Registry Windows ?

2015-08-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 29 August 2015 at 09:35:47 UTC, medhi558 wrote: It doesn't always work the same error. Is your program running with administrator rights? Unprivileged programs may not write to HKEY_LOCAL_MACHINE by default.

Re: Should this compile?

2015-08-25 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 25 August 2015 at 18:19:40 UTC, tchaloupka wrote: import std.stdio; import std.range : chain; auto test(string a) { return test(a, "b"); } auto test(string a, string b) { return chain(a, b); } void main() { writeln(test(a)); } Ends with: Error: forward reference to inf

Re: Digger 2.3 & verstr.h problem

2015-08-25 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 25 August 2015 at 07:32:50 UTC, Robert M. Münch wrote: On 2015-08-24 14:27:52 +, Vladimir Panteleev said: Well, yes, your problem is that DMD 2.067 isn't finding a file while compiling DMD HEAD. So you would need to debug DMD 2.067 to find why it refuses to compile DMD

Re: Digger 2.3 & verstr.h problem

2015-08-24 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 24 August 2015 at 09:18:14 UTC, Robert M. Münch wrote: On 2015-08-23 20:13:38 +, Vladimir Panteleev said: Not really sure what's going on there... If I could reproduce it, I'd try building DMD manually - if it still occurred, build DMD 2.067.1 from source and add

Re: Digger 2.3 & verstr.h problem

2015-08-23 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 23 August 2015 at 20:07:39 UTC, Robert M. Münch wrote: On 2015-08-23 17:01:07 +, Vladimir Panteleev said: [...] Ok, good. So it should be fixable on my side. [...] Not really sure what's going on there... If I could reproduce it, I'd try building DMD manually - i

Re: Digger 2.3 & verstr.h problem

2015-08-23 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 23 August 2015 at 11:27:32 UTC, Robert M. Münch wrote: Hi, just trying to build the latest DMD with Digger 2.3 and get this: uffer.d root/port.d root/response.d root/rmem.d root/rootobject.d root/speller.d root/stringtable.d newdelete.o glue.a backend.a globals.d(293): Error: file

Re: dmd/druntime/phobos HEAD: can't link binaries on Arch Linux

2015-06-15 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 15 June 2015 at 15:50:59 UTC, Atila Neves wrote: Anyone else getting this problem on Arch Linux? dmd hello.d hello.o:hello.d:TypeInfo_S3std3uni38__T13InversionListTS3std3uni8GcPolicyZ13InversionList67__T9IntervalsTS3std3uni32__T8CowArrayTS3std3uni8GcPolicyZ8CowArrayZ9Intervals.init$:

Re: Implicit conversion from null in custom type

2015-05-28 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 28 May 2015 at 13:46:52 UTC, Meta wrote: What about defining a static `nil` value for S? Might as well just use S.init. Again, doesn't help with creating a drop-in replacement.

Re: Implicit conversion from null in custom type

2015-05-28 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 28 May 2015 at 13:12:18 UTC, Andrea Fontana wrote: void fun(typeof(null)) { } ? That doesn't help with creating a drop-in replacement for an AA (or any built-in type implicitly convertible from null).

Re: Implicit conversion from null in custom type

2015-05-28 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 28 May 2015 at 11:37:34 UTC, Kagamin wrote: IIRC the rationale to ignore implicit conversions was to simplify function overloading rules. Isn't this a requirement for making AAs user types anyway?

Re: Implicit conversion from null in custom type

2015-05-28 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 28 May 2015 at 12:37:52 UTC, Andrea Fontana wrote: What's the problem with ctor taking typeof(null)? I've just used it, maybe I missed something? It doesn't work: // test.d / struct S { this(typeof(null) p) {} } void fun(S s) {} void main() { fun(null); }

Implicit conversion from null in custom type

2015-05-28 Thread Vladimir Panteleev via Digitalmars-d-learn
I'm trying to write a type which (to some extent) emulates built-in AAs. One thing I'm having trouble with is null function parameters: void fun(S s) {} void main() { fun(null); } How can S implement implicit conversion from null? I've already tried "alias this" and a constructor taking type

How to append range to array?

2015-05-23 Thread Vladimir Panteleev via Digitalmars-d-learn
int[] arr = [1, 2, 3]; auto r = iota(4, 10); // ??? assert(equal(arr, iota(1, 10))); Hopefully in one GC allocation (assuming we know the range's length). I tried std.range.primitives.put but its behavior seems a little mysterious: This compiles but asserts at runtime: int[] arr = [1, 2, 3

Re: problem with parallel foreach

2015-05-12 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 12 May 2015 at 18:14:56 UTC, Gerald Jansen wrote: On Tuesday, 12 May 2015 at 16:35:23 UTC, Rikki Cattermole wrote: On 13/05/2015 4:20 a.m., Gerald Jansen wrote: At the risk of great embarassment ... here's my program: http://dekoppel.eu/tmp/pedupg.d Would it be possible to give us

Re: String from executeshell

2015-04-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 29 April 2015 at 21:56:18 UTC, Ali Çehreli wrote: On 04/29/2015 02:54 PM, Ali Çehreli wrote: executeShell returns the status and the output as a type Certainly not. The output is an object of a special type, which the documentation refers to as 'auto'. Grrr... :) Ok, maybe it'

Re: Parseing single JSON value from webpage

2015-04-28 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 29 April 2015 at 02:34:20 UTC, William Dunne wrote: Sorry for the noob question. I'm currently trying to parse this bit of json: Array ( [meta] => Array ( [level1trust] => 1 [level2trust] => 9 ) [connections] => Array (

Re: Runtime metaprogramming in D

2015-04-28 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 29 April 2015 at 01:38:17 UTC, Dennis Ritchie wrote: Hi, Is it possible to write self-modifying code in D, who will perform at runtime? Not easily. Just the obvious approach to invoke the compiler and run/load the created executable / shared library. Or is it a characteristic

Re: How to change text while running in console?

2015-04-26 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 27 April 2015 at 02:26:01 UTC, Israel wrote: I remember doing this in C++ and it worked but is this possible in D? Its basically updating information in the console window without constantly printing new lines. http://stackoverflow.com/questions/14043148/how-to-change-text-while-r

Re: How to change text while running in console?

2015-04-26 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 27 April 2015 at 02:32:17 UTC, Adam D. Ruppe wrote: On Monday, 27 April 2015 at 02:26:01 UTC, Israel wrote: I remember doing this in C++ and it worked but is this possible in D? Have you tried it yet? The solution is basically the same, you just write out the carriage return charac

Re: Valgrind

2015-04-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 20 April 2015 at 13:29:58 UTC, John Colvin wrote: On Monday, 20 April 2015 at 13:28:57 UTC, John Colvin wrote: On Monday, 20 April 2015 at 13:16:23 UTC, Robert M. Münch wrote: Hi, I just found quite old posts about Valgrind and D. Can someone give me a short update, what the state of

Re: Building website from git master, why does it checkout DMD v2.066.1 and die?

2015-04-19 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 19 April 2015 at 16:20:23 UTC, Gary Willoughby wrote: If i pass the correct information on the command line it gets past the library errors but now shows linker errors. I'm not seeing the compilation errors when building on the staging server, so not sure why you're getting them. I

Re: Managing memory usage at Compile Time with DMD

2015-04-09 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 9 April 2015 at 09:49:39 UTC, wobbles wrote: So, I'm writing a poker AI bot. The idea was to generate a lookup table of all the poker hands using CTFE so runtime can be as quick as possible (as the bot has a very small amount of time to act). There are a LOT of calculations thoug

Re: why does phobos use [0, 5, 8, 9][] instead of [0, 5, 8, 9] in examples?

2015-04-07 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 8 April 2015 at 02:40:14 UTC, Timothee Cour wrote: Eg, code like this in std.algorithm: assert(equal(setSymmetricDifference(a, b), [0, 5, 8, 9][])); why not just: assert(equal(setSymmetricDifference(a, b), [0, 5, 8, 9])); ? It's historic. DMD 2.041 changed the type of array litera

Re: Speed of horizontal flip

2015-04-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 1 April 2015 at 13:52:06 UTC, tchaloupka wrote: C#: PNG load - 90ms PNG flip - 10ms PNG save - 380ms D using dlib (http://code.dlang.org/packages/dlib): PNG load - 500ms PNG flip - 30ms PNG save - 950ms D using imageformats (http://code.dlang.org/packages/imageformats): PNG load -

Re: CURL to get/set cookies

2015-04-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 5 April 2015 at 23:55:15 UTC, Benjamin wrote: I"m still not able to set the cookie. Would it be possible to provide a few sample lines - to ensure I'm on the right path. I appreciate any additional help!! Thanks! Benjamin This should work: auto cookiesFile = "cookies.txt"; aut

Re: Win32 bindings

2015-03-31 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 1 April 2015 at 01:09:11 UTC, Charles wrote: Are the default libraries in dmd2\windows\lib not current or something? Those only cover a small number of DLLs, and even those partially.

Re: Win32 bindings

2015-03-31 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 31 March 2015 at 17:20:05 UTC, Charles wrote: Hi guys, What is the best (and/or official) source for win32 bindings? http://www.dsource.org/projects/bindings/wiki/WindowsApi So, perhaps, a better question is what do you use for win32 bindings? Are there any additional dependencie

Re: Specify an entire directory tree for string imports

2015-03-30 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 30 March 2015 at 14:01:54 UTC, Alex Parrill wrote: On Monday, 30 March 2015 at 02:51:56 UTC, Baz wrote: It's a DMD Windows bug. It's just been reported 2 days ago: https://issues.dlang.org/show_bug.cgi?id=14349 so nothing wrong from you side. Ok, glad to see it's a bug and not a

Re: What ?

2015-03-30 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 30 March 2015 at 22:34:00 UTC, matovitch wrote: Hi again again, ulong u = 1 << 63; Raise : Error: shift by 63 is outside the range 0..31 This is a bug isn't it, the ulong are supposed to be on 64 bits ? I guess it's time I go to bed. Have a nice night ! ulong, yes, but 1 is of

Re: refactoring issues

2015-03-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 20 March 2015 at 18:36:19 UTC, Vladimir Panteleev wrote: On Friday, 20 March 2015 at 18:05:07 UTC, Ivan Kazmenko wrote: Thanks. I was able to reproduce the workflow you showed in the gif to the part where an error pop-up (e.g. "no property iota for type int") is f

Re: refactoring issues

2015-03-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 20 March 2015 at 18:05:07 UTC, Ivan Kazmenko wrote: Thanks. I was able to reproduce the workflow you showed in the gif to the part where an error pop-up (e.g. "no property iota for type int") is followed by suggesting the appropriate fix. Do I need another tool for that? Colorout

Re: refactoring issues

2015-03-19 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 19 March 2015 at 14:32:53 UTC, Ivan Kazmenko wrote: Hey, I also happen to use Far Manager and its internal editor, at least for simple projects. Is that dcheck triggering a Far plugin? I have a bit of experience with Far recording macros, but didn't try to write a plugin. It's

Re: refactoring issues

2015-03-19 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 17 March 2015 at 15:11:02 UTC, Ivan Kazmenko wrote: For the former problem, is there a tool which jumps out and tells you use Phobos without importing things properly, or suggests a Phobos import by the name of the stuff. I did make something simple for myself, but it doesn't work

Re: ErrnoException in Windows

2015-03-01 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 1 March 2015 at 16:39:29 UTC, novice2 wrote: I wanted it will be: ex.errno=2, ex.msg=CreateFileA (File not found), lasterror=2 Here's the right way to do this: // test.d // import std.c.windows.windows; import std.string : toStringz; i

Re: Starting a HTTPS session with D

2015-02-12 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 12 February 2015 at 12:11:27 UTC, Kadir Erdem Demir wrote: Hi We have a network traffic logger module at office. We need to a tool which creates simple traffic with different protocols and test our product's output to see if we parse the headers correctly or not. And of course I

Re: DUSE_MYLIB12

2015-02-11 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 11 February 2015 at 11:26:20 UTC, Dennis Ritchie wrote: Tell me, please, is it possible to set an arbitrary condition conditional compilation at the command prompt, type DUSE_MYLIB12 and in the code as: version(USE_MYLIB12) { . } Specify -version=USE_MYLIB12 on the c

Re: To write such an expressive code D

2015-02-10 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 10 February 2015 at 04:17:48 UTC, Dennis Ritchie wrote: I just need that code was only used features of the language without using library functions. You may only use the function sin(). Why is that? Although D has a lot of language features, D tries to push functionality into th

Re: To write such an expressive code D

2015-02-09 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 9 February 2015 at 19:57:23 UTC, Ali Çehreli wrote: writefln("%(%.15g\n%)", sins); In 2.067, you can write: iota(0, PI/2, PI/2/9).map!sin.each!writeln;

Re: Thread.sleep( dur!("msecs")( 50 ) ); // sleep for 50 milliseconds

2015-01-30 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 30 January 2015 at 11:04:47 UTC, FG wrote: Bug or correct behaviour? Bug: https://issues.dlang.org/show_bug.cgi?id=1238

Re: Print to Win Printer

2015-01-27 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 21:32:34 UTC, Paul wrote: How do I print to a Windows printer from a console program? Thanks for your assistance. You can save your document to a temporary file, then call ShellExecute with a path to the file and the "print" command.

Re: I left my program open for 9 hours and it used up 700mb of ram, could someone review it?

2015-01-27 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 22:39:31 UTC, Gan wrote: Would you know why this is using hundreds of mb of rams? Hi, What type is CircleShape? If it is a class, or otherwise contains pointers, then this is probably the source of your problem. You are storing high-entropy data (floating-poi

Re: Classical bug

2015-01-27 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 12:01:11 UTC, Fyodor Ustinov wrote: On Tuesday, 27 January 2015 at 11:51:43 UTC, Vladimir Panteleev wrote: In 2.067, this is an error: test.d(4,9): Error: escaping reference to local variable buffer Always or only in safe mode? Always. But the check seems

Re: Classical bug

2015-01-27 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 11:41:21 UTC, Fyodor Ustinov wrote: byte[] func() @safe { byte[1024] buffer; return buffer[0..3]; } void main() { auto b = func(); b[0] = 1; } In 2.067, this is an error: test.d(4,9): Error: escaping reference to local variable buffer

Re: Link errors with curl, libevent, OpenSSL

2015-01-25 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 25 January 2015 at 15:23:03 UTC, AndyC wrote: On Sunday, 25 January 2015 at 15:11:33 UTC, AndyC wrote: On Sunday, 25 January 2015 at 05:48:26 UTC, Vladimir Panteleev wrote: On my Ubuntu Server, I can't link any D program which uses libraries other than Phobos. Ex

Re: core.exception.InvalidMemoryOperationError@(0)

2015-01-25 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 25 January 2015 at 08:41:25 UTC, Bayan Rafeh wrote: The solution was just to remove the "delete a" from the destructor if someone comes across this later. Could someone tell me why though? The "non-reentrant" bit applies to all GC operations, really - not just allocations. Explicit

Link errors with curl, libevent, OpenSSL

2015-01-24 Thread Vladimir Panteleev via Digitalmars-d-learn
On my Ubuntu Server, I can't link any D program which uses libraries other than Phobos. Example: // import std.net.curl; import std.stdio; void main() { writeln(get("dlang.org")); } // dlang@k3:~/2015-01-25$ dmd -L-lcurl test.d /usr/

Re: What to do with InvalidMemoryOperationError

2015-01-24 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 21 January 2015 at 12:00:47 UTC, Nordlöw wrote: My executable throws as core.exception.InvalidMemoryOperationError@(0) when compiled with DMD git master. I get no stack trace in GDB. What to do? Hi, I created a wiki page which I hope will help you solve this problem: htt

Re: core.exception.InvalidMemoryOperationError@(0)

2015-01-24 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 24 January 2015 at 12:16:38 UTC, Bayan Rafeh wrote: This problem is a tough one. I've been getting this error when I run my unittests, and apparently it is caused by attempting an allocation in the destructor from what little I could find online about the subject. The error is tr

Re: generate an array of 100 uniform distributed numbers

2015-01-22 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 22 January 2015 at 19:26:46 UTC, ddos wrote: hi guys, firstly this has no direct application, i'm just playing around and learning i want to create 100 uniform distributed numbers and print them my first attempt, just written by intuition: [0 .. 100].map!(v => uniform(0.0, 1.0).wri

Re: Colour operations using CyberShadow's graphics library

2015-01-19 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 18 January 2015 at 21:10:05 UTC, Phil wrote: Hi, I'm new to D and having a go at writing some image processing stuff using Vladimir's ae.graphics library. To filter (i.e. perform correlations/convolutions) on a view with colour type C, I'd like to perform intermediate calculations

Re: Why foreach do not print value during every single Insert request in SQL?

2015-01-15 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 15 January 2015 at 12:05:24 UTC, Suliman wrote: void IMGsInsert(string [] fullimgurl) { foreach (url; fullimgurl) { string sqlinsert = (sqlrequest)

Re: For those ready to take the challenge

2015-01-10 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 10 January 2015 at 14:56:09 UTC, Adam D. Ruppe wrote: On Saturday, 10 January 2015 at 13:22:57 UTC, Nordlöw wrote: on dmd git master. Ideas anyone? Don't use git master :P Do use git master. The more people do, the fewer regressions will slip into the final release. You can u

Re: For those ready to take the challenge

2015-01-09 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 10 January 2015 at 02:10:04 UTC, Jesse Phillips wrote: On Friday, 9 January 2015 at 13:50:29 UTC, eles wrote: https://codegolf.stackexchange.com/questions/44278/debunking-stroustrups-debunking-of-the-myth-c-is-for-large-complicated-pro Link to answer in D: http://codegolf.stackexc

<    1   2   3   4   >