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
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
that
information?
Thanks!
TJB
strating how to call C code from D? With the
separate file contents and names and compilation instructions?
Thanks,
TJB
Thanks Marc. Not sure what to do here. I need to the binary data
to be exactly the number of bytes as specified by the struct.
How to handle the conversion from string to char[]?
TJB
(You forgot to include the error. For other readers: It fails
to compile with "template std.conv.t
ut as
to why? What do I need to do differently?
Thanks,
TJB
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
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
lgorithm, but not sure how
to.
Thanks!
TJB
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
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
So
some kind of system
command.
I much appreciate your help!
TJB
by this newbie.
Thanks so much!
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 transac
count;
while(!input.eof())
{
input.readExact(&tmp, TaqIdx.sizeof);
// Do something with the data
}
}
Do you have any suggestions for improving the speed in this
situation?
Thank you!
TJB
d 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
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
#include
#include
struct TradesIdx
{
char symbol[10];
int tdate;
int begrec;
int endrec;
}__attribute__((packed));
struct TradesBin
{
int ttim;
i
write 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
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
e exact size 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
(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
/write the binary data just fine, but how to do it with
compression?
I appreciate your help and suggestions.
TJB
relevant (in your minds) to numerical
programmers writing codes for statistical inference.
I look forward to your suggestions.
Thanks,
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
(like 08:00:24)? I looked in
std.datetime, but it isn't obvious which functions I should use.
You help and suggestions are much appreciated!
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
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
grep set_seed in Rmath.h I get:
$ 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
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
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
#include
#define MATHLIB_STANDALONE
#include "Rmath.h"
usi
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/u
Ah, you are right, though I 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
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
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 d
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
Ali,
Thanks. That helps me see how to use a structure. I just need to
figure out the date and time conversion.
Thanks!
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
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
,A,,4.75,11,5,11,N,R,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
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
itefln("%s %s %s %s", taq.symbol, taq.tdate, taq.begrec,
taq.endrec);
}
Thanks so much!
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
42 matches
Mail list logo