BZ2 library

2016-03-11 Thread stunaep via Digitalmars-d-learn
I'm really having a hard time using bzp (and later I need gzip and lzma). So I added this bzip2 D interface to my DUB dependencies "dependencies" : { "bzip2": "~>0.1.0" } I downloaded the bzip2 source code and compiled it for windows 32bit (will 64 bit work with dmd2?). Then I

Re: std.stdio.File.seek error

2016-03-13 Thread stunaep via Digitalmars-d-learn
It seems my lacking knowledge of C has gotten the best of me and longs in C only have a signed int range? It looks like in C, fseeko() is needed on linux and _fseeki64() is needed on windows, but I dont see either of these in stdc.stdio.

Re: std.stdio.File.seek error

2016-03-14 Thread stunaep via Digitalmars-d-learn
Just tested it on arch linux 64 bit and it works with no problem seeking to positions over 2^31-1

Re: std.stdio.File.seek error

2016-03-13 Thread stunaep via Digitalmars-d-learn
On Monday, 14 March 2016 at 03:07:05 UTC, Nicholas Wilson wrote: On Monday, 14 March 2016 at 00:12:46 UTC, stunaep wrote: On Sunday, 13 March 2016 at 12:21:11 UTC, Nicholas Wilson wrote: [...] I'm on 64 bit but it needs to work on both. It works for anything between 0 and 2147483647.

Re: std.stdio.File.seek error

2016-03-14 Thread stunaep via Digitalmars-d-learn
On Monday, 14 March 2016 at 07:15:01 UTC, Nicholas Wilson wrote: On Monday, 14 March 2016 at 05:24:48 UTC, stunaep wrote: On Monday, 14 March 2016 at 03:07:05 UTC, Nicholas Wilson wrote: [...] I'm currently on windows 7. The code you gave me prints 022. It's weird because it always tries to

Is there a sorted map?

2016-03-12 Thread stunaep via Digitalmars-d-learn
Is there any sorted map in D? I need a map and I need to be able to get the highest key in the map. In java I would use a TreeMap and use map.lastKey(), but since associative arrays are not sorted that would be O(n). I know about RedBlackTree, but that's a set and it must be a map.

Tracing InvalidMemoryOperationError

2016-03-15 Thread stunaep via Digitalmars-d-learn
I need to find the source of this InvalidMemoryOperationError. I tried loading the project in visuald but it wont break on the error. I also tried adding extern(C) void onInvalidMemoryOperationError(void*) { asm { int 3; } } building with dub build --build=debug --arch=x86_64 and then

Re: BZ2 library

2016-03-12 Thread stunaep via Digitalmars-d-learn
On Saturday, 12 March 2016 at 10:10:44 UTC, Basile B. wrote: On Saturday, 12 March 2016 at 09:53:36 UTC, stunaep wrote: [...] "dflags" : ["lib\\libbzip2.lib"] is only if you want to compile as 32 bit AND in OMF, so the -m32mscoff switch must NOT be set (I see that someone else explained you

Re: BZ2 library

2016-03-12 Thread stunaep via Digitalmars-d-learn
On Saturday, 12 March 2016 at 07:56:03 UTC, Mike Parker wrote: [...] If I do "dflags" : ["lib/libbzip2.lib"] as Basile B. suggested instead of pragma, I get the same error on x86_64 as I do on x86

Re: BZ2 library

2016-03-11 Thread stunaep via Digitalmars-d-learn
On Saturday, 12 March 2016 at 06:07:25 UTC, Mike Parker wrote: [...] I used visual studio 2013 to build the libraries With dflag -m64 and dub flag --arch=x86_64, this happens Running: dub build --arch=x86_64 ## Warning for package rsdlib ## The following compiler flags have

Re: BZ2 library

2016-03-12 Thread stunaep via Digitalmars-d-learn
On Saturday, 12 March 2016 at 07:56:03 UTC, Mike Parker wrote: [...] On Saturday, 12 March 2016 at 09:04:08 UTC, stunaep wrote: On Saturday, 12 March 2016 at 07:56:03 UTC, Mike Parker wrote: [...] If I do "dflags" : ["lib/libbzip2.lib"] as Basile B. suggested instead of pragma, I get the

Re: std.stdio.File.seek error

2016-03-14 Thread stunaep via Digitalmars-d-learn
On Monday, 14 March 2016 at 13:33:36 UTC, Mike Parker wrote: On Monday, 14 March 2016 at 09:57:19 UTC, stunaep wrote: It looks like _fseeki64 is in the nightly build but not dmd 2.070.2; However, the nightly build says std.stdio and std.conv are deprecated and I cant use them. I think you

Re: std.stdio.File.seek error

2016-03-13 Thread stunaep via Digitalmars-d-learn
On Sunday, 13 March 2016 at 12:21:11 UTC, Nicholas Wilson wrote: On Sunday, 13 March 2016 at 10:32:41 UTC, stunaep wrote: I have a very large file I need to read data from at certain positions, but I have run into this error std.conv.ConvOverflowException@std\conv.d(1328): Conversion positive

std.stdio.File.seek error

2016-03-13 Thread stunaep via Digitalmars-d-learn
I have a very large file I need to read data from at certain positions, but I have run into this error std.conv.ConvOverflowException@std\conv.d(1328): Conversion positive overflow when seeking to 6346890680. Seeking to smaller values such as 3580720 work with no problem. The file is well over

Re: Is there a sorted map?

2016-03-13 Thread stunaep via Digitalmars-d-learn
On Sunday, 13 March 2016 at 08:33:43 UTC, Jonathan M Davis wrote: On Sunday, March 13, 2016 02:35:27 stunaep via Digitalmars-d-learn wrote: [...] The closest that we have in Phobos at the moment is RedBlackTree in std.container. Its API is geared towards sets, not maps, but you can get

overriding methods

2016-04-05 Thread stunaep via Digitalmars-d-learn
I get a deprecation warning with @Override, but I was unable to find the proper way to do it. Am I meant to add override before the method like this? override public void startThread(Thread t, int pri) { ... } Am I meant to wrap the entire method in override { } like this? override {

Re: overriding methods

2016-04-05 Thread stunaep via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 18:42:33 UTC, Adam D. Ruppe wrote: On Tuesday, 5 April 2016 at 18:38:43 UTC, stunaep wrote: I get a deprecation warning with @Override, but I was unable to find the proper way to do it. What error message exactly are you getting and on what code? Both styles you

Something wrong with GC

2016-03-20 Thread stunaep via Digitalmars-d-learn
The gc throws invalid memory errors if I use Arrays from std.container. For example, this throws an InvalidMemoryOperationError: import std.stdio; import std.container; void main() { new Test(); } class Test { private Array!string test = Array!string();

Re: Something wrong with GC

2016-03-22 Thread stunaep via Digitalmars-d-learn
On Monday, 21 March 2016 at 07:55:39 UTC, thedeemon wrote: On Sunday, 20 March 2016 at 07:49:17 UTC, stunaep wrote: The gc throws invalid memory errors if I use Arrays from std.container. Those arrays are for RAII-style deterministic memory release, they shouldn't be freely mixed with

string to uppercase

2016-04-02 Thread stunaep via Digitalmars-d-learn
Is there any easy way to convert a string to uppercase? I tried s.asUpperCase, but it returns a ToCaserImpl, not a string, and it cant be cast to string. I also tried toUpper but it wasnt working with strings

Decompressing bzip2

2016-04-02 Thread stunaep via Digitalmars-d-learn
I am trying to use the bzip2 bindings that are available on code.dlang.org/packages, but I am having a really hard time using it due to the pointers. It needs to be an array once it's decompressed. Here is what I have: import std.stdio; import bzlib; void main(string[] args) { File f =

Re: Decompressing bzip2

2016-04-04 Thread stunaep via Digitalmars-d-learn
On Monday, 4 April 2016 at 08:26:07 UTC, Thomas Brix Larsen wrote: On Sunday, 3 April 2016 at 02:03:29 UTC, stunaep wrote: I am trying to use the bzip2 bindings that are available on code.dlang.org/packages, but I am having a really hard time using it due to the pointers. It needs to be an

Re: DlangUI MouseEvent mouse delta

2016-04-26 Thread stunaep via Digitalmars-d-learn
I am currently handling it like this: current = e.pos(); xdelta = current.x - previous.x; ydelta = current.y - previous.y; previous = current; I'm just wondering if there is a built in solution that I missed.

Re: DlangUI translations

2016-04-24 Thread stunaep via Digitalmars-d-learn
On Sunday, 24 April 2016 at 04:49:36 UTC, thedeemon wrote: On Saturday, 23 April 2016 at 15:44:22 UTC, stunaep wrote: I am wondering how to use other languages and how to NOT use other languages. Did you see example1 from examples folder in dlangui? It has two languages and allows switching

DlangUI translations

2016-04-23 Thread stunaep via Digitalmars-d-learn
I am wondering how to use other languages and how to NOT use other languages. I have all of the UI of my program translated to Russian, and I have the languages loading from the resource files, but I have no idea how to switch the language to Russian. Also, when adding file names to a

DlangUI MouseEvent mouse delta

2016-04-26 Thread stunaep via Digitalmars-d-learn
I am trying to know how much the mouse moves when clicking down on a certain widget, but I can't figure out how. I noticed only a mouse wheel delta property and nothing for the mouse pointer x,y deltas since the click. I am looking to do something such as if(e.lbutton().isDown() &&

DlangUI FileDialog not working

2016-05-03 Thread stunaep via Digitalmars-d-learn
FileDialog is showing a blank white window for me. Only tested on windows 7 so far, but if I run dmledit, the filedialog on there works fine. It's weird because I am using almost exactly the same code. Here is what it looks like http://i.imgur.com/qslu7tJ.png handleAction code:

Dlang UI - making widget extend to the bounds of the window

2016-04-14 Thread stunaep via Digitalmars-d-learn
I'm trying to make a gui program with dlangui, but no matter what I do, I cannot get widgets to fill the whole window. The window is resizable so I cannot just set the widths to static numbers. No layoutWidth and layoutHeight set: http://i.imgur.com/UySt30K.png layoutWidth/Height set to fill

Re: Dlang UI - making widget extend to the bounds of the window

2016-04-19 Thread stunaep via Digitalmars-d-learn
On Monday, 18 April 2016 at 07:50:28 UTC, Vadim Lopatin wrote: On Monday, 18 April 2016 at 07:06:43 UTC, Vadim Lopatin wrote: In TableLayout there is a bug #113 which prevents extending of table layout content to parent size. For other widgets FILL_PARENT should work ok. Issue #113 is fixed

Re: Dlang UI - making widget extend to the bounds of the window

2016-04-16 Thread stunaep via Digitalmars-d-learn
On Saturday, 16 April 2016 at 08:20:33 UTC, stunaep wrote: On Friday, 15 April 2016 at 10:33:35 UTC, Vadim Lopatin wrote: [...] I am doing that. I think it has to do with my high dpi because I'm using a 4k monitor. If I use Modal window flag: [...] http://i.imgur.com/FJgPq8U.png If I

Re: Dlang UI - making widget extend to the bounds of the window

2016-04-16 Thread stunaep via Digitalmars-d-learn
On Friday, 15 April 2016 at 10:33:35 UTC, Vadim Lopatin wrote: On Friday, 15 April 2016 at 00:58:58 UTC, stunaep wrote: I'm trying to make a gui program with dlangui, but no matter what I do, I cannot get widgets to fill the whole window. The window is resizable so I cannot just set the widths

Re: Dlang UI - making widget extend to the bounds of the window

2016-04-16 Thread stunaep via Digitalmars-d-learn
And no matter what window size I put when using Modal or Fullscreen, it always shows that same sized window

Re: How to search for an enum by values and why enum items aren't unique

2016-07-27 Thread stunaep via Digitalmars-d-learn
On Wednesday, 27 July 2016 at 15:32:59 UTC, Meta wrote: On Wednesday, 27 July 2016 at 13:59:54 UTC, stunaep wrote: So how would I make a function that takes an enum and an id as a parameter and returns a member in the enum? I tried for quite some time to do this but it wont let me pass Test as

Re: How to search for an enum by values and why enum items aren't unique

2016-07-27 Thread stunaep via Digitalmars-d-learn
On Wednesday, 20 July 2016 at 05:45:21 UTC, Jonathan M Davis wrote: On Wednesday, July 20, 2016 04:03:23 stunaep via Digitalmars-d-learn wrote: How can I search for an enum by its values? For example I have >struct TestTraits { > > int value1; > string value2; > >} > &g

Does D have object wrappers for primitives?

2016-07-29 Thread stunaep via Digitalmars-d-learn
I have some java code I need to convert and at one point it uses an Object[] array to store various ints, longs, and strings. Java has built in Integer and Long classes that wrap the primitives in an object and strings are already objects.

Re: Does D have object wrappers for primitives?

2016-07-29 Thread stunaep via Digitalmars-d-learn
On Friday, 29 July 2016 at 20:25:16 UTC, Cauterite wrote: On Friday, 29 July 2016 at 20:13:34 UTC, stunaep wrote: I have some java code I need to convert and at one point it uses an Object[] array to store various ints, longs, and strings. Java has built in Integer and Long classes that wrap

Re: How to search for an enum by values and why enum items aren't unique

2016-07-20 Thread stunaep via Digitalmars-d-learn
On Wednesday, 20 July 2016 at 05:45:21 UTC, Jonathan M Davis wrote: On Wednesday, July 20, 2016 04:03:23 stunaep via Digitalmars-d-learn wrote: [...] If you want the list of members in an enum, then use std.traits.EnumMembers and you'll get a compile-time list of them. It can be made

How to search for an enum by values and why enum items aren't unique

2016-07-19 Thread stunaep via Digitalmars-d-learn
How can I search for an enum by its values? For example I have struct TestTraits { int value1; string value2; } enum Test : TestTraits { TEST = TestTraits(1, "test1"), TESTING = TestTraits(5, "test5") } and I have the int 5 and need to find TESTING with it. In

Float values are wrong in union

2016-08-21 Thread stunaep via Digitalmars-d-learn
I made a union to convert between int bits and floats, but the values are coming out wrong sometimes. This is working without issue in other languages so I'm really stumped. Here's an example: union test { int i; float f; } test t = { i : 0x7fb0}; float t2 = t.f;//int bits 0x7fb0 as