Re: Linking to Dynamic Library on Mac OS X

2015-05-16 Thread TJB via Digitalmars-d-learn
On Friday, 15 May 2015 at 19:49:30 UTC, John Colvin wrote: On Friday, 15 May 2015 at 19:39:53 UTC, TJB wrote: Off the top of my head: does adding -L-L$(pwd) help? This is what I get: $ dmd main.d -L-L$(pwd) -lhello Error: unrecognized switch '-lhello' Sorry if this is completely elementary

Re: Linking to Dynamic Library on Mac OS X

2015-05-15 Thread TJB via Digitalmars-d-learn
Off the top of my head: does adding -L-L$(pwd) help? This is what I get: $ dmd main.d -L-L$(pwd) -lhello Error: unrecognized switch '-lhello' Sorry if this is completely elementary and I am being quite dumb. Thanks, TJB

Linking to Dynamic Library on Mac OS X

2015-05-14 Thread TJB via Digitalmars-d-learn
that information? Thanks! TJB

Binding to C

2015-05-11 Thread TJB via Digitalmars-d-learn
to call C code from D? With the separate file contents and names and compilation instructions? Thanks, TJB

Re: CSV Data to Binary File

2014-08-07 Thread TJB via Digitalmars-d-learn
On Thursday, 7 August 2014 at 15:11:48 UTC, TJB wrote: I am trying to read data in from a csv file into a struct, and then turn around and write that data to binary format. Here is my code: import std.algorithm; import std.csv; import stdio = std.stdio; import std.stream; align(1) struct

CSV Data to Binary File

2014-08-07 Thread TJB via Digitalmars-d-learn
to do differently? Thanks, TJB

Max/Min values in an associative array

2014-08-06 Thread TJB via Digitalmars-d-learn
to. Thanks! TJB

Re: Max/Min values in an associative array

2014-08-06 Thread TJB via Digitalmars-d-learn
Justin, That's it! Perfect - thanks!! TJB Do you just need the min and max values or do you also need the keys of those values? If the former, here's a paste: http://dpaste.dzfl.pl/0bbf31278a25

Re: Command Line Application in D

2014-08-05 Thread TJB via Digitalmars-d-learn
This is exactly what I was thinking. Thanks so much for your help! TJB Just a little something I made for you. Untested of course. But takes an argument from cli, which is a glob. Foreach file under current working directory, if its a file write out processing. (I gave std.stdio an alias

Command Line Application in D

2014-08-04 Thread TJB via Digitalmars-d-learn
some kind of system command. I much appreciate your help! TJB

Re: Command Line Application in D

2014-08-04 Thread TJB via Digitalmars-d-learn
On Monday, 4 August 2014 at 21:58:09 UTC, maarten van damme via Digitalmars-d-learn wrote: I am a little bit confused as to what you want. There is a command line example at dlang.org, and there exists a program (rdmd) that compiles several D files and runs them. http://dlang.org/rdmd.html

Creating Libraries Callable from C

2014-04-26 Thread TJB via Digitalmars-d-learn
. Thanks so much! TJB

Re: alignment of struct

2014-03-14 Thread TJB
, and the align inside is the alignment of the single field relative to the start of the struct or the precedent field. align(1) struct Foo { align(1) double x; } Bye, bearophile Thanks! That was it. TJB

Re: Improving IO Speed

2014-03-14 Thread TJB
On Friday, 14 March 2014 at 19:11:12 UTC, Craig Dillabaugh wrote: On Friday, 14 March 2014 at 18:00:58 UTC, TJB wrote: I have a program in C++ that I am translating to D as a way to investigate and learn D. The program is used to process potentially hundreds of TB's of financial transactions

alignment of struct

2014-03-13 Thread TJB
I am a bit confused by the alignment of a struct in D. I have some C++ code that I am translating into D. Here is the C++: #include fstream #include iostream #include string.h struct TradesIdx { char symbol[10]; int tdate; int begrec; int endrec; }__attribute__((packed)); struct

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-25 Thread TJB
On Tuesday, 25 September 2012 at 18:08:44 UTC, Justin Whear wrote: I wrote up a quick example program and pasted it here: http://dpaste.dzfl.pl/f1699d07 Hope that helps you out. Justin, Thanks so much! Very helpful!!! TJB

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-25 Thread TJB
it to a file like this: auto fout = new std.stream.File(data.bin.gz, FileMode.OutNew); fout.writeExact(gzdat.ptr, gzdat.sizeof); Something is wrong though. Hmm ... TJB

How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-24 Thread TJB
(outfile, FileMode.Out); fout.writeExact(bin, TradesBin.sizeof); Where bin is of type TradesBin, filled with data. The question is how do I now do this with zlib to get compression? Suggestions and help are mightily appreciated! TJB

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-24 Thread TJB
of the uncompressed data, you might also consider writing the uncompressed size of the data to your output file before the compressed data. Justin Ok, I think I get it. Can you help me set up the first part, writing to the MemoryStream? TJB

Writing/Reading Compressed Binary Files

2012-09-19 Thread TJB
/write the binary data just fine, but how to do it with compression? I appreciate your help and suggestions. TJB

Features of D to Emphasize for Academic Journal

2012-08-08 Thread TJB
relevant (in your minds) to numerical programmers writing codes for statistical inference. I look forward to your suggestions. Thanks, TJB

From number of seconds in a day to a formatted time string

2012-06-12 Thread TJB
looked in std.datetime, but it isn't obvious which functions I should use. You help and suggestions are much appreciated! TJB

Re: From number of seconds in a day to a formatted time string

2012-06-12 Thread TJB
On Tuesday, 12 June 2012 at 17:40:40 UTC, Jonathan M Davis wrote: On Tuesday, June 12, 2012 19:28:38 TJB wrote: I am working with some financial data that comes in binary files. It has two fields in particular that I am trying to convert to human readable formats. The first is a date string

D interface to Fortran

2012-06-04 Thread TJB
Is it possible to interace D with Fortran code? There are old numerical codes that I would prefer to just call directly rather than rewrite them? Thanks, TJB

Re: Interfacing D to C R standalone math library

2012-05-31 Thread TJB
Jacob, Yep! That did it. Thank you very much! TJB On Thursday, 31 May 2012 at 06:19:34 UTC, Jacob Carlborg wrote: On 2012-05-30 21:20, TJB wrote: Hello! I am still wet behind the ears with D. I am trying to interface to an existing C library from the R standalone math library (www.r

Re: Interfacing D to C R standalone math library

2012-05-31 Thread TJB
: $ grep set_seed Rmath.h voidset_seed(unsigned int, unsigned int); So I think I have called it correctly. Any thoughts or suggestions? Thanks, you have been so helpful! TJB

Re: Interfacing D to C R standalone math library

2012-05-31 Thread TJB
On Thursday, 31 May 2012 at 12:52:15 UTC, Mike Parker wrote: On 5/31/2012 9:51 PM, Mike Parker wrote: On 5/31/2012 9:40 PM, TJB wrote: One more question, if I may. I noticed that I forgot to include the set_seed function. The call to rnorm works the way I have called it, but it must be using

Interfacing D to C R standalone math library

2012-05-30 Thread TJB
Hello! I am still wet behind the ears with D. I am trying to interface to an existing C library from the R standalone math library (www.r-project.org). I can call the library quite easily from a C++ program as follows: #include iostream #include time.h #define MATHLIB_STANDALONE #include

Re: Installing Modules

2012-04-13 Thread TJB
On Friday, 30 March 2012 at 00:20:16 UTC, TJB wrote: On Thursday, 29 March 2012 at 15:15:35 UTC, Jesse Phillips wrote: On Thursday, 29 March 2012 at 08:55:41 UTC, Johannes Pfau wrote: The command Jesse posted is missing a -L-lscid and you'll probably also need -L-L/usr/local/lib So

Re: Installing Modules

2012-03-29 Thread TJB
selected /usr/local/lib as it is already part of LD's search path. but asking for the lib is still required (-L-lscid). Brilliant. Works perfectly. Thanks for your help. You guys are awesome! TJB

Installing Modules

2012-03-28 Thread TJB
All, I'm very new to D. I am wanting to install the SciD module (David Simcha's fork), but I don't know how to go about it. Can you guide me? Where does the code go? How do I import it? Thanks, TJB

Re: Installing Modules

2012-03-28 Thread TJB
On Thursday, 29 March 2012 at 02:07:24 UTC, Jesse Phillips wrote: On Wednesday, 28 March 2012 at 23:55:38 UTC, TJB wrote: All, I'm very new to D. I am wanting to install the SciD module (David Simcha's fork), but I don't know how to go about it. Can you guide me? Where does the code go

Re: Installing Modules

2012-03-28 Thread TJB
On Thursday, 29 March 2012 at 04:01:49 UTC, Jesse Phillips wrote: On Thursday, 29 March 2012 at 03:02:27 UTC, TJB wrote: Okay. I tried this. I think I am close. I followed the instructions that you gave (thanks btw)! But, I get this error message: $ dmd -I/usr/local/src main.d main.d(1

Read csv data into a struct

2012-03-02 Thread tjb
,36.61,2,36.71,1 1/2/08,9:30:10,Q,87054,X,A,4.75,73,5,76,N,R,36.61,2,36.71,1 Thanks! TJB

Re: Read csv data into a struct

2012-03-02 Thread tjb
Woops. I have a mistake in the code. Should be: import std.stdio : writeln; import std.stream; void main() { auto fin = new File(temp.csv); char[] line; int count; while(!fin.eof()) { line = fin.readLine(); writeln(line); } } Thanks! TJB

Re: Read csv data into a struct

2012-03-02 Thread tjb
Yao, Thanks. That looks perfect. I'll play with it until I figure it out. Any suggestions for the date and time variables? Thanks again! TJB

Re: Read csv data into a struct

2012-03-02 Thread tjb
Ali, Thanks. That helps me see how to use a structure. I just need to figure out the date and time conversion. Thanks! TJB

Binary I/O for Newbie

2012-02-27 Thread tjb
]; int tdate; int begrec; int endrec; } And I use an ifstream to cast the data to the structure in read. I'm struggling to get a handle on I/O in D. Can you give some pointers? Thanks so much! TJB

Re: Binary I/O for Newbie

2012-02-27 Thread tjb
, taq.symbol, taq.tdate, taq.begrec, taq.endrec); } Thanks so much! TJB

Re: Binary I/O for Newbie

2012-02-27 Thread tjb
by the number of records (if you know it) to make sure. Just looked at my old C++ code. And the struct looks like this: struct TaqIdx { char symbol[10]; int tdate; int begrec; int endrec; }__attribute__((packed)); So I am guessing I want to use the align(1) as Justin suggested. Correct? TJB